Completed

Mixed: conditionals + loops

Class 11 · Informatics Practices Sat, 10 Oct 2026 8:00 PM 60s / question 15 questions · 15 marks

Questions From This Challenge

Q1mcq1 mark
When combining a for loop with an if statement inside it, what determines whether the if block's body executes on a given iteration?
Whether the condition evaluates to True for that particular iteration's value ✓
Whether the loop is a for loop or a while loop
The number of times the loop has already run, regardless of the condition
Only the last iteration's condition matters
Q2mcq1 mark
A student wants to print only the even numbers between 1 and 10 using a loop. Which combination of constructs should be used?
A for loop with range(), combined with an if statement checking number % 2 == 0 ✓
Only an if-elif-else chain, without any loop
A while loop with no condition
A for loop without range()
Q3mcq1 mark
In a loop that uses if-else to classify each number as "Positive" or "Non-positive", how many times does the if-else block execute if the loop runs 5 times?
5 times, once per iteration ✓
Once, before the loop starts
Only when a number is positive
It executes 10 times, twice per iteration
Q4mcq1 mark
What is a correct way to count how many numbers in a loop satisfy a condition (e.g., counting even numbers from 1 to 10)?
Initialize a counter to 0 before the loop, then increment it inside the if block when the condition is true ✓
Just use the loop variable itself as the count, without any extra variable
Counting is not possible using loops and conditionals together
Use a while loop only, since for loops cannot count
Q5mcq1 mark
Why must a counter/accumulator variable used inside a loop with a condition be initialized before the loop begins?
So it has a defined starting value the first time it is read or updated inside the loop ✓
Because Python requires all variables to be declared with a type first
Because loops cannot create new variables internally
Because the if statement resets variables automatically each iteration
Q6output1 mark
What is the output of the following code?
for i in range(1, 11):
    if i % 2 == 0:
        print(i)
Correct output: 2 4 6 8 10
Q7output1 mark
What is the output of the following code?
for i in range(1, 6):
    if i % 2 == 0:
        print(i, "Even")
    else:
        print(i, "Odd")
Correct output: 1 Odd 2 Even 3 Odd 4 Even 5 Odd
Q8output1 mark
What is the output of the following code?
n = -2
while n <= 2:
    if n > 0:
        print(n, "Positive")
    elif n < 0:
        print(n, "Negative")
    else:
        print(n, "Zero")
    n = n + 1
Correct output: -2 Negative -1 Negative 0 Zero 1 Positive 2 Positive
Q9output1 mark
What is the output of the following code?
total = 0
for i in range(1, 11):
    if i % 2 == 0:
        total = total + i
print(total)
Correct output: 30
Q10output1 mark
What is the output of the following code?
i = 1
total = 0
while i <= 15:
    if i % 3 == 0:
        total = total + i
    i = i + 1
print(total)
Correct output: 45
Q11output1 mark
What is the output of the following code?
count = 0
for i in range(1, 11):
    if i % 2 == 0:
        count = count + 1
print(count)
Correct output: 5
Q12output1 mark
What is the output of the following code?
for i in range(1, 4):
    for j in range(1, 4):
        if i == j:
            print(i, j)
Correct output: 1 1 2 2 3 3
Q13output1 mark
What is the output of the following code?
marks = 50
while marks <= 90:
    if marks >= 90:
        print(marks, "A")
    elif marks >= 70:
        print(marks, "B")
    else:
        print(marks, "C")
    marks = marks + 20
Correct output: 50 C 70 B 90 A
Q14output1 mark
What is the output of the following code?
word = "hello"
vowels = "aeiou"
for ch in word:
    if ch in vowels:
        print(ch)
Correct output: e o
Q15output1 mark
What is the output of the following code?
pos_count = 0
neg_count = 0
for i in range(-3, 4):
    if i > 0:
        pos_count = pos_count + 1
    elif i < 0:
        neg_count = neg_count + 1
print(pos_count, neg_count)
Correct output: 3 3
Next Live Challenge
DQL — BETWEEN + Logical Operators
Class 11 · Informatics Practices 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...