Python Actual Exam 2026/2027 – Objective
Assessment – Actual Q&A – New Update – 100%
Correct – Pass Guaranteed – A+ Graded
Python Fundamentals & Data Types
Q1: Consider the following code snippet. What will be the final output when this code
runs?
PythonCopy
x =
y = 15 // 4
z = 15 % 4
print(x, y, z)
A. 3 3 3
B. 3.75 3.75 3
C. 3.75 3 3 [CORRECT]
D. 3 3.75 3
Correct Answer: C
Rationale: The / operator performs true division (15/4 = 3.75), // performs floor
division (15//4 = 3), and % returns the remainder (15%4 = 3). Option A confuses all three
as integers, B confuses floor and true division, and D reverses the first two values.
Q2: A student is trying to convert user input to an integer and perform arithmetic. Which
code correctly converts the input and calculates the square?
,PythonCopy
# User enters: 5
A. num = input("Enter: "); result = num ** 2 (Output: TypeError)
B. num = int(input("Enter: ")); result = num * 2 (Output: 10)
C. num = int(input("Enter: ")); result = num ** 2 [CORRECT]
D. num = str(input("Enter: ")); result = num ** 2 (Output: TypeError)
Correct Answer: C
Rationale: input() returns a string that must be converted to int using int() before
mathematical operations. The ** operator raises to a power (square), while * (option B)
merely doubles. Option A tries to exponentiate a string, and D unnecessarily converts to
string.
Q3: What is the output of the following string operation?
PythonCopy
text = " Hello, Python! "
print(text.strip().lower().replace("python", "world"))
A. Hello, World!
B. hello, world! [CORRECT]
C. Hello, World!
D. hello, world!
Correct Answer: B
Rationale: strip() removes leading/trailing whitespace, lower() converts to
lowercase, and replace() substitutes "python" with "world". Option A misses the strip
and lower operations, C misses lower, and D misses strip.
Q4: Which expression correctly evaluates whether a variable age is between 13 and 19
inclusive in Python?
A. 13 <= age <= 19 [CORRECT]
B. age >= 13 and <= 19 (SyntaxError)
, C. 13 <= age && age <= 19 (Invalid operator)
D. age in range(13, 19) (Excludes 19)
Correct Answer: A
Rationale: Python supports chained comparisons (13 <= age <= 19). Option B is
missing the second operand after and. Option C uses C-style && instead of Python's
and. Option D excludes 19 because range() stops before the stop value.
Q5: Given the code below, what data type will result hold?
PythonCopy
value = "42"
result = float(value) + 8
A. int
B. str
C. float [CORRECT]
D. bool
Correct Answer: C
Rationale: float() converts the string to 42.0, and adding 8 (int) results in 50.0, which
is a float. Python promotes integers to floats in mixed arithmetic. Option A ignores the
float conversion, B confuses source type with result, and D is unrelated.
Q6: What will be printed when this code executes?
PythonCopy
a = 5
b = 2
print(f"The sum is {a + b} and the product is {a * b}")
A. The sum is 7 and the product is 10 [CORRECT]
B. The sum is {a + b} and the product is {a * b}
C. The sum is 52 and the product is 52
D. The sum is 7 and the product is 7
Correct Answer: A