C-Pointers Question and Answer

C-Pointers Question and Answer
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
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
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
164. Find the output
void main ( )
{ *(char*) 65 = 'a';
printf ("%c", * (char*) 65);
}

  • a
  • A
  • Error
  • None of these
Show Answer
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
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
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
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
169. Find the output
void main ( )
{
char *p="hello";
printf ("%. 3s",p);
}

  • hel
  • 1lo
  • 3helo
  • None of these
Show Answer
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
Questions and Answers for Competitive Exams Various Entrance Test