Skip to content
Exercises · Q4

Q.Give the output of the following when num1 = 4, num2 = 3, num3 = 2

a) num1 += num2 + num3
b) print (num1)
c) num1 = num1 ** (num2 + num3)
d) print (num1)
e) num1 **= num2 + c
f) num1 = '5' + '5'
g) print(num1)
h) print(4.00/(2.0+2.0))
i) num1 = 2+9*((3*12)-8)/10
j) print(num1)
k) num1 = float(10)
l) print (num1)
m) num1 = int('3.14')
n) print (num1)
o) print(10 != 9 and 20 >= 20)
p) print(5 % 10 + 10 < 50 and 29 <= 29)
Mizoram MbseTextbookSubjective· 5mImportance★★★★★est
68% · 17/25 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

This is a code trace / dry-run question. You must execute each statement in order, updating the variable num1 as you go, and print the output at each print() call. The initial values are num1 = 4, num2 = 3, num3 = 2.

The core idea here is sequential state mutation — each line changes the value of num1 (or prints something), and the next line uses the updated value. You cannot jump ahead or reset. This is exactly how Python executes: line by line, left to right, top to bottom.

Let's walk through each step carefully.

Initial state: num1 = 4, num2 = 3, num3 = 2

(a) num1 += num2 + num3

This is num1 = num1 + (num2 + num3). Compute the right side first: num2 + num3 = 3 + 2 = 5. Then num1 = 4 + 5 = 9. So num1 is now 9.

(b) print(num1) → prints 9.

(c) num1 = num1 ** (num2 + num3)

First compute the exponent: num2 + num3 = 3 + 2 = 5. Then num1 = 9 ** 5. That is 9 * 9 * 9 * 9 * 9 = 59049. So num1 is now 59049.

(d) print(num1) → prints 59049.

(e) num1 **= num2 + c

Here's a trap. The variable c has never been defined. Python will raise a NameError at this point and the program crashes. Execution stops. Nothing after this line runs. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.