← Quiz: Python Interview Programs: all 13 questions
Quiz: Python Interview Programs · Question 5 of 13
In FizzBuzz, what goes wrong if you check i % 3 == 0 before i % 15 == 0?
In FizzBuzz, what goes wrong if you check i % 3 == 0 before i % 15 == 0?
- A.Nothing
- B.15, 30, 45… print "Fizz" instead of "FizzBuzz"
- C.The program crashes
- D.Multiples of 5 are skipped
Answer & explanation
Correct answer: 15, 30, 45… print "Fizz" instead of "FizzBuzz"
The first true branch runs, so multiples of 15 would stop at the "Fizz" check.
Can you get the rest right without peeking?
Take the timed Quiz: Python Interview Programs quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →