TCS
Company
Programming
Basics
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
Read Solution (Total 7)
-
- true
since last data in the list is non-zero,if block gets printed - 6 years agoHelpfull: Yes(10) No(1)
- error
bcz
the condition inside if statement should be of boolean type - 6 years agoHelpfull: Yes(2) No(5)
- error
bcz no condition checking is done here. - 5 years agoHelpfull: Yes(0) No(1)
- True , first 5 is took then it discard it ,den 4 discard it .. in last 9 is there which is true value so True is printed
- 5 years agoHelpfull: Yes(0) No(0)
- ans:True
The value false only be printed when 0 is at the end of the list - 5 years agoHelpfull: Yes(0) No(0)
- The answer is Error
- 4 years agoHelpfull: Yes(0) No(0)
- Answer is Error
- 4 years agoHelpfull: Yes(0) No(0)
TCS Other Question