Classical

C Programming MCQ - Pointers

26:  

Consider the declaration

int a = 5, *b = &a;

The statement
printf("%d", a * b);
prints

A.

25

B.

garbage

C.

5 x address of b

D.

an error message

 
 

Option: D

Explanation :


27:  

Consider the following segment
char *a, *b, c[10], d[10];
a = b;
b = c;
c = d;
d = a;

choose the statements having errors

A.

no error

B.

a = b; and b = c;

C.

c = d; and d = a;

D.

a = b; and d = a;

 
 

Option: C

Explanation :


28:  

calloc(m, n); is equivalent to

A.

malloc (m*n, 0);

B.

memset(0, m*n);

C.

ptr = malloc (m*n); memset (p, 0, m*n);

D.

ptr = malloc(m*n); strcpy(p, u);

 
 

Option: C

Explanation :


29:  

If p is a pointer to an integer and t is a pointer to a character then sizeof (p) will be

A.

same as that of sizeof ( t )

B.

greater than that of sizeof (t)

C.

 less than that of sizeof ( t )

D.

none of the above

 
 

Option: A

Explanation :


30:  

Which of the following comments about arrays and pointers is/are not true?

A.

Both are exactly same

B.

Array is a constant pointer

C.

Pointer is an one-dimensional and dynamic array

D.

All of these

 
 

Option: D

Explanation :




Suggest an improvement