Question: What is the ternary operator equivalent to this code snippet?

  1. `y=a?b:x;`
  2. `y=if(x?a:b);`
  3. `y=(x&a)?a:(x&b)?b:0;`
  4. `y=x?a:b;`

Answer: The correct answer of the above question is Option D:`y=x?a:b;`