assessment actUal exam – Western Governors UnIversIty
(WGU) – 2026/2027 acaDemIc year – verIfIeD QUestIons anD
ansWers for comPUter scIence anD It stUDents || verIfIeD by
exPerts.
EXAM OVERVIEW
Category Details
Course D335 – Introduction to Programming in Python
Institution Western Governors University (WGU)
Assessment Objective Assessment (OA) – NKO2
Format Performance-based, code-writing exam (approximately 15 coding questions)
Passing
80% (12 correct selections out of 15)
Score
Python Fundamentals & Syntax (25%), Data Types & Structures (25%), Control Flow & Loop
Key
(20%), Functions & Modules (15%), File I/O & Exception Handling (10%), Problem Solving &
Domains
Algorithms (5%)
DOMAIN 1: PYTHON FUNDAMENTALS & SYNTAX
Question 1
A program consists of which three basic instruction types?
A) Read, Write, Execute
B) Input, Process, Output
C) Compile, Link, Run
D) Define, Call, Return
correct ansWer: B) Input, Process, Output
,<span style="color:red">Rationale: Every program follows the IPO model: it takes input (from
keyboard, file, etc.), processes that data (computations, logic), and produces output (to screen,
file, etc.).</span>
Question 2
What is a variable in Python?
A) A fixed value that cannot change
B) A named reference to a value stored in memory
C) A type of loop structure
D) A function that prints output
correct ansWer: B) A named reference to a value stored in memory
<span style="color:red">Rationale: A variable is a named item used to hold a value. It acts as a
reference or label that points to an object in memory. Variables can be reassigned to different
values.</span>
Question 3
What is an algorithm?
A) A type of Python data structure
B) A sequence of instructions that solves a problem
C) A built-in Python function
D) An error in program execution
correct ansWer: B) A sequence of instructions that solves a problem
<span style="color:red">Rationale: An algorithm is a step-by-step sequence of instructions
designed to solve a specific problem or accomplish a task.</span>
Question 4
What does the assignment operator = do in Python?
A) Compares two values for equality
B) Assigns a value to a variable
C) Adds two numbers together
D) Creates a new variable type
correct ansWer: B) Assigns a value to a variable
<span style="color:red">Rationale: The = operator is the assignment operator. It assigns the
value on the right side to the variable on the left side. It does NOT compare values (that is
the == operator).</span>
, Question 5
What is the output of the following Python code?
python
name = "Alice"
age = 30
print(f"{name} is {age} years old.")
A) Alice is 30 years old.
B) {name} is {age} years old.
C) Alice is 30 years old
D) Error
correct ansWer: A) Alice is 30 years old.
<span style="color:red">Rationale: f-strings (formatted string literals) allow expressions to be
evaluated inside curly braces {}. The variables name and age are interpolated into the
string.</span>
Question 6
Which of the following is NOT a valid Python variable name?
A) _myVar
B) my_var_2
C) 2myVar
D) myVar2
correct ansWer: C) 2myVar
<span style="color:red">Rationale: Python variable names must start with a letter (a-z, A-Z) or
an underscore (_). They cannot start with a digit. 2myVar is invalid because it begins with a
number.</span>
Question 7
What is the data type of the expression 3.0 + 2 in Python?
A) int
B) float
C) str
D) bool
correct ansWer: B) float