🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Pumping Lemma Proofs: all 10 questions

Quiz: Pumping Lemma Proofs · Question 5 of 10

What does this print? (code)

What does this print?

p = 4
lengths = [p * p + k for k in range(1, p + 1)]
print(lengths, (p + 1) ** 2)
  1. A.[16, 17, 18, 19] 25
  2. B.[17, 18, 19, 20] 25
  3. C.[17, 18, 19, 20] 20
  4. D.[16, 20, 24, 28] 25
Answer & explanation

Correct answer: [17, 18, 19, 20] 25

Pumping adds k = 1 to 4 symbols to length 16, and none of 17–20 is a square.

Can you get the rest right without peeking?

Take the timed Quiz: Pumping Lemma Proofs quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →