Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


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

  1. 5

  2. 6

  3. 7

  4. 8

The correct answer is: 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.