WGU D335 INTRODUCTION TO
PROGRAMMING IN PYTHON
OBJECTIVE ASSESSMENT
QUESTIONS AND CORRECT
ANSWERS (VERIFIED ANSWERS)
PLUS RATIONALES 2026 Q&A |
INSTANT DOWNLOAD PDF.
Core Domains
• Python Fundamentals and Syntax
• Variables, Data Types, and Operators
• Input/Output Operations and Program Structure
• Control Flow: Conditional Statements and Loops
• Functions and Modular Programming
• Data Structures: Lists, Tuples, Dictionaries, and Sets
• String Manipulation and Operations
• File Input/Output and Exception Handling
• Problem-Solving and Algorithm Development
• Debugging and Code Analysis
Introduction
This comprehensive assessment is designed to evaluate your foundational
knowledge and practical skills in Python programming, as outlined in the
WGU D335 Objective Assessment. The examination measures your
,understanding of core syntax, data structures, control flow, and problem-
solving techniques essential for writing efficient and correct Python code.
Through a combination of theoretical questions and applied scenarios, this
test challenges your ability to analyze code, predict outputs, and make
sound programming decisions. Mastery of these topics is critical for
success in the course and for real-world application development. The
following 100 multiple-choice questions reflect the breadth and depth of
the official exam, emphasizing critical thinking and practical
implementation.
SECTION ONE: QUESTIONS 1–100
Question 1
Which of the following is a valid variable name in Python?
A. 2ndPlace
B. total_score
C. class
D. my-variable
B
RATIONALE: Variable names in Python must start with a letter or
underscore and cannot begin with a number. total_score follows this
rule. class is a reserved keyword, 2ndPlace starts with a number,
and my-variable contains a hyphen which is interpreted as a subtraction
operator.
Question 2
What is the output of the following code?
print(type(3.14))
A. <class 'int'>
B. <class 'float'>
C. <class 'str'>
D. <class 'complex'>
, B
RATIONALE: The type() function returns the data type of the
argument. 3.14 is a floating-point number, so type(3.14) returns <class
'float'>.
Question 3
Which operator is used to find the remainder of a division operation in
Python?
A. /
B. //
C. %
D. **
C
RATIONALE: The modulus operator % returns the remainder of a
division. / performs float division, // performs floor division, and ** is
the exponentiation operator.
Question 4
What will the following code output?
print("Hello" + " " + "World")
A. HelloWorld
B. Hello World
C. "Hello World"
D. Hello+World
B
RATIONALE: The + operator concatenates strings. The
expression "Hello" + " " + "World" joins the three strings together,
producing Hello World with a space between the words.
Question 5
Which of the following is a correct way to create a comment in Python?
, A. // This is a comment
B. /* This is a comment */
C. # This is a comment
D. -- This is a comment
C
RATIONALE: In Python, the # symbol is used to indicate a comment.
The interpreter ignores everything after # on that line. The other options
use syntax from other programming languages.
Question 6
What is the result of 10 // 3 in Python?
A. 3.33
B. 3.0
C. 3
D. 4
C
RATIONALE: The // operator performs floor division, which returns
the integer quotient of the division, discarding any remainder. 10 //
3 equals 3.
Question 7
Which of the following correctly assigns the value 5 to a variable
named x?
A. x = 5
B. x == 5
C. 5 = x
D. x <- 5
A
RATIONALE: In Python, assignment uses the = operator. x = 5 stores
the value 5 in the variable x. x == 5 is a comparison, 5 = x is invalid,
and x <- 5 is not valid Python syntax.
PROGRAMMING IN PYTHON
OBJECTIVE ASSESSMENT
QUESTIONS AND CORRECT
ANSWERS (VERIFIED ANSWERS)
PLUS RATIONALES 2026 Q&A |
INSTANT DOWNLOAD PDF.
Core Domains
• Python Fundamentals and Syntax
• Variables, Data Types, and Operators
• Input/Output Operations and Program Structure
• Control Flow: Conditional Statements and Loops
• Functions and Modular Programming
• Data Structures: Lists, Tuples, Dictionaries, and Sets
• String Manipulation and Operations
• File Input/Output and Exception Handling
• Problem-Solving and Algorithm Development
• Debugging and Code Analysis
Introduction
This comprehensive assessment is designed to evaluate your foundational
knowledge and practical skills in Python programming, as outlined in the
WGU D335 Objective Assessment. The examination measures your
,understanding of core syntax, data structures, control flow, and problem-
solving techniques essential for writing efficient and correct Python code.
Through a combination of theoretical questions and applied scenarios, this
test challenges your ability to analyze code, predict outputs, and make
sound programming decisions. Mastery of these topics is critical for
success in the course and for real-world application development. The
following 100 multiple-choice questions reflect the breadth and depth of
the official exam, emphasizing critical thinking and practical
implementation.
SECTION ONE: QUESTIONS 1–100
Question 1
Which of the following is a valid variable name in Python?
A. 2ndPlace
B. total_score
C. class
D. my-variable
B
RATIONALE: Variable names in Python must start with a letter or
underscore and cannot begin with a number. total_score follows this
rule. class is a reserved keyword, 2ndPlace starts with a number,
and my-variable contains a hyphen which is interpreted as a subtraction
operator.
Question 2
What is the output of the following code?
print(type(3.14))
A. <class 'int'>
B. <class 'float'>
C. <class 'str'>
D. <class 'complex'>
, B
RATIONALE: The type() function returns the data type of the
argument. 3.14 is a floating-point number, so type(3.14) returns <class
'float'>.
Question 3
Which operator is used to find the remainder of a division operation in
Python?
A. /
B. //
C. %
D. **
C
RATIONALE: The modulus operator % returns the remainder of a
division. / performs float division, // performs floor division, and ** is
the exponentiation operator.
Question 4
What will the following code output?
print("Hello" + " " + "World")
A. HelloWorld
B. Hello World
C. "Hello World"
D. Hello+World
B
RATIONALE: The + operator concatenates strings. The
expression "Hello" + " " + "World" joins the three strings together,
producing Hello World with a space between the words.
Question 5
Which of the following is a correct way to create a comment in Python?
, A. // This is a comment
B. /* This is a comment */
C. # This is a comment
D. -- This is a comment
C
RATIONALE: In Python, the # symbol is used to indicate a comment.
The interpreter ignores everything after # on that line. The other options
use syntax from other programming languages.
Question 6
What is the result of 10 // 3 in Python?
A. 3.33
B. 3.0
C. 3
D. 4
C
RATIONALE: The // operator performs floor division, which returns
the integer quotient of the division, discarding any remainder. 10 //
3 equals 3.
Question 7
Which of the following correctly assigns the value 5 to a variable
named x?
A. x = 5
B. x == 5
C. 5 = x
D. x <- 5
A
RATIONALE: In Python, assignment uses the = operator. x = 5 stores
the value 5 in the variable x. x == 5 is a comparison, 5 = x is invalid,
and x <- 5 is not valid Python syntax.