Pointers Questions and Answers

Practice Mode
Showing 10 of 217 questions
Q211
Which of the following statement agree weith the statement "It declares a function that recives a pointer to a pointer to a char and returns a pointer to a pointer to a pointer to a char"
  • A char *MyFun (char **);
  • B char **Myfun (char **);
  • C char ***Myfun(char**);
  • D None of these
Answer: Option C
Q212
What is the true about the code static char vo1atile const *Myfun( ) { static char vo1atile const *p="Madhu"; return p; } void main ( ) { printf("%s",MyFun( ) ); }
  • A The code is perfect and output is Madhu
  • B Error too many storage class
  • C No error but p is a dangling pointer
  • D Error leading to memory curruption.
Answer: Option A
Q213
Find the output void main ( ) { const int i=5; const int *p; int *q; p=&i; q=&i; (*q)++; printf("\n %d, %d\n", *p, *q); }
  • A 6, 5
  • B 5, 6
  • C 6, 6
  • D Compilation error
Answer: Option C
Q214
Find the output void main ( ) { int a[ ] [3] = {a, 2, 3, 4, 5, 6}; int (*ptr)[3]=a; printf ("%d %d",(*ptr) [1], (*ptr)[2]); ++ptr; printf("%d %d",(*ptr)[1], (*ptr) [2]); }
  • A 2 3 5 6
  • B 2 3 4 5
  • C 4 5 0 0
  • D None of the above
Answer: Option A
Q215
Which format specifier is used to find out the offset address of a variable ?
  • A %o
  • B %p
  • C %h
Answer: Option B
Q216
Find the output void main ( ) { int *p=(int*) f( ); *p=9; printf("%d", *p); } f() { int *p=malloc(2*sizeof(int)); return p; }
  • A 9
  • B 4
  • C compilation error
  • D None of these
Answer: Option A
Q217
Find the output void main () { char huge *p=(char huge*) 0x02220110; char huge *q=(char huge*)0x00002330; if (p==q) printf("equal and Normalized"); else printf("Not Equal and NOrmalized"); }
  • A Nor equal and normalized
  • B Equal and normalized
  • C Memory scratch
  • D Huge pointers can't be compared
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test