Page 1 of 79
WGU D335 OA: INTRODUCTION TO PROGRAMMING IN PYTHON
EXAM 2026 QUESTIONS WITH VERIFIED QUESTIONS DETAILED
RATIONALES GRADED A+
WGU D335 OA: Introduction to Programming in Python — Questions with Rationales
SECTION 1: PYTHON FUNDAMENTALS & SYNTAX
Questions 1–40
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
Answer: B
Rationale: Every program follows the IPO (Input-Process-Output) model: it takes input (from
keyboard, file, etc.), processes that data (computations, logic), and produces output (to screen,
file, etc.).
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
Answer: B
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.
,Page 2 of 79
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
Answer: B
Rationale: An algorithm is a step-by-step sequence of instructions designed to solve a specific
problem or accomplish a task.
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
Answer: B
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).
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
,Page 3 of 79
Answer: A
Rationale: f-strings (formatted string literals) allow expressions to be evaluated inside curly
braces {}. The variables name and age are interpolated into the string.
Question 6
Which of the following is NOT a valid Python variable name?
A) my_variable
B) _private
C) 2nd_place
D) myVar
Answer: C
Rationale: Variable names cannot start with a digit. They can start with a letter or underscore,
followed by letters, numbers, or underscores.
Question 7
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
Answer: B
Rationale: The print() function outputs text or variable values to the console. By default, it adds
a newline character at the end.
Question 8
How do you denote a single-line comment in Python?
A) // comment
B) /* comment */
C) # comment
D) <!-- comment -->
, Page 4 of 79
Answer: C
Rationale: Single-line comments begin with #. Multi-line comments can be enclosed in triple
quotes (""" or '''). Comments are ignored by the interpreter.
Question 9
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
Answer: B
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.
Question 10
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
Answer: B
Rationale: The type() function returns the data type of any object in Python, such as <class
'int'>, <class 'str'>, etc..
Question 11
What is the output of print(type(3.14))?
A) <class 'int'>
B) <class 'float'>
C) <class 'str'>
D) <class 'bool'>
Answer: B
Rationale: 3.14 is a floating-point number. The type() function returns <class 'float'>.
WGU D335 OA: INTRODUCTION TO PROGRAMMING IN PYTHON
EXAM 2026 QUESTIONS WITH VERIFIED QUESTIONS DETAILED
RATIONALES GRADED A+
WGU D335 OA: Introduction to Programming in Python — Questions with Rationales
SECTION 1: PYTHON FUNDAMENTALS & SYNTAX
Questions 1–40
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
Answer: B
Rationale: Every program follows the IPO (Input-Process-Output) model: it takes input (from
keyboard, file, etc.), processes that data (computations, logic), and produces output (to screen,
file, etc.).
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
Answer: B
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.
,Page 2 of 79
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
Answer: B
Rationale: An algorithm is a step-by-step sequence of instructions designed to solve a specific
problem or accomplish a task.
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
Answer: B
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).
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
,Page 3 of 79
Answer: A
Rationale: f-strings (formatted string literals) allow expressions to be evaluated inside curly
braces {}. The variables name and age are interpolated into the string.
Question 6
Which of the following is NOT a valid Python variable name?
A) my_variable
B) _private
C) 2nd_place
D) myVar
Answer: C
Rationale: Variable names cannot start with a digit. They can start with a letter or underscore,
followed by letters, numbers, or underscores.
Question 7
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
Answer: B
Rationale: The print() function outputs text or variable values to the console. By default, it adds
a newline character at the end.
Question 8
How do you denote a single-line comment in Python?
A) // comment
B) /* comment */
C) # comment
D) <!-- comment -->
, Page 4 of 79
Answer: C
Rationale: Single-line comments begin with #. Multi-line comments can be enclosed in triple
quotes (""" or '''). Comments are ignored by the interpreter.
Question 9
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
Answer: B
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.
Question 10
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
Answer: B
Rationale: The type() function returns the data type of any object in Python, such as <class
'int'>, <class 'str'>, etc..
Question 11
What is the output of print(type(3.14))?
A) <class 'int'>
B) <class 'float'>
C) <class 'str'>
D) <class 'bool'>
Answer: B
Rationale: 3.14 is a floating-point number. The type() function returns <class 'float'>.