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

Fail 1,Fail 2

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What will be the outcome of the following conditional statement if the value of variable s is 10?

758


Explain two-dimensional array.

625


How do you generate random numbers in C?

653


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

7388


Why is structure important for a child?

601






What is volatile variable in c?

655


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1067


What are the differences between Structures and Arrays?

605


What is the advantage of c?

608


Explain what is meant by 'bit masking'?

642


What’s a signal? Explain what do I use signals for?

604


How to compare array with pointer in c?

617


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

700


What are the rules for identifiers in c?

584


Write a progarm to find the length of string using switch case?

1607