Question Id : 12657 |
Context : JECA MCA 2024
What is the output of the following code snippet? #include int main(){ int x; x = 5 > 8 ? 10 : 1 != 2 < 5 ? 20 : 30; printf("%d", x); return 0; }
🎥 Video solution / Text Solution of this question is given below:
Solution: 5>8 is false ⇒ evaluate 1 != 2 < 5 ? 20 : 30.
Relational before != : 2<5 ⇒ 1. Then 1 != 1 ⇒ false ⇒ choose 30.
Answer: (D) 30
4