WGU D335 OA: INTRODUCTION TO
PROGRAMMING IN PYTHON |
OBJECTIVE ASSESSMENT | ACTUAL
QUESTIONS WITH VERIFIED
ANSWERS | NEW 2025/2026
UPDATE | 100% CORRECT.
WGU D335 Introduction to Programming in Python
Practice Exam
Assessment: Objective Assessment (OA) – NK02 | Format: Multiple Choice, Coding
Problems, Fill-in-the-Blank | Passing: 80% (12/15) | 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%)
Section 1: Python Fundamentals & Syntax
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
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
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
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
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 -->
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
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
Rationale: The built-in type() function returns the type of an object, such as <class
'int'>, <class 'str'>, or <class 'float'> .
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
Rationale: Syntax errors occur when code violates the grammatical rules of the
programming language. The program will not run until syntax errors are fixed .
9. What is the output of the following Python code?
x=7
y=2
result = x // y + x % y
print(result)
A. 3
B. 3.5
C. 4
D. 5
Rationale: x // y performs floor division (7 // 2 = 3). x % y performs modulo (7 % 2 = 1).
3+1=4.
10. A student writes the following code to convert user input to an integer and
calculate a 15% tip. Which line contains a logic error that will cause the program
to fail at runtime?
bill = input("Enter bill amount: ")
tip = bill * 0.15
total = bill + tip
print(f"Total: {total}")
A. Line 1
B. Line 2
C. Line 3
D. Line 4
PROGRAMMING IN PYTHON |
OBJECTIVE ASSESSMENT | ACTUAL
QUESTIONS WITH VERIFIED
ANSWERS | NEW 2025/2026
UPDATE | 100% CORRECT.
WGU D335 Introduction to Programming in Python
Practice Exam
Assessment: Objective Assessment (OA) – NK02 | Format: Multiple Choice, Coding
Problems, Fill-in-the-Blank | Passing: 80% (12/15) | 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%)
Section 1: Python Fundamentals & Syntax
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
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
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
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
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 -->
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
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
Rationale: The built-in type() function returns the type of an object, such as <class
'int'>, <class 'str'>, or <class 'float'> .
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
Rationale: Syntax errors occur when code violates the grammatical rules of the
programming language. The program will not run until syntax errors are fixed .
9. What is the output of the following Python code?
x=7
y=2
result = x // y + x % y
print(result)
A. 3
B. 3.5
C. 4
D. 5
Rationale: x // y performs floor division (7 // 2 = 3). x % y performs modulo (7 % 2 = 1).
3+1=4.
10. A student writes the following code to convert user input to an integer and
calculate a 15% tip. Which line contains a logic error that will cause the program
to fail at runtime?
bill = input("Enter bill amount: ")
tip = bill * 0.15
total = bill + tip
print(f"Total: {total}")
A. Line 1
B. Line 2
C. Line 3
D. Line 4