Pointers Questions and Answers

Practice Mode
Showing 10 of 217 questions
Q151
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); }
  • A 2 2
  • B 3 2
  • C 2 3
  • D Compilation error
Answer: Option B
Q152
Find the output. void main ( ) { char *p; p=(int*) 0X0005; *p=300; printf ("%d", *p); }
  • A 44 Null pointer assignment
  • B 300
  • C Non portable pointer conversion
  • D Garbage
Answer: Option A
Q153
Find the output. void main ( ) { int x=5, *p, **q, ***r; p=&x; q=&p; **q+=**q; r=&q; ***r+=***r printf (%d", * ((&x)); }
  • A 5
  • B 20
  • C Lvalue required
  • D None of these
Answer: Option B
Q154
Find the output void main () { char *a[ ] = {"good", "bad", "boy"}; printf("%s %s %s", *a+1, *a+2, *a+3); }
  • A good bad boy
  • B boy bad good
  • C good odd od
  • D odd od d
Answer: Option D
Q155
Find the output void main ( ) { int *p, *q; p=0x40; q=0x30; q=p-q; *a=012; q=p; printf("%d %d, *p, *q); }
  • A 012 012
  • B 12 12
  • C 10 10
  • D Invalid pointer subtraction
Answer: Option C
Q156
Find the output void main ( ) { int *p; p=0X0000; *p=10; printf("%d %d", *p, ++*p); }
  • A 10 11
  • B 11 11
  • C Base address of data segment can't be dereferenced.
  • D Null pointer assignment
Answer: Option B
Q157
Find the output. void main ( ) { int far *p, *q; printf ("%d %d"), size of (p), sizeof (q)); }
  • A 2 2
  • B 4 4
  • C 4 2
  • D 2 4
Answer: Option C
Q158
Find the output. void main ( ) int i=10, *p; p=&i; printf("%d %d", *(p++), (*p)++); }
  • A 11 10
  • B 0 10
  • C 10 11
  • D Garbage Garbage
Answer: Option A
Q159
Find th output. void main ( ) { int *p=10; printf ("%X", ++p); }
  • A 12
  • B C
  • C Compilation error
  • D None of these
Answer: Option B
Q160
Turbo C supports 3 knds of pointer such as near, far and huge only due to
  • A 20 bits address bus
  • B 16 bits data bus
  • C Mismatch of 16 bits register with 20 bits address bus
  • D Mismatch of data bus with address bus
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test