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

d) Fail 1, Pass 2

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List some applications of c programming language?

542


Explain high-order and low-order bytes.

661


write a program to copy the string using switch case?

2395


What is difference between stdio h and conio h?

876


How do I determine whether a character is numeric, alphabetic, and so on?

618






Are the variables argc and argv are local to main?

780


What is property type c?

599


What is the hardest programming language?

661


What is "Hungarian Notation"?

631


Discuss the function of conditional operator, size of operator and comma operator with examples.

676


What does *p++ do? What does it point to?

608


How to declare a variable?

562


What is the difference between void main and main in c?

618


What are all different types of pointers in c?

568


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

670