Assessment (NKO2) Study Guide Complete
OA Exam Questions and Answers | 2026
Updated | 100% Correct
EXAM STRUCTURE & INSTRUCTIONS
Course: WGU D335 Introduction to Programming in Python
Assessment: Objective Assessment (OA) - NKO2
Format: Multiple Choice, Coding Problems, Fill-in-the-Blank
Content Areas:
Python Fundamentals & Syntax (25%)
Data Types & Structures (25%)
Control Flow & Loops (20%)
Functions & Modules (15%)
File I/O & Exception Handling (10%)
Problem Solving & Algorithms (5%)
Instructions: Select the single best answer for each question. For coding
problems, write code that produces the exact specified output.
DOMAIN I: Python Fundamentals & Syntax (Questions 1-60)
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
📖 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.) .
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
📖 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 .
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
📖 Rationale: An algorithm is a step-by-step sequence of instructions
designed to solve a specific problem or accomplish a task .
4. What does the print() function do in Python?
A) Reads input from the user
B) Displays output to the screen and starts a new line
C) Opens a file for reading
,D) Converts a value to a string
✅ Correct Answer: B - Displays output to the screen and starts a new line
📖 Rationale: The print() function outputs text or variable values to the
console. By default, it adds a newline character at the end .
5. How do you denote a comment in Python?
A) // comment
B) /* comment */
C) # comment or """ multi-line comment """
D) <!-- comment -->
✅ **Correct Answer: C - # comment or """ multi-line comment """📖
*Rationale:* Single-line comments begin with#. Multi-line comments can be
enclosed in triple quotes ("""or'''`). Comments are ignored by the
interpreter .
6. What is the purpose of the input() function?
A) To display output to the screen
B) To get text input from the user
C) To convert data types
D) To open a file
✅ Correct Answer: B - To get text input from the user
📖 Rationale: The input() function reads a line of text from the user and
returns it as a string. It can optionally display a prompt string .
7. What does the type() function return?
A) The size of a variable in memory
B) The data type of a variable or value
C) The value of a variable
, D) The memory address of a variable
✅ Correct Answer: B - The data type of a variable or value
📖 Rationale: The built-in type() function returns the type of an object, such
as ,, or `` .
8. What is a syntax error?
A) A violation of the programming language's rules for symbols and
structure
B) An error that occurs during program execution
C) A logical flaw that produces wrong output
D) An error caused by incorrect indentation
✅ Correct Answer: A - A violation of the programming language's rules for
symbols and structure
📖 Rationale: Syntax errors occur when code violates the grammatical rules
of Python. The interpreter catches these before execution begins .
9. What is a runtime error?
A) A violation of language syntax
B) An error that occurs when the program attempts an impossible operation
C) A flaw in program logic
D) An indentation mistake
✅ Correct Answer: B - An error that occurs when the program attempts an
impossible operation
📖 Rationale: Runtime errors (exceptions) occur during program execution
when an operation cannot be completed, such as dividing by zero .
10. What is a NameError?
A) Using an invalid value in an operation
B) Trying to use a variable that does not exist