Sail E0 Webinar

MCQs

Total Questions : 34 | Page 4 of 4 pages
Question 31. What is the output of this C code?
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int **r = &p;
printf("%p %p", *r, a);
}
  1.    Different address is printed
  2.    1   2
  3.    Same address is printed.
  4.    1   1
 Discuss Question
Answer: Option C. -> Same address is printed.


None.


Question 32. What is the output of this C code?
int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c;
int **sptr = &ptr1; //-Ref
*sptr = ptr2;
}
  1.    ptr1 points to a
  2.    ptr1 points to b
  3.    sptr points to ptr2
  4.    None of the mentioned.
 Discuss Question
Answer: Option B. -> ptr1 points to b


None.


Question 33. How many number of pointer (*) does C have against a pointer variable declaration?
  1.    7
  2.    127
  3.    255
  4.    No limits
 Discuss Question
Answer: Option D. -> No limits


None.


Question 34. What is the output of this C code?
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int *r = &p;
printf("%d", (**r));
}
  1.    1
  2.    Compile time error
  3.    Address of a
  4.    Junk value
 Discuss Question
Answer: Option B. -> Compile time error


None.


Latest Videos

Latest Test Papers