Logo

C-and-c- Questions Set 10:

Quiz Mode

How is the 4th element in an array accessed based on pointer notation?

1
2
3
4

Solution:

Object-Oriented programming employs a _____ programming approach.

1
2
3
4

Solution:

Which C function is used to allocate memory dynamically at run-time?

1
2
3
4

Solution:

Consider the following code:

int i, *j, **k;

i = 10;

j = &i;

k = &j;

What will be the value of **k?

1
2
3
4

Solution:

Find the error in the following code.

1. int main()

2. {

3.   int x[]={1,3,5,7,9};

4.   int *y;

5.   y=x;

6.   y=y+2;

7.   printf("%d",*y);

8. }

1
2
3
4

Solution:

What is the purpose of the monetary facet?

1
2
3
4

Solution:

What will be the output of the following C++ code?

#include <iostream>
#include <bitset>
using namespace std;
int main()
{
bitset<8> b1(20);
cout << b1.test(1);
cout << b1.test(2);
}

1
2
3
4

Solution:

Which of the following statement is correct?

1
2
3
4

Solution:

What will happen when the following C program is compiled and executed?

#include "stdio.h"
int main()
{
int i = 1, j;
for ( ; ; )
{
if (i)
j = --i;
if (j < 10)
printf("GeeksQuiz", j++);
else
break;
}
return 0;
}

1
2
3
4

Solution:

Consider the following ANSI C program:

#include < stdio.h > #include < stdlib.h > struct Node{ int value; struct Node *next;}; int main( ) { struct Node *boxE, *head, *boxN; int index=0; boxE=head= (struct Node *) malloc(sizeof(struct Node)); head → value = index; for (index =1; index<=3; index++){ boxN = (struct Node *) malloc (sizeof(struct Node)); boxE → next = boxN; boxN → value = index; boxE = boxN; } for (index=0; index<=3; index++) { printf(“Value at index %d is %dn”, index, head → value); head = head → next; printf(“Value at index %d is %dn”, index+1, head → value); } }

Which one of the following statements below is correct about the program?

1
2
3
4

Solution: