Completed

Class 11 Python Revision Test

Class 12 · Computer Science Sun, 30 Aug 2026 7:00 PM 60s / question 15 questions · 15 marks

Questions From This Challenge

Q1output1 mark
What will be the output of the following Python code?
x = 7

for i in range(1, 5):
    if x % i == 0:
        x = x + i
    else:
        x = x - 1

print(x)
Correct output: 8
Q2output1 mark
What will be the output of the following Python code?
total = 0

for i in range(1, 5):
    for j in range(i, 5):
        if (i + j) % 2 == 0:
            total = total + j
        else:
            total = total - i

print(total)
Correct output: 10
Q3output1 mark
What will be the output of the following Python code?
L = [2, 5, 2, 7, 5]

for i in range(3):
    x = L.pop(0)

    if x % 2:
        L.append(x + 1)
    else:
        L.insert(1, x + 2)

print(sum(L) - L.count(5))
Correct output: 25
Q4output1 mark
What will be the output of the following Python code?
s = "mississippi"
total = 0

for i in range(len(s)):
    if s[i] == "s":
        total = total + i
    elif s[i] == "i":
        total = total - 1

print(total)
Correct output: 12
Q5output1 mark
What will be the output of the following Python code?
T = (4, 7, 4, 9, 7, 2)

x = T[:3] + T[2:5]

print(x.count(7) + max(x) - min(x))
Correct output: 7
Q6output1 mark
What will be the output of the following Python code?
d = {"a": 2, "b": 1}

for k in ["a", "b", "c", "a"]:
    d[k] = d.get(k, 0) + 1

    if d[k] % 2 == 0:
        d.setdefault("x", 0)
        d["x"] = d["x"] + d[k]

print(sum(d.values()))
Correct output: 13
Q7output1 mark
What will be the output of the following Python code?
n = 29
total = 0

while n > 10:
    if n % 4 == 0:
        n = n // 2
        continue

    n = n - 3
    total = total + n

print(n + total)
Correct output: 79
Q8output1 mark
What will be the output of the following Python code?
L = [1, 2, 3, 4]

for i in range(len(L) - 1):
    if L[i] % 2 == 0:
        L[i + 1] = L[i + 1] + L[i]
    else:
        L[i] = L[i] + L[i + 1]

print(sum(L))
Correct output: 18
Q9output1 mark
What will be the output of the following Python code?
L = [3, 1, 4, 1, 5]
total = 0

for i in range(len(L)):
    for j in range(i, -1, -1):
        if L[j] < L[i]:
            total = total + L[j]
        else:
            total = total - 1

print(total)
Correct output: 4
Q10mcq1 mark
Which of the following code segments correctly finds whether a number n is divisible by both 3 and 5, without using nested if statements?
if n % 3 == 0 or n % 5 == 0:
if n % 3 == 0 and n % 5 == 0: ✓
if n % 15 == 1:
if n / 3 == 0 and n / 5 == 0:
Q11output1 mark
What will be the output of the following Python code?
import math

a = math.ceil(4.1)
b = math.floor(7.9)
c = math.pow(a, 2) - math.fabs(b - 10)

print(int(c))
Correct output: 22
Q12output1 mark
What will be the output of the following Python code?
import statistics

L = [2, 4, 4, 6, 9, 9, 9]

print(int(statistics.mean(L)) + statistics.median(L) + statistics.mode(L))
Correct output: 21
Q13output1 mark
What will be the output of the following Python code?
d = {"A": 10, "B": 20, "C": 30}

for k in list(d):
    if d[k] >= 20:
        d[k] = d[k] // 10
    else:
        d[k] = d[k] + 5

d.update({"D": max(d.values())})
d.pop("B")

print(sum(d.values()))
Correct output: 33
Q14output1 mark
What will be the output of the following Python code?
L = [4, 2, 4, 3]

for i in range(len(L)):
    if L[i] in L[:i]:
        L[i] = L[i] + i
    else:
        L[i] = L[i] - 1

print(sum(L))
Correct output: 13
Q15output1 mark
What will be the output of the following Python code?
x = 0

for i in range(1, 5):
    for j in range(1, i + 1):
        if (i + j) % 3 == 0:
            x = x + i * j
        elif j == i - 1:
            continue
        else:
            x = x - j

print(x)
Correct output: 10
Next Live Challenge
Mixed: DML + Retrieval - Combined Application
Class 12 · Computer Science Fri, 23 Oct 2026, 9: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...