The command line is used to execute Python code ____ .
✅ Answer: b. one line at a time
✔️The Python command line (interactive shell) executes one instruction at a time.
Question 2
If the data type of a value in a variable does not match the format code, then ____
will occur.
✅ Answer: a. an exception
✔️A type mismatch raises an exception (error) in Python.
Question 3
Input:
a = 300
b = 900
thetotal = a // b → 300 // 900 = 0
theremain = a % b → 300 % 900 = 300
Output:
Each learner receives : 0
The remainder is : 300
✅ Answer: a
Question 4
Which print() suppresses the newline?
Correct syntax is:
print("Good luck", end=" ")
✅ Answer: b. print (‘Good luck’, end = ‘ ’ )
,Question 5
myMoney = 1200.50
yourMoney = 23000.78
thetotal = 24201.28
Output:
The value money is : 24201.28
✅ Answer: a
Question 6
thetotal = a // b # integer division (floor division)
theremain = a % b # modulus (remainder)
✅ Answer: c. integer division
Question 7
a=3
b=7
thepower = a ** b = 3**7 = 2187
✅ Answer: b. 2187
Question 8
Input:
a = 400
b = 55
thetotal = 400 // 55 = 7
theremain = 400 % 55 = 15
Output:
The value is: 7
The remainder is: 15
, ✅ Answer: b
Question 9
Code:
number1=345
number2=123
number3=100
total=number1+number2+number3
#print('The numbers that were added ', Number1, Number2, Number3)
print('The total of the addition :', Total)
⚠️Error: Total is undefined (Python is case-sensitive).
✅ Answer: b. NameError: name 'Total' is not defined
Question 10
a = 21.8 → float
b = 'Jack' → str (but commented out)
c = 23456 → int (commented out)
Only type(a) is printed:
<class 'float'>
✅ Answer: a. class 'float'