Completed

Loop Control + Nesting

Class 11 · Computer Science Mon, 12 Oct 2026 8:00 PM 60s / question 15 questions · 15 marks

Questions From This Challenge

Q1mcq1 mark
What is the output of the following code (values printed, in order)? for i in range(1, 10): if i == 5: break print(i)
1,2,3,4 ✓
1,2,3,4,5
1,2,3
1,2,3,4,5,6,7,8,9
Q2mcq1 mark
What is the output of the following code (values printed, in order)? for i in range(1, 6): if i == 3: continue print(i)
1,2,4,5 ✓
1,2,3,4,5
1,2,4
1,2,3,5
Q3mcq1 mark
What is the output of the following code? count = 0 for i in range(1, 4): for j in range(1, 3): count += 1 print(count)
6 ✓
3
2
9
Q4mcq1 mark
In a nested loop, when a break statement executes inside the inner loop, what happens?
Only the inner loop terminates; the outer loop continues to its next iteration ✓
Both the inner and outer loops terminate immediately
The outer loop terminates but the inner loop restarts
break has no effect inside a nested loop
Q5mcq1 mark
What is the output of the following code? total = 0 for i in range(1, 4): for j in range(1, 4): if j <= i: continue total += 1 print(total)
3 ✓
6
9
4
Q6output1 mark
What is the output?
i = 1
while i <= 10:
    if i == 6:
        break
    print(i)
    i += 1
Correct output: 1 2 3 4 5
Q7output1 mark
What is the output?
i = 0
while i < 10:
    i += 1
    if i % 2 == 0:
        continue
    print(i)
Correct output: 1 3 5 7 9
Q8output1 mark
What is the output?
for i in range(1, 3):
    for j in range(1, 3):
        print(i * j)
Correct output: 1 2 2 4
Q9output1 mark
What is the output?
for i in range(1, 4):
    for j in range(1, 4):
        if j == 2:
            break
        print(i, j)
Correct output: 1 1 2 1 3 1
Q10output1 mark
What is the output?
for i in range(1, 4):
    for j in range(1, 4):
        if i == j:
            continue
        print(i, j)
Correct output: 1 2 1 3 2 1 2 3 3 1 3 2
Q11output1 mark
What is the output?
count = 0
while True:
    count += 1
    if count == 4:
        break
print(count)
Correct output: 4
Q12output1 mark
What is the output?
i = 1
total = 0
while i <= 3:
    for j in range(1, 4):
        if j == 3:
            continue
        total += j
    i += 1
print(total)
Correct output: 9
Q13output1 mark
What is the output?
result = 0
for i in range(1, 4):
    for j in range(1, 5):
        if j == i:
            break
        result += 1
print(result)
Correct output: 3
Q14output1 mark
What is the output?
n = 0
total = 0
while n < 20:
    n += 1
    if n % 5 == 0:
        continue
    if n > 12:
        break
    total += n
print(total)
Correct output: 63
Q15output1 mark
What is the output?
total = 0
for i in range(1, 5):
    if i == 3:
        continue
    for j in range(1, 4):
        if j == 2:
            break
        total += (i * j)
print(total)
Correct output: 7
Next Live Challenge
Mixed: Tuples + Dictionary + Modules
Class 11 · Computer Science Fri, 23 Oct 2026, 8:00 PM
View Live Challenges →

← Back to Live Challenge History · Practice MCQs

CodeBuddy
Hi there! 👋 I'm CodeBuddy, your KV Coders assistant.

To help me give you the most accurate answers, please select your class and subject below, or just type your question!
Buddy is typing...