Multiple choice

What is the value of variable POLYGON? main() {
int POLYGON, L, B; L=B =2; POLYGON = (L==B) ? 1 : 0; }

  1. 0

  2. 1

  3. 2

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The ternary operator (L==B) ? 1 : 0 checks if L equals B. Since both are assigned 2, the condition is true, resulting in the value 1.