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
Not all reserved words are written in lowercase. TRUE or FALSE?
Explain how can a program be made to print the line number where an error occurs?
What are the rules for identifiers in c?
What is switch in c?
What is string function c?
How variables are declared in c?
What are header files in c?
Where are c variables stored in memory?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
What is a macro?
Is sizeof a keyword in c?
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
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
When should you not use a type cast?
What are the 5 types of organizational structures?