Actual Exam 2026/2027 | 100 Questions & Answers with
Detailed Rationales | Pass Guaranteed – A+ Graded
Section 1: Python Basics – Variables, Data Types & Operators
Q1: A student writes the following assignment: x = 42. What is the data type of x in
Python?
A. float
B. str
C. int [CORRECT]
D. bool
Correct Answer: C
Rationale: The best answer is C. When you assign a whole number without quotes or a
decimal point, Python treats it as an integer type. What you'll want to remember for the
OA is that Python automatically infers the data type based on how the value is written,
so 42 is always an int.
Q2: Which of the following expressions correctly converts the string "3.14" to a
floating-point number?
A. str("3.14")
B. float("3.14") [CORRECT]
C. int("3.14")
D. bool("3.14")
Correct Answer: B
Rationale: The best answer is B. The float() function is the standard way to convert a
string representation of a decimal number into a floating-point value. This aligns with
Python's standard library documentation which states that float() accepts string
input and returns the corresponding float.
,Q3: What is the output of print(10 // 3)?
A. 3.33
B. 3 [CORRECT]
C. 1
D. 3.0
Correct Answer: B
Rationale: The best answer is B. The floor division operator // returns the largest whole
number less than or equal to the division result, so 10 // 3 gives 3 without any
remainder. This is different from regular division / which would give you 3.333....
Q4: A developer needs to check if two variables, a and b, are not equal. Which operator
should they use?
A. =
B. ==
C. != [CORRECT]
D. <>
Correct Answer: C
Rationale: The best answer is C. In Python, the != operator is the standard "not equal"
comparison operator. What you'll want to remember for the OA is that Python does not
use <> like some other languages; stick with != for inequality checks.
Q5: What is the result of 5 + 3 * 2 in Python?
A. 16
B. 11 [CORRECT]
C. 13
D. 10
Correct Answer: B
Rationale: The best answer is B. Python follows standard operator precedence, so
multiplication happens before addition: 3 * 2 is 6, then 5 + 6 equals 11. If you
wanted 16, you'd need parentheses around 5 + 3.
Q6: Which of the following is a valid variable name in Python?
A. 2nd_value
,B. second value
C. _second_value [CORRECT]
D. second-value
Correct Answer: C
Rationale: The best answer is C. Variable names in Python can start with an underscore
or a letter, but never with a number, and they cannot contain spaces or hyphens. The
underscore is perfectly valid and is actually commonly used for internal or private
variables.
Q7: What is the output of print(3 ** 2)?
A. 6
B. 9 [CORRECT]
C. 5
D. 32
Correct Answer: B
Rationale: The best answer is B. The ** operator is Python's exponentiation operator, so
3 ** 2 means three squared, which equals nine. Don't confuse this with ^, which is the
bitwise XOR operator in Python, not exponentiation.
Q8: A programmer writes name = "Alice". What built-in function returns the data
type of name?
A. type(name) [CORRECT]
B. str(name)
C. dtype(name)
D. typeof(name)
Correct Answer: A
Rationale: The best answer is A. The type() function is the built-in way to determine
the data type of any object in Python. This aligns with Python's standard library
documentation which states that type() returns the object's type.
Q9: What is the result of bool("") in Python?
A. True
B. False [CORRECT]
, C. None
D. Error
Correct Answer: B
Rationale: The best answer is B. An empty string evaluates to False in a boolean
context because Python considers empty sequences as falsy values. What you'll want
to remember for the OA is that empty strings, empty lists, 0, and None all evaluate to
False.
Q10: Which expression correctly evaluates to True?
A. 5 > 10
B. 5 == 5 [CORRECT]
C. 5 != 5
D. 5 < 5
Correct Answer: B
Rationale: The best answer is B. The equality operator == checks if two values are
equal, so 5 == 5 is naturally True. The other options all describe inequalities or
incorrect comparisons that would evaluate to False.
Q11: What is the output of print("10" + "20")?
A. 30
B. "1020" [CORRECT]
C. Error
D. "30"
Correct Answer: B
Rationale: The best answer is B. When you use the + operator with strings, Python
performs concatenation rather than mathematical addition, so "10" and "20" are
joined together to make "1020". If you wanted 30, you'd need to convert them to
integers first.
Q12: A student needs to find the remainder when 17 is divided by 5. Which operator
should they use?
A. /