Assessment | 40 Actual Questions and Answers |
2025 Update | 100% Correct.
Q1: What is the output of print(type(3.14))?
A) <class 'int'>
B) <class 'float'>
C) float
D) 3.14
Answer: B) <class 'float'>
Rationale: type() returns the data type. 3.14 is a floating-
point number, so its type is <class 'float'>.
Q2: Which operator returns the remainder of division?
A) /
B) //
C) %
D) **
1
,Answer: C) %
Rationale: The modulo operator % returns the remainder
after division. Example: 10 % 3 returns 1.
Q3: Evaluate: 17 // 5
A) 3.4
B) 3
C) 4
D) 2
Answer: B) 3
Rationale: // is floor division (integer division). It returns
the quotient without the remainder: 17 ÷ 5 = 3.4, floored
to 3.
Q4: What is the value of 2 ** 4?
A) 6
B) 8
2
,C) 16
D) 32
Answer: C) 16
Rationale: ** is the exponentiation operator. 2 **
4 means 2 raised to the power of 4 = 2×2×2×2 = 16.
Q5: Which variable name is invalid?
A) _myVar
B) myVar2
C) 2myVar
D) my_var
Answer: C) 2myVar
Rationale: Variable names cannot start with a digit. They
can start with a letter or underscore.
Q6: What does len("Hello World") return?
A) 10
B) 11
3
, C) 12
D) 9
Answer: B) 11
Rationale: len() counts characters including the space.
"Hello World" has 11 characters (H,e,l,l,o, ,W,o,r,l,d).
Q7: Which function converts the string "123" to an integer?
A) str("123")
B) int("123")
C) float("123")
D) chr("123")
Answer: B) int("123")
Rationale: int() converts a string or number to an integer.
The string must represent a valid integer.
Q8: What is the output of print(2 * "Hi" + "Bye")?
A) HiHiBye
B) Hi Bye Hi
4