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

Not all reserved words are written in lowercase. TRUE or FALSE?

840


Explain how can a program be made to print the line number where an error occurs?

786


What are the rules for identifiers in c?

685


What is switch in c?

741


What is string function c?

656






How variables are declared in c?

670


What are header files in c?

704


Where are c variables stored in memory?

679


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

715


What is a macro?

763


Is sizeof a keyword in c?

668


a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if

787


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

798


When should you not use a type cast?

761


What are the 5 types of organizational structures?

659