Page 1 of 75
WGU D335 OA: INTRODUCTION TO PROGRAMMING IN PYTHON PREP
2026 QUESTIONS WITH VERIFIED ANSWERS DETAILED RATIONALES
GRADED A+
Part I: IPO Model, Algorithms, and Program Structure (Questions 1–25)
1. Every Python program can be understood as following which three basic
instruction types in sequence?
A. Compile, link, and run
B. Input, process, and output
C. Define, call, and return
D. Read, write, and execute
Rationale: The IPO model describes a program as taking input, processing that
data through computations and logic, and producing output.
2. A step-by-step sequence of unambiguous instructions designed to solve a
specific problem is best described as which of the following?
A. A syntax error
B. An algorithm
C. A data type
D. A module
Rationale: An algorithm is a finite, ordered set of instructions that solves a
problem or accomplishes a task.
1|Page
,Page 2 of 75
3. Which symbol begins a single-line comment in a Python program?
A. //
B. #
C. --
D. /*
Rationale: Single-line comments in Python begin with the # symbol, and the
interpreter ignores everything after it on that line.
4. Multi-line comments in Python are commonly created using which syntax?
A. /* and */
B. <!-- and -->
C. Triple quotation marks (" " " or ' ' ')
D. Three forward slashes
Rationale: Triple-quoted strings are often used as multi-line comments because
they are ignored when not assigned or used as documentation.
5. Which of the following best describes the purpose of pseudocode?
A. To execute directly on the Python interpreter
B. To plan an algorithm in human-readable form before coding
C. To replace all Python syntax permanently
D. To measure program execution speed
Rationale: Pseudocode expresses algorithmic logic in plain language, helping
programmers design solutions before writing executable code.
6. Which of the following is a syntax error in Python?
A. print("Hello")
B. print("Hello"
C. x = 5
D. if x > 0: print(x)
Rationale: A missing closing parenthesis violates Python's grammar rules and
produces a SyntaxError before execution.
2|Page
,Page 3 of 75
7. A runtime error differs from a syntax error in which of the following ways?
A. A runtime error is detected before the program starts.
B. A runtime error occurs while the program is executing.
C. A runtime error cannot be handled with try/except.
D. A runtime error is always a logical error.
Rationale: Syntax errors are caught before execution, while runtime errors occur
during execution and can often be handled with exceptions.
8. A program that runs without errors but produces incorrect results contains
which type of error?
A. Syntax error
B. Runtime error
C. Logical error
D. Indentation error
Rationale: Logical errors occur when the program's logic is flawed, producing
unintended results even though the code executes without crashing.
9. In Python, indentation is used primarily to do which of the following?
A. Improve program speed
B. Define blocks of code such as loops and conditionals
C. Declare variable types
D. Create comments
Rationale: Python uses indentation to delimit code blocks, so inconsistent
indentation can cause IndentationError or change program logic.
10. Which of the following best describes the role of the Python interpreter?
A. It reads and executes Python code line by line.
B. It compiles Python into machine code permanently.
C. It converts Python into HTML.
D. It manages database connections only.
3|Page
, Page 4 of 75
Rationale: The interpreter translates and executes Python source code, allowing
interactive and script-based execution.
11. Which of the following is an example of program input in the IPO model?
A. print("Result")
B. name = input("Enter your name: ")
C. total = a + b
D. if x > 0: print(x)
Rationale: input() collects data from the user, which is the input stage of the IPO
model.
12. Which of the following is an example of program output?
A. x = 10
B. y = x * 2
C. print("Total:", y)
D. z = int(input())
Rationale: print() displays results to the console, which is the output stage.
13. A docstring in Python is best described as which of the following?
A. A comment that the interpreter executes
B. A string literal used to document a module, function, or class
C. A syntax error
D. A type of loop
Rationale: Docstrings are triple-quoted strings placed at the beginning of
modules, functions, or classes to document their purpose.
14. Which of the following best describes a Python script?
A. A single interactive command
B. A file containing a sequence of Python statements executed in order
C. A compiled binary file
D. A database table
4|Page
WGU D335 OA: INTRODUCTION TO PROGRAMMING IN PYTHON PREP
2026 QUESTIONS WITH VERIFIED ANSWERS DETAILED RATIONALES
GRADED A+
Part I: IPO Model, Algorithms, and Program Structure (Questions 1–25)
1. Every Python program can be understood as following which three basic
instruction types in sequence?
A. Compile, link, and run
B. Input, process, and output
C. Define, call, and return
D. Read, write, and execute
Rationale: The IPO model describes a program as taking input, processing that
data through computations and logic, and producing output.
2. A step-by-step sequence of unambiguous instructions designed to solve a
specific problem is best described as which of the following?
A. A syntax error
B. An algorithm
C. A data type
D. A module
Rationale: An algorithm is a finite, ordered set of instructions that solves a
problem or accomplishes a task.
1|Page
,Page 2 of 75
3. Which symbol begins a single-line comment in a Python program?
A. //
B. #
C. --
D. /*
Rationale: Single-line comments in Python begin with the # symbol, and the
interpreter ignores everything after it on that line.
4. Multi-line comments in Python are commonly created using which syntax?
A. /* and */
B. <!-- and -->
C. Triple quotation marks (" " " or ' ' ')
D. Three forward slashes
Rationale: Triple-quoted strings are often used as multi-line comments because
they are ignored when not assigned or used as documentation.
5. Which of the following best describes the purpose of pseudocode?
A. To execute directly on the Python interpreter
B. To plan an algorithm in human-readable form before coding
C. To replace all Python syntax permanently
D. To measure program execution speed
Rationale: Pseudocode expresses algorithmic logic in plain language, helping
programmers design solutions before writing executable code.
6. Which of the following is a syntax error in Python?
A. print("Hello")
B. print("Hello"
C. x = 5
D. if x > 0: print(x)
Rationale: A missing closing parenthesis violates Python's grammar rules and
produces a SyntaxError before execution.
2|Page
,Page 3 of 75
7. A runtime error differs from a syntax error in which of the following ways?
A. A runtime error is detected before the program starts.
B. A runtime error occurs while the program is executing.
C. A runtime error cannot be handled with try/except.
D. A runtime error is always a logical error.
Rationale: Syntax errors are caught before execution, while runtime errors occur
during execution and can often be handled with exceptions.
8. A program that runs without errors but produces incorrect results contains
which type of error?
A. Syntax error
B. Runtime error
C. Logical error
D. Indentation error
Rationale: Logical errors occur when the program's logic is flawed, producing
unintended results even though the code executes without crashing.
9. In Python, indentation is used primarily to do which of the following?
A. Improve program speed
B. Define blocks of code such as loops and conditionals
C. Declare variable types
D. Create comments
Rationale: Python uses indentation to delimit code blocks, so inconsistent
indentation can cause IndentationError or change program logic.
10. Which of the following best describes the role of the Python interpreter?
A. It reads and executes Python code line by line.
B. It compiles Python into machine code permanently.
C. It converts Python into HTML.
D. It manages database connections only.
3|Page
, Page 4 of 75
Rationale: The interpreter translates and executes Python source code, allowing
interactive and script-based execution.
11. Which of the following is an example of program input in the IPO model?
A. print("Result")
B. name = input("Enter your name: ")
C. total = a + b
D. if x > 0: print(x)
Rationale: input() collects data from the user, which is the input stage of the IPO
model.
12. Which of the following is an example of program output?
A. x = 10
B. y = x * 2
C. print("Total:", y)
D. z = int(input())
Rationale: print() displays results to the console, which is the output stage.
13. A docstring in Python is best described as which of the following?
A. A comment that the interpreter executes
B. A string literal used to document a module, function, or class
C. A syntax error
D. A type of loop
Rationale: Docstrings are triple-quoted strings placed at the beginning of
modules, functions, or classes to document their purpose.
14. Which of the following best describes a Python script?
A. A single interactive command
B. A file containing a sequence of Python statements executed in order
C. A compiled binary file
D. A database table
4|Page