Programming in Python Objective
Assessment Actual Exam 2026/2027 |
Verified Questions
Western Governors University (WGU) | Verified Q&A |
Professional Computer Science and IT Students
15 Official Examination Questions | 12 Correct Selections Required (80% Passing Score)
This comprehensive examination set comprises exactly 15 original questions designed to
reinforce official Western Governors University (WGU) course objectives for actual exam
readiness and professional competency, adhering strictly to the standard WGU D335
Introduction to Programming in Python Objective Assessment blueprint. The examination
covers four primary domains: Python Basics and Syntax; Control Flow and Functions; Data
Structures (Lists, Dictionaries, Tuples); and Object-Oriented Programming and File I/O. In
accordance with official WGU D335 curriculum benchmarks, candidates must execute 15
questions and achieve a minimum of 12 correct selections to attain the required 80% passing
score. Each item in this verified collection addresses distinct Python operators, branching
constructs, data collection methods, and object-oriented principles to ensure thorough mastery
of professional software engineering competencies in 2026/2027.
Domain: Python Basics and Syntax
1. What is the output of the Python expression 2 ** 3 * 4 // 3?
A. 8
B. 10
C. 10.6667
D. 12
Correct Answer: B
Rationale: According to Python operator precedence rules, exponentiation (**) has the
highest precedence, followed by multiplication (*) and floor division (//), which are
processed from left to right. First, 2 ** 3 resolves to 8. Next, 8 * 4 resolves to 32. Finally,
floor division 32 // 3 resolves to the integer 10 without fractional remainder.
2. Given the variables item = "Monitor" and price = 249.5, which f-string syntax
correctly formats the price to display with exactly two decimal places as "The
Monitor costs $249.50"?
WGU D335 Introduction to Programming in Python Objective Assessment Actual Exam 2026/2027 |
Verified Questions
, A. f"The {item} costs ${price:.2f}"
B. f"The {item} costs ${price:2d}"
C. f"The {item} costs ${round(price, 2)}"
D. f"The {item} costs ${price:%2f}"
Correct Answer: A
Rationale: In Python f-strings, format specifiers are introduced after a colon (:) within
braces. The specifier .2f formats a floating-point number as a fixed-point decimal string
with exactly two digits after the decimal point, appending trailing zeros if necessary to
yield "$249.50".
3. What occurs when executing val = int(input("Enter value: ")) if the user types
45.8 at the console prompt?
A. val is assigned the integer 45 by truncating the decimal portion
B. val is assigned the integer 46 by rounding to the nearest whole number
C. Python raises a ValueError because int() cannot directly convert a string containing a
decimal point into an integer
D. Python converts the string to a floating-point number automatically
Correct Answer: C
Rationale: The built-in function input() returns string data. Calling int("45.8") raises a
ValueError because the string literal contains a decimal point, which is not a valid base-10
integer representation. Converting a decimal string to an integer requires calling float()
first, such as int(float("45.8")).
4. What value is assigned to result after executing result = (5 > 10) and ( ==
0)?
A. True
B. False
C. ZeroDivisionError is raised immediately
D. None
Correct Answer: B
Rationale: Python's logical and operator utilizes short-circuit processing. When executing
(5 > 10) and ( == 0), the left operand (5 > 10) resolves to False. Because False and
<expression> is certain to be False, Python skips processing of the right operand ( ==
0), preventing a ZeroDivisionError and assigning False to result.
Domain: Control Flow and Functions
5. What is printed to the console when the following code block executes with
score = 85?
score = 85
if score >= 90:
print("A")
elif score >= 80:
print("B")
elif score >= 85:
WGU D335 Introduction to Programming in Python Objective Assessment Actual Exam 2026/2027 |
Verified Questions