C-Pointers Question and Answer

C-Pointers Question and Answer
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
Show Answer
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
Show Answer
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
Show Answer
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
Show Answer
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
Show Answer
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
Show Answer
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
Show Answer
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
Show Answer
159. Find th output.
void main ( )
{
int *p=10;
printf ("%X", ++p);
}

  • 12
  • C
  • Compilation error
  • None of these
Show Answer
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
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test