Pointers Questions and Answers

Take Exam

Pointers questions with answers are a crucial part of C programming preparation, often included in technical interviews and MCQ-based exams. Pointers are variables that store the memory address of other variables, making them fundamental to dynamic memory management and efficient program design. These C programming MCQ questions and answers help students understand pointer arithmetic, function pointers, arrays, and memory allocation. Commonly asked in placement exams by TCS, Infosys, and Wipro, mastering pointer concepts gives you a competitive edge in coding tests and programming interviews.

Pointers

Showing 10 of 217 questions

161. Find the output void main ( ) { int x=5, *p,q; p=&x; q=p; printf ("%d", ++*q); }

  • 5
  • 6
  • Compilation error
  • None of these
Show Answer Report

162. Find the output void main () { char *p=(char*) 0x21; printf("%d %p", p, p); }

  • 21 0021
  • 21 21
  • 33 0021
  • None of these
Show Answer Report

163. The following declaration represents float *p( ) ) ( ) ;

  • a function returning float
  • a function returning a pointer
  • a function returing a pointer to a function returning float.
  • a function returning a function returning float
Show Answer Report

164. Find the output void main ( ) { *(char*) 65 = 'a'; printf ("%c", * (char*) 65); }

  • a
  • A
  • Error
  • None of these
Show Answer Report

165. Find the output void main ( ) { char *p="com\0"; char *q="comd"; if (p==q) printf ("both are equal"); else printf ("not equal"); }

  • Both are equal
  • Not equal
  • Not output
  • None of these
Show Answer Report

166. Find the output. void main ( ) { char *p="raja"; char *q="ram"; char s[10]; strcpy (s, p, q); printf("%s", s); }

  • raja
  • ram
  • rajaram
  • Compilation error
Show Answer Report

167. Find the output. void main ( ) { float *f; printf ("%D %d", sizeof (f), sizeof (*f)); }

  • 2 4
  • 4 4
  • 2 2
  • Depends on compiler
Show Answer Report

168. Find the output void main ( ) { char *p={1234}; int *q; q=p; while (*p) { printf ("%c",, *q); p++; q++; } }

  • 1234
  • 13
  • Garbage output
  • Compilation error
Show Answer Report

169. Find the output void main ( ) { char *p="hello"; printf ("%. 3s",p); }

  • hel
  • 1lo
  • 3helo
  • None of these
Show Answer Report

170. Find the output. void main ( ) { int x=5; void *p; p=&x; printf ("d", *(int *)p); }

  • 5
  • Garbage
  • Generic pointer can not be dereferenced
  • No output
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test