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 

6. What is (void*)0?

  • Error
  • Representation of void pointer
  • Representation of NULL pointer
  • Both B and C

7. The declaration int (*p) [5]; means

  • the same as int *p[5];
  • p is a one dimensional array of size 5, of pointers to integers
  • Both A and B
  • p is a pointer to a 5 element integer array

8. Guess the output

#include <stdio.h>
    int main()
    {
        int i = 97, *p = &i;
        foo(&i);
        printf("%d ", *p);
    }
    void foo(int *p)
    {
        int j = 2;
        p = &j;
        printf("%d ", *p);
    }
  • 2 2
  • 2 24
  • 2 97
  • Compilation error

9. What are the different ways to initialize an array with all elements as zero?

  • int array[5] = {};
  • int array[5] = {0};
  • int a = 0, b = 0, c = 0; int array[5] = {a, b, c};
  • All of the above

10. what will be the output of the following program

#include <stdio.h>
    int main()
    {
        int ary[4] = {1, 2, 3, 4};
        int p[4];
        p = ary;
        printf("%d\n", p[1]);
    }
  • Compile time error
  • 1
  • 2
  • Run time error