2027 UPDATED OA
QUESTION 1
What is the output of print(type(10))?
A. <class 'int'>
B. <class 'float'>
C. <class 'str'>
D. <class 'bool'>
*Correct Answer: A. <class 'int'>
*Rationale: * The type() function returns the data type of the argument. 10 is an
integer, so it returns <class 'int'>.
QUESTION 2
What is the output of print(4 + 2 * 3 ** 2)?
A. 22
B. 36
C. 60
D. 24
*Correct Answer: A. 22
*Rationale: * Python follows operator precedence: exponentiation (**) first, then
multiplication (*), then addition (+). 3 ** 2 = 9; 2 * 9 = 18; 4 + 18 = 22.
,QUESTION 3
What is the output of print(10 - 3 * 2)?
A. 4
B. 14
C. 7
D. 1
*Correct Answer: A. 4
*Rationale: * Multiplication is performed before subtraction. 3 * 2 = 6; 10 - 6 = 4.
QUESTION 4
What is the output of print("Hello" + " " + "World")?
A. HelloWorld
B. Hello World
C. Hello + World
D. Error
*Correct Answer: B. Hello World
*Rationale: * String concatenation with + joins strings together. "Hello" + " " +
"World" results in "Hello World".
,QUESTION 5
What is the output of print("Python"[::2])?
A. Pto
B. yhn
C. Ptoh
D. yhon
*Correct Answer: A. Pto
*Rationale: * String slicing with a step of 2 selects every second
character. "Python"[::2] selects characters at indices 0, 2, 4: P, t, o = "Pto".
QUESTION 6
What is the output of print("Python"[1::2])?
A. yhn
B. Pto
C. yho
D. Ptn
*Correct Answer: A. yhn
*Rationale: * Slicing [1::2] starts at index 1 and selects every second character.
Characters at indices 1, 3, 5: y, h, n = "yhn".
QUESTION 7
, What is the output of print("Python"[::-1])?
A. nohtyP
B. Python
C. nohtyp
D. ythoN
*Correct Answer: A. nohtyP
*Rationale: * A step of -1 reverses the string. "Python"[::-1] returns "nohtyP".
QUESTION 8
What is the output of print("abc".upper().isupper())?
A. True
B. False
C. Error
D. None
*Correct Answer: A. True
*Rationale: * .upper() converts "abc" to "ABC". .isupper() checks if all characters are
uppercase, which returns True.
QUESTION 9
What is the output of print("HELLO".lower().islower())?