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

How can a number be converted to a string?

600


Write a factorial program using C.

643


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1212


What is a buffer in c?

575


What are the 4 types of unions?

607






What do you mean by Recursion Function?

628


what is the role you expect in software industry?

1655


There seem to be a few missing operators ..

617


What does dm mean sexually?

810


What is the main difference between calloc () and malloc ()?

570


What is difference between %d and %i in c?

691


What is the description for syntax errors?

611


What are the properties of union in c?

588


Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"

1582


What are control structures? What are the different types?

596