OA | OBJECTIVE ASSESSMENT: EXAM
(LATEST 2026/2027 UPDATE), |
QUESTIONS & ANSWERS| GRADE A|
100% CORRECT (VERIFIED SOLUTIONS)
WGU D335 INTRO TO PYTHON | OA |
OBJECTIVE ASSESSMENT
WGU D335 – Intro to Python
FULL/MOCK OA – 2026/2027-Aligned
With Deep Rationales (3–5 sentences each)
SECTION 1: Python Basics (Q1–Q10)
1. Which statement correctly prints text in Python?
A. echo "Hello"
B. print["Hello"]
C. print("Hello") ✅
D. console.log("Hello")
Correct Answer: C
Rationale:
Python uses the built-in print() function to display output to the console. Parentheses
are required because print is a function, not a statement. Options A and D come from
other programming languages (shell and JavaScript). Option B incorrectly uses
brackets instead of parentheses.
,2. Which of the following is a valid variable name?
A. total-cost
B. 2total
C. _totalCost ✅
D. total cost
Correct Answer: C
Rationale:
Python variable names may contain letters, numbers, and underscores, but cannot
start with a number or contain spaces or hyphens. _totalCost follows all naming rules
and is commonly used. Hyphens are interpreted as subtraction operators. Variable
names starting with numbers are invalid.
3. What is the data type of the value returned by input()?
A. int
B. float
C. str ✅
D. bool
Correct Answer: C
Rationale:
The input() function always returns user input as a string, regardless of whether the
input looks numeric. This allows flexibility but requires explicit conversion for
calculations. To convert input to numbers, functions like int() or float() must be
used. Assuming numeric input without conversion is a common beginner error.
4. What is the output?
print(type(5))
,A. <class 'float'>
B. <class 'int'> ✅
C. <class 'str'>
D. <class 'number'>
Correct Answer: B
Rationale:
The value 5 is an integer literal in Python. The type() function returns the data type of
the object passed to it. Python does not use a generic number type for integers.
Therefore, the correct output is <class 'int'>.
5. Which operator performs exponentiation?
A. ^
B. *
C. ** ✅
D. //
Correct Answer: C
Rationale:
The ** operator is used for exponentiation in Python. For example, 2 ** 3 evaluates to
8. The caret (^) is a bitwise XOR operator, not exponentiation. The * operator performs
multiplication, while // performs floor division.
6. What is the output?
x = 7 y = 2 print(x % y)
A. 3
B. 2
C. 1 ✅
D. 0
, Correct Answer: C
Rationale:
The modulo operator % returns the remainder after division. When 7 is divided by 2,
the quotient is 3 with a remainder of 1. Therefore, 7 % 2 evaluates to 1. This operator
is often used to check for even or odd numbers.
7. Which keyword converts a value to an integer?
A. int() ✅
B. str()
C. float()
D. bool()
Correct Answer: A
Rationale:
The int() function converts compatible values into integers. It can convert numeric
strings such as "5" into the integer 5. The other functions convert values into different
data types. Attempting conversion on incompatible data will raise a ValueError.
8. What will this code output?
print("5" + "3")
A. 8
B. 53 ✅
C. Error
D. 5 3
Correct Answer: B
Rationale:
Both "5" and "3" are strings, not numbers. The + operator concatenates strings rather