Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

C Programming :: Pointers

Home > C Programming > Pointers > General Questions

11. What will be output of the following "c" code?

#include
int main(){
int i;
static double *p,*q,*r,*s,t=5.0;
double **arr[]={&p,&q,&r,&s};
*p=*q=*r=*s=t;
for(i=0;i<4;i++)
printf("%.0f ",**arr[i]);
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

12. What is the output of the following 'C' program ?

#include
void main()
{
float a = 5.375;
char *p;
int i;
p = (char*) &a;
for (i = 0; i <= 3; i++)
printf ("%02X", (unsigned char) p[i]);
}
Note: binary equivalent of 5.375 in.normalised form is Ol00 0000 1010 1100 0000 0000 0000, 0000

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

13. What is the output of the following C Program?

#include
void main( )
{
static int a[] = {0,1,2,3,4};
int *p[ ] = {a,a+1,a+2,a+3,a+4};
int **ptr = p;
ptr++;
printf("\n %d %d %d", ptr-p, *ptr-a, **ptr);
*ptr++;
printf("\n %d %d %d", ptr-p, *ptr-a, **ptr);
*++ptr;
printf("\n %d %d %d", ptr-p, *ptr-a, **ptr);
++*ptr;
printf("\n %d %d %d", ptr-p, *ptr-a, **ptr);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

14. What is the output of the following C Program?

#include
void main( )
{
char *q;
int j;
for (j=0; j<3; j++)
scanf("%s" ,(q+j));
for (j=0; j<3; j++)
printf("%c" ,*(q+j));
for (j=0; j<3; j++)
printf("%s" ,(q+j));
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option D

Explanation:

Memory need to be allocated for q

Workspace

Tags:

No Tags on this question yet!

15. What is the output of the following C Program?

#include
void main( )
{
void *vp;
char ch = 'g', *cp = "goofy";
int j = 20;
vp = &ch;
printf("%c", *(char *)vp);
vp = &j;
printf("%d",*(int *)vp); vp = cp;
printf("%s",(char *)vp + 3);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Since a void pointer is used it can be type casted to any other type pointer. vp = &ch stores address of char ch and the next statement prints the value stored in vp after type casting it to the proper data type pointer.
the output is 'g'.
=> Similarly the output from second printf is '20'.
=> The third printf statement type casts it to print the string from the 4th value hence the output is 'fy'.

Workspace

Tags:

No Tags on this question yet!

16. What is the output of the following C Program?

#include
void main()
{
void *v;
int integer=2;
int *i=&integer;
v=i;
printf("%d",(int*)*v);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option C

Explanation:

Void pointer is a generic pointer type. No pointer arithmetic can be done on it.

Workspace

Tags:

No Tags on this question yet!

17. What is the output of the following C Program?

#include
void main()
{
char *p = "ayqm";
printf("%c",++*(p++));
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

18. What is the output of the following C Program?

#include
void main()
{
char *p = "program";
char c;
c = *p++;
printf("%c",c);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

19. What is the output of the following C Program?

#include
void main()
{
char *p = "program";
char c;
c = ++*p++;
printf("%c",c);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

20. What is the output of the following C Program?

#include
void main()
{
char *p = "program";
char c;
c = *(++p);
printf("%c",c);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!