TCS Company Programming Arrays

Predict the output of following code:
main()
{
if( printf(“”)) // prints content of printf statement and
//takes length of the string for if case
case its 1, So true
printf(“Face”);
else
printf(“Focus”);
}

1. Error
2. Face
3. “”Focus
4. Face

Read Solution (Total 9)

TCS Other Question

Predict the output of following code:
main()
{
if( printf(“Hai”)) // prints content of printf statement and
//takes length of the string for if case
//execution in this case
its 4, So true
printf(“Face”);
else
printf(“Focus”);
}

1. Error
2. HaiFace
3. HaiFocus
4. Face
Predict the output of following code:
main()
{
if(printf(“O”, printf(“Two”))) / prints content of printf statement and takes
length of
//the string for if case execution in this case its
4, So true
printf(“Face”);
else
printf(“Focus”);
}

1. Error
2. OTwoFace
3. HaiFocus
4. Face