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

Quiz: Test Case Design · Question 6 of 10

What does this print? (code)

What does this print?

from itertools import product
rules = list(product('YN', repeat=4))
print(len(rules), rules[5])
  1. A.16 ('Y', 'N', 'Y', 'N')
  2. B.8 ('Y', 'N', 'Y', 'N')
  3. C.16 ('N', 'Y', 'N', 'Y')
  4. D.4 ('Y', 'Y', 'N', 'N')
Answer & explanation

Correct answer: 16 ('Y', 'N', 'Y', 'N')

4 yes/no conditions give 2⁴ = 16 rules; index 5 is binary 0101 with Y as 0.

Can you get the rest right without peeking?

Take the timed Quiz: Test Case Design quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →