Sail E0 Webinar

MCQs

Total Questions : 64 | Page 7 of 7 pages
Question 61.

What will be output of following program?




#include<stdio.h>
#include<string.h>
int main()
{
int a = 5, b = 10, c;
int *p = &a,*q = &b;
c = p - q;
printf("%d",c);
return 0;
}


  1.    1
  2.    5
  3.    -5
  4.    Compilation error
  5.    None of the above
 Discuss Question
Answer: Option A. -> 1

Difference of two same type of pointer is always one



Question 62.
What will be the output of the following program :
#include<stdio.h>
main()
{
int a=555,*ptr=&a,b=*ptr;
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 B. -> 555 554 555


Question 63.

What will be output of following program?

#include<stdio.h>
int main()
{
int i;
int *j;
int **k;
j = &i;
k = &j;
printf("%u %u %u", i, j, k);
return 0;
}


  1.    3 Address 3
  2.    3 Address Address
  3.    3 3 3
  4.    Compilation error
  5.    None of the above
 Discuss Question
Answer: Option B. -> 3 Address Address

Output will be : 3 Address Address



Question 64.
What will be the output of the following program :
#include<stdio.h>
main()
{
int val=1234;
int* ptr=&val;
printf("%d %d",val,(*ptr)++);
}
  1.    1234 1234
  2.    1235 1235
  3.    1234 1235
  4.    1235 1234
 Discuss Question
Answer: Option D. -> 1235 1234



Latest Videos

Latest Test Papers