Multiple choice technology programming languages

main(){ int a,b; a=0; b=(a=1)?2:3; printf("%d %d",a,b); }

  1. 1 3

  2. 1 2

  3. 0 3

  4. Compile Error

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

The assignment a=1 sets a to 1 and returns 1, which is truthy. The ternary operator ? therefore evaluates to 2, assigned to b. printf outputs '1 2'. Option A (1 3) would be the result if the assignment returned 0 (falsey).