Pointers Questions and Answers
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
151. Find the output. void main ( ) { int a [2] [2] = {1, 2, 3, 4}; int *p, *q; p=a; q=&a; printf ("%d %d", ++*p, ++*q); }
- 2 2
- 3 2
- 2 3
- Compilation error
152. Find the output. void main ( ) { char *p; p=(int*) 0X0005; *p=300; printf ("%d", *p); }
- 44 Null pointer assignment
- 300
- Non portable pointer conversion
- Garbage
153. Find the output. void main ( ) { int x=5, *p, **q, ***r; p=&x; q=&p; **q+=**q; r=&q; ***r+=***r printf (%d", * ((&x)); }
- 5
- 20
- Lvalue required
- None of these
154. Find the output void main () { char *a[ ] = {"good", "bad", "boy"}; printf("%s %s %s", *a+1, *a+2, *a+3); }
- good bad boy
- boy bad good
- good odd od
- odd od d
155. Find the output void main ( ) { int *p, *q; p=0x40; q=0x30; q=p-q; *a=012; q=p; printf("%d %d, *p, *q); }
- 012 012
- 12 12
- 10 10
- Invalid pointer subtraction
156. Find the output void main ( ) { int *p; p=0X0000; *p=10; printf("%d %d", *p, ++*p); }
- 10 11
- 11 11
- Base address of data segment can't be dereferenced.
- Null pointer assignment
157. Find the output. void main ( ) { int far *p, *q; printf ("%d %d"), size of (p), sizeof (q)); }
- 2 2
- 4 4
- 4 2
- 2 4
158. Find the output. void main ( ) int i=10, *p; p=&i; printf("%d %d", *(p++), (*p)++); }
- 11 10
- 0 10
- 10 11
- Garbage Garbage
159. Find th output. void main ( ) { int *p=10; printf ("%X", ++p); }
- 12
- C
- Compilation error
- None of these
160. Turbo C supports 3 knds of pointer such as near, far and huge only due to
- 20 bits address bus
- 16 bits data bus
- Mismatch of 16 bits register with 20 bits address bus
- Mismatch of data bus with address bus