Objective Assessment 15 Actual Questions | Western
Governors University | Pass Guaranteed - A+ Graded
Section 1: Core Syntax, Variables, Data Types & Operators
(Q1-4)
Q1. What is the output of the following Python code?
PythonCopy
x = 7
y = 2
result = x // y + x % y
print(result)
A. 3
B. 3.5
C. 4
D. 5
Correct Answer: C
C. 4 [CORRECT]
, Rationale: x // y performs floor division (7 // 2 = 3). x % y performs modulo (7 % 2 =
1). 3 + 1 = 4. Option A misses the modulo addition. Option B confuses floor division
with true division. Option D incorrectly adds 7 + 2 instead of using the operators.
Q2. A student writes the following code to convert user input to an integer and calculate
a 15% tip. Which line contains a logic error that will cause the program to fail at
runtime?
PythonCopy
bill = input("Enter bill amount: ")
tip = bill * 0.15
total = bill + tip
print(f"Total: {total}")
A. Line 1: bill = input("Enter bill amount: ")
B. Line 2: tip = bill * 0.15
C. Line 3: total = bill + tip
D. Line 4: print(f"Total: {total}")
Correct Answer: A
A. Line 1: bill = input("Enter bill amount: ") [CORRECT]
Rationale: input() returns a string; arithmetic operations on strings cause TypeError.
The fix requires bill = float(input("Enter bill amount: ")). While lines
2-3 would also fail, line 1 is the root cause—without type conversion, all subsequent
arithmetic fails. This is the most common OA error pattern: forgetting that input()
always returns a string.