Multiple choice technology programming languages

You are writing an assertion expression in your code. Which code is legal?

  1. 1 int z = 0;

  2. 2 assert (z = 9);

  3. 3 assert (x ==5);

  4. 4 int z = 0;

  5. 5 boolean x = true;

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

An assertion statement in Java requires a boolean expression. assert (x == 5); is syntactically legal assuming x is a defined variable. assert (z = 9) is illegal because it performs an assignment resulting in an integer, not a boolean.