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 

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

int main()
{
int i = 10;
int *const p = &i;
foo(&p);
printf("%d\n", *p);
}
void foo(int **p)
{
int j = 11;
*p = &j;
printf("%d\n", **p);
}
  • 11 12
  • 11 11
  • Segment Fault
  • Error

17. Which of the following are correct syntaxes to send an array as a parameter to function:

  • func($array);
  • func(*array);
  • func(array);
  • func(&array);

18. Assume the output of the following code:

 #include <stdio.h>
    void main()
    {
        char *a[10] = {"hi", "hello", "how"};
        int i = 0, j = 0;
        a[0] = "hey";
        for (i = 0;i < 10; i++)
        printf("%s\n", a[i]);
    }
  • hey hello how Segmentation fault
  • hi hello how Segmentation fault
  • hi hello how followed by 7 null values
  • Compilation error

19. Can we combine the two statements

char *p;

p = (char*) malloc(100);

  • char *p = (char *)(malloc*)(100);
  • char *p = (char*)malloc(100);
  • char p = *malloc(100);
  • char *p = (char) malloc(100);

20. which header file is the NULL macro defined?

  • stdio.h
  • math.h
  • stddef.h
  • stdio.h and stddef.h