TCS Company Programming Basics

Predict the output of following code:
main()
{
if(5,4,3,2,1,​ 0 ​ ) // Last value of list is considered
printf(“True”);
else
printf(“False”);
}
1. True
2. False
3. True False
4. Error

Read Solution (Total 3)

TCS Other Question

Predict the output of following code:
main()
{
if(1) // True always
printf(“hai”);
else
printf(“hello”);
}

1. Error
2. hai
3. hello
4. No output
Predict the output of following code:
main()
{
if(5,4,3,2,1,0,8,​ 9 ​ ) // Last value of list is considered
printf(“True”);
else
printf(“False”);
}

1. True
2. False
3. True False
4. Error