Multiple choice technology programming languages

Consider the following program code: \$y = 1; \$x = 2; \$z = 3; do { print (\$y ); } while (\$y eq 2); do { print (\$x ); } until (\$x eq 2); print (\$z ); What is the result of executing this program code?

  1. The code will output the following:123

  2. The code will output the following: 3

  3. The code will output the following:23

  4. The code will output the following: 321

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

The first do-while loop prints y=1 once because $y eq 2 is false (1 != 2), so it exits after one iteration. The second do-until loop prints x=2 once because the condition $x eq 2 is immediately true, so it exits after one iteration. Finally, z=3 is printed. The output is: 1, 2, 3 (in that order).