Pointers Questions and Answers

Practice Mode
Showing 10 of 217 questions
Q161
Find the output void main ( ) { int x=5, *p,q; p=&x; q=p; printf ("%d", ++*q); }
  • A 5
  • B 6
  • C Compilation error
  • D None of these
Answer: Option C
Q162
Find the output void main () { char *p=(char*) 0x21; printf("%d %p", p, p); }
  • A 21 0021
  • B 21 21
  • C 33 0021
  • D None of these
Answer: Option C
Q163
The following declaration represents float *p( ) ) ( ) ;
  • A a function returning float
  • B a function returning a pointer
  • C a function returing a pointer to a function returning float.
  • D a function returning a function returning float
Answer: Option C
Q164
Find the output void main ( ) { *(char*) 65 = 'a'; printf ("%c", * (char*) 65); }
  • A a
  • B A
  • C Error
  • D None of these
Answer: Option A
Q165
Find the output void main ( ) { char *p="com\0"; char *q="comd"; if (p==q) printf ("both are equal"); else printf ("not equal"); }
  • A Both are equal
  • B Not equal
  • C Not output
  • D None of these
Answer: Option B
Q166
Find the output. void main ( ) { char *p="raja"; char *q="ram"; char s[10]; strcpy (s, p, q); printf("%s", s); }
  • A raja
  • B ram
  • C rajaram
  • D Compilation error
Answer: Option A
Q167
Find the output. void main ( ) { float *f; printf ("%D %d", sizeof (f), sizeof (*f)); }
  • A 2 4
  • B 4 4
  • C 2 2
  • D Depends on compiler
Answer: Option A
Q168
Find the output void main ( ) { char *p={1234}; int *q; q=p; while (*p) { printf ("%c",, *q); p++; q++; } }
  • A 1234
  • B 13
  • C Garbage output
  • D Compilation error
Answer: Option C
Q169
Find the output void main ( ) { char *p="hello"; printf ("%. 3s",p); }
  • A hel
  • B 1lo
  • C 3helo
  • D None of these
Answer: Option A
Q170
Find the output. void main ( ) { int x=5; void *p; p=&x; printf ("d", *(int *)p); }
  • A 5
  • B Garbage
  • C Generic pointer can not be dereferenced
  • D No output
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test