10 Tricky Python Output Questions for Class 11 & 12 – Can You Score 10/10?

 

10 Tricky Python Output Questions for Class 11 & 12 – Can You Score 10/10?

Python output questions look easy until one small detail changes the answer. They appear in CBSE board papers, school tests, and interviews, and students often lose marks on them even when they know the syntax.

Here are 10 questions to test yourself. Don't scroll to the answers yet. Write your answers on paper first, then check them below.

The rules:

  • Don't run the code. Predict the output first.
  • Give yourself 1 mark for each correct answer.
  • Comment your score at the end, and tell us which question tricked you.

The Questions

Q1.

python
print(2 ** 3 ** 2)

Q2.

python
print(10 // 3, 10 % 3, -10 // 3)

Q3.

python
print("Python"[::-1])

Q4.

python
print(bool("False"))

Q5.

python
a = [1, 2, 3]
b = a
b.append(4)
print(a)

Q6.

python
print(0.1 + 0.2 == 0.3)

Q7.

python
print("A" + "B" * 3)

Q8.

python
t = (1, 2, 3)
t[0] = 10
print(t)

Q9.

python
print(len({1, 2, 2, 3, 3, 3}))

Q10.

python
def change():
    x = 10

x = 5
change()
print(x)

⬇️ Scroll down only after you've written your answers. ⬇️

.
.
.

Answers and Explanations

Q1. Output: 512
The ** operator works from right to left. So 3 ** 2 = 9 is calculated first, then 2 ** 9 = 512. Many students wrongly calculate (2 ** 3) ** 2 = 64.

Q2. Output: 3 1 -4
// is floor division, which rounds down. 10 // 3 = 3 and 10 % 3 = 1. For -10 // 3, the exact value is -3.33, and rounding down gives -4, not -3.

Q3. Output: nohtyP
The slice [::-1] reads the string backwards. It's the quickest way to reverse a string and is very common in practicals.

Q4. Output: True
Any non-empty string is truthy in Python, even the string "False". Only an empty string "" gives False.

Q5. Output: [1, 2, 3, 4]
b = a does not copy the list. It makes both names point to the same list, so changing b also changes a. To make a real copy, use b = a.copy().

Q6. Output: False
Computers store decimals in binary, so 0.1 + 0.2 is actually 0.30000000000000004. This is why we avoid comparing floats with ==.

Q7. Output: ABBB
* has higher precedence than +. So "B" * 3 becomes "BBB" first, then "A" + "BBB" gives "ABBB".

Q8. Output: TypeError: 'tuple' object does not support item assignment
Tuples are immutable, so you cannot change their elements after creation. The code produces an error and prints nothing else.

Q9. Output: 3
A set stores only unique values, so {1, 2, 2, 3, 3, 3} becomes {1, 2, 3}, which has 3 elements.

Q10. Output: 5
The x = 10 inside the function is a local variable. It doesn't change the global x, which stays 5.

Check Your Score

ScoreWhat it means
9–10Excellent! You're board-exam ready.
6–8Good, but revise operators and mutability.
3–5Practice more output questions every day.
0–2Don't worry, start with the basics and try again.

Your Turn 👇

  1. Comment your score (for example, "7/10") below.
  2. Tell us which question tricked you most.
  3. Share this post with a classmate and see who scores higher.

Post a Comment

0 Comments