Mastering Java 2026 – 400 Free Practice Questions to Pass the 'Thinking in Java' Exam

Session length

1 / 20

How many times does the traffic light change colors in the loop?

5

6

7

The traffic light in the loop actually changes colors 8 times, not just 7. The reason for this is because there are four major colors that the light cycles through (red, yellow, green, and off), and there are two instances in which the light flashes red and off, making a total of eight color changes. It is important to carefully consider all factors and details given in the question when selecting your answer. A and B may seem like they could potentially be correct answers, but they do not account for the two instances of flashing red and off. D is too high of a number as it does not account for the off color.

Get further explanation with Examzify DeepDiveBeta

8

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy