D335 INTRODUCTION TO PROGRAMMING IN PYTHON
PRE-ASSESSMENT & PERFORMANCE ASSESSMENT
PRACTICE EXAM 2026/2027 COMPLETE (65) CURRENT
TESTING QUESTIONS AND CORRECT ANSWERS WITH
DETAILED RATIONALES.
PYTHON
Prepare for the D335 Introduction to Programming in Python Pre-Assessment &
Performance Assessment with a focused practice resource designed to reinforce
essential Python programming concepts. It supports review of topics such as
variables, data types, control flow, functions, loops, lists, and problem-solving
techniques. The resource can help you assess your understanding, build confidence,
and identify areas that need additional practice before completing the assessments.
This resource is best suited for WGU D335 students preparing for the Pre-Assessment
and Performance Assessment in Introduction to Programming in Python.
MULTIPLE CHOICE.
SECTION 1: MULTIPLE CHOICE QUESTIONS
Python Fundamentals & Data Types (Questions 1-15)
1. What is Python primarily classified as?
a) A compiled, statically typed language
b) A markup language
c) A low-level machine language
d) An interpreted, high-level, general-purpose programming language
e) A hardware description language
Answer: d) An interpreted, high-level, general-purpose programming
language
Rationale: Python is an interpreted language, meaning code is executed line
by line by the Python interpreter. It is high-level because it abstracts away
memory management and hardware details, and general-purpose because it
supports web development, data science, automation, AI, and more.
, Page 2 of 41
2. Which symbol is used to write a single-line comment in Python?
a) //
b) /*
c) #
d) --
e) $$
Answer: c) #
Rationale: In Python, the hash symbol # begins a single-line comment.
Everything after # on that line is ignored by the interpreter. // is used in
languages like JavaScript and C++.
3. What will print(type(5)) output?
a) <class 'float'>
b) <class 'str'>
c) <class 'int'>
d) <class 'number'>
e) <class 'double'>
Answer: c) <class 'int'>
Rationale: The integer literal 5 belongs to the int class in
Python. type() returns the data type of a value, and Python uses <class
'int'> as its representation for integers.
4. Which of the following is a valid Python variable name?
a) 2variable
b) my-variable
c) class
d) my_variable
e) my variable
Answer: d) my_variable
Rationale: Python variable names must begin with a letter or underscore,
followed by letters, digits, or underscores. 2variable starts with a digit, my-
variable contains a hyphen, class is a reserved keyword, and my
variable contains a space.
, Page 3 of 41
5. What does the print() function do in Python?
a) Reads input from the user
b) Saves data to a file
c) Outputs text or values to the console
d) Declares a variable
e) Compiles the program
Answer: c) Outputs text or values to the console
Rationale: The print() function outputs its arguments to standard output (the
console). It is one of Python's built-in functions and is commonly used for
displaying results, debugging, and user interaction.
6. Which of the following correctly assigns the value 10 to a variable
named x?
a) x == 10
b) 10 = x
c) x = 10
d) int x = 10
e) var x = 10
Answer: c) x = 10
Rationale: In Python, the single = is the assignment operator. The variable
name goes on the left and the value on the right. == is for comparison, and
Python does not require type declarations like int.
7. What is the output of print() in Python 3?
a) 3
b) 3.0
c) 3.3333333333333335
d) 3.33
e) Error
Answer: c) 3.3333333333333335
Rationale: In Python 3, the / operator always performs true (float) division,
, Page 4 of 41
returning a float. The result is 3.3333333333333335 due to floating-point
representation.
8. What is the output of print(10 // 3)?
a) 3
b) 3.0
c) 3.3333333333333335
d) 4
e) Error
Answer: a) 3
Rationale: The // operator performs floor division, which returns the integer
quotient, discarding any remainder. 10 // 3 equals 3.
9. What is the output of print(10 % 3)?
a) 3
b) 1
c) 0
d) 3.333
e) Error
Answer: b) 1
Rationale: The % operator is the modulo operator, which returns the
remainder of the division. 10 % 3 equals 1.
10. What will print(3 + 2.5) output?
a) 5
b) 5.5
c) 6
d) Error
Answer: b) 5.5
Rationale: Python automatically performs implicit type conversion. The
integer 3 is converted to a float to perform the addition, resulting in a float
value of 5.5.