Sail E0 Webinar

MCQs

Total Questions : 64 | Page 5 of 7 pages
Question 41.

What would be the equivalent pointer expression for referring the array element a[i][j][k][l]


  1.    ((((a+i)+j)+k)+l)
  2.    *(*(*(*(a+i)+j)+k)+l)
  3.    (((a+i)+j)+k+l)
  4.    ((a+i)+j+k+l)
 Discuss Question
Answer: Option B. -> *(*(*(*(a+i)+j)+k)+l)

No answer description available for this question. 


Question 42.

In which header file is the NULL macro defined?


  1.    stdio.h
  2.    stddef.h
  3.    stdio.h and stddef.h
  4.    math.h
 Discuss Question
Answer: Option C. -> stdio.h and stddef.h

The macro "NULL" is defined in locale.h, stddef.h, stdio.h, stdlib.h, string.h,

 time.h, and wchar.h.


Question 43.

If a variable is a pointer to a structure, then which of the following operator is used 

to access data members of the structure through the pointer variable?


  1.    .
  2.    &
  3.    *
  4.    ->
 Discuss Question
Answer: Option D. -> ->

No answer description available for this question. 


Question 44.

Can you combine the following two statements into one?

char *p;

p = (char*) malloc(100);


  1.    char p = *malloc(100);
  2.    char *p = (char) malloc(100);
  3.    char *p = (char*)malloc(100);
  4.    char *p = (char *)(malloc*)(100);
 Discuss Question
Answer: Option C. -> char *p = (char*)malloc(100);

No answer description available for this question. 


Question 45.

How many bytes are occupied by near, far and huge pointers (DOS)?


  1.    near=2 far=4 huge=4
  2.    near=4 far=8 huge=8
  3.    near=2 far=4 huge=8
  4.    near=4 far=4 huge=8
 Discuss Question
Answer: Option A. -> near=2 far=4 huge=4

near=2, far=4 and huge=4 pointers exist only under DOS. Under windows and Linux 

every pointers is 4 bytes long.


Question 46.

What is (void*)0?


  1.    Representation of NULL pointer
  2.    Representation of void pointer
  3.    Error
  4.    None of above
 Discuss Question
Answer: Option A. -> Representation of NULL pointer

No answer description available for this question. 


Question 47.
What will be the output of the following program :
#include<stdio.h>
main()
{
int a=555,b=*ptr,*ptr=&a;
printf("%d %d %d",++a,--b,*ptr++);
}
  1.    Compile Error
  2.    555 554 555
  3.    556 554 555
  4.    557 554 555
 Discuss Question
Answer: Option A. -> Compile Error


Question 48.
What will be the output of the following program :
#include<stdio.h>
void main()
{
float val=5.75;
int *ptr=&val;
printf("%.2f %.2f",*(float *)ptr,val);
}
  1.    Compile Error
  2.    5.75 5.75
  3.    5.00 5.75
  4.    None of these
 Discuss Question
Answer: Option B. -> 5.75 5.75



Question 49.
What will be the output of the following program :
#include<stdio.h>
main()
{
int a=5u,*b,**c,***d,****e;
b=&a;
c=&b;
d=&c;
e=&d;
printf("%u %u %u %u",*b-5,**c-11,***d-6,65535+****e);
}
  1.    Compile Error
  2.    0 65530 65535 4
  3.    65530 65535 65539
  4.    0 -6 -1 -2
 Discuss Question
Answer: Option B. -> 0 65530 65535 4



Question 50.
What will be the output of the following program :
#include<stdio.h>
void main()
{
int (*a)[5];
printf("%d %d",sizeof(*a),sizeof(a));
}
  1.    Compile error
  2.    2 5
  3.    5 2
  4.    None of these
 Discuss Question
Answer: Option D. -> None of these



Latest Videos

Latest Test Papers