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 

11. what will be the output of the following program?

int main()
{
int i = 97, *p = &i;
foo(&p);
printf("%d ", *p);
return 0;
}
void foo(int **p)
{
int j = 2;
*p = &j;
printf("%d ", **p);
}
  • 2 97
  • 2 2
  • Compilation Error
  • Segment Fault

12. what will be the output of the following program

#include "stdio.h"
#include "stdlib.h"

int main(int argc, char *argv[]) { 
    char temp[20];
    gcvt(23.45,2, temp);
    printf("%s", temp);
    return 0;
}
  • 0.45
  • 0.4
  • 23.45
  • 23

13. A function q that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as

  • Int *q(char *)[ ]
  • nt (*q) (char *)[ ]
  • int (*q (char*) )[ ]
  • None of the above

14. correct syntax to declare a 3 dimensional array using pointers

  • char $a[][];
  • char *a[][];
  • char &a[][]
  • None of the above

15. what will be the output of the following program

#include "stdio.h"
char * f();
char a = 'a';

int main(int argc, char *argv[])
{ 
char *temp = f();
printf("%s", temp);
return 0;
}

char *f()
{ return &a;
}
  • a
  • "a"
  • Compilation Error
  • None of the these