SolveItNCERT · CBSE Boards

CBSE 2026 · Central · Set 4 · Q25 · 2 marks

What possible output(s) from the given options will NOT be displayed when the following code is executed ? Also, mention, for how many iterations the for loop in the given code will run?
import random
a = [1,2,3,4,5,6]
for i in range(4):
    j = random.randrange(i,5)
    print(a[j],end='-')
print()
Options :
(A)
$\displaystyle 3$-$\displaystyle 4$-$\displaystyle 5$-$\displaystyle 4$-
(B)
$\displaystyle 2$-$\displaystyle 2$-$\displaystyle 4$-$\displaystyle 5$-
(C)
$\displaystyle 4$-$\displaystyle 3$-$\displaystyle 3$-$\displaystyle 5$-
(D)
$\displaystyle 5$-$\displaystyle 1$-$\displaystyle 2$-$\displaystyle 4$-

Revision of PythonOperators and ExpressionsAnalysevery_short_answer

More from Revision of Python

CBSE Class 12 Computer Science past-paper question from the 2026board exam, with the answer as CBSE’s own marking scheme gives it. Where our answers come from.