Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Strings In C Programming Interview Exam Questions Answers For Engineering Graduates

1.What would be the Output of the following program?
main()
{
char *str[] = {“Frog”,”Do”,”Not”, “Die.”,”They”,”Croak!”};
printf(“%d %d”, Sizeof (str), sizeof (str[0]));
}
a) 3 12
b) 2 12
c) 12 3
d) 12 2
ANSWER: D

2.What would be the output of the following program?
main()
{
char str1[] = “Hello”;
char str2[] = “Hello”;
if(str1 == str2)
printf(“Equal”);
else
printf(“\nUnequal”);
}
a) Error.
b) Equal.
c) Unequal.
d) None.
ANSWER: C

3.Would the following Code give any error on compilation?
strcat (string,’!’);
a) Yes.
b) No.
ANSWER: A

4.What will happen if I use this code in my program?
#define TRACE(n) printf("TRACE: %d\n", n)
a) Nothing it is good.
b) Code is wrong.
c) Error: macro replacement within a string literal
d) None 
ANSWER: C

5.How can I print a '%' character in a printf format string?
a) Use “\%”
b) Use “/%”
c) None
d) Use “%%”
ANSWER: D
CONTINUE READING »


This post first appeared on IngenuityDias, please read the originial post: here

Share the post

Strings In C Programming Interview Exam Questions Answers For Engineering Graduates

×

Subscribe to Ingenuitydias

Get updates delivered right to your inbox!

Thank you for your subscription

×