🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Nothing
  2. B.15, 30, 45… print "Fizz" instead of "FizzBuzz"
  3. C.The program crashes
  4. 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 →