Loading, please wait...

Pointers in C Programming MCQ (Multiple Choice Questions And Answers)

Search here for MCQs

Are you preparing for the next job interviews? If yes, trust me this post will help you also we'll suggest you check out a big collection for Programming Full Forms that may help you in your interview:

List of Programming Full Forms 

26. what will be the output of the following program:

#include <stdio.h>
    int main()
    {
        int i = 0, j = 1;
        int *a[] = {&i, &j};
        printf("%d", (*a)[0]);
        return 0;
    }
  • 0
  • 4
  • Compilation Error
  • Run time error

27. Output is

void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int *r = &p;
printf("%d", (**r));
}
  • 3
  • 1
  • 2
  • Compile time error

28. What is the output?

int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c;
int **sptr = &ptr1; //-Ref
*sptr = ptr2;
}
  • ptr1 points to a
  • Both A and B
  • ptr1 points to b
  • None of the above

29. a?b is syntactically correct if

  • a is structure and b is a pointer to a structure
  • a and b are structures
  • a is a pointer to a structure and b is a structure
  • All of the above

30. Which of the following declaration are illegal?

  • int *a[] = {{1, 2, 3}, {2, 3, 4, 5}};
  • int a[][] = {{1, 2, 3}, {2, 3, 4, 5}};
  • Both A and B
  • None of the above