What will be the result of the following program?
main()
{
char p[]="String";
int x=0;

if(p=="String")
{
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}

a) Pass 1, Pass 2
b) Fail 1, Fail 2
c) Pass 1, Fail 2
d) Fail 1, Pass 2
e) syntax error during compilation

Answer Posted / guest

a) Pass 1, Pass 2

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is anagram in c?

516


Is fortran still used in 2018?

592


What is a pointer in c?

679


What is substring in c?

636


Is register a keyword in c?

631






which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1132


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

611


What is sizeof int in c?

598


What is the correct declaration of main?

676


What is the code in while loop that returns the output of given code?

1315


How can I do peek and poke in c?

617


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

871


What is static volatile in c?

574


Why doesnt that code work?

600


List the variables are used for writing doubly linked list program.

1619