WGU D335 Introduction to
Programming in Python OA Study
Guide | Objective Assessment Review
2025
Prepare for WGU D335 Introduction to Programming in
Python Objective Assessment with targeted practice
questions and study materials. Covers essential Python
topics including data types, control flow, loops,
functions, strings, lists, dictionaries, error handling, and
file I/O. Aligned to the OA format and WGU competency
requirements. Organized for efficient review of key
programming concepts and syntax.
1. What is the primary purpose of the input() function in Python?
A. To display output to the console
B. To read user input from the keyboard
C. To convert a string to an integer
D. To write data to a file
,2|Page
B. To read user input from the keyboard
The input() function pauses program execution and waits for the user to type
something, returning that input as a string. It does not display output
(that's print()), convert types (that's int()), or write to files.
2. Which of the following is a valid variable name in Python?
A. 2nd_place
B. total-score
C. user_name
D. class
C. user_name
Variable names cannot start with a digit (A), contain hyphens (B), or be
reserved keywords like class (D). Underscores are allowed,
making user_name valid.
3. What data type does the expression produce in Python 3?
A. int
B. float
C. string
D. boolean
B. float
In Python 3, the single forward slash / always performs true division and
returns a float, so yields 2.5. To get an integer, you would use //.
4. What is the output of print(type(3.14))?
A. <class 'int'>
B. <class 'float'>
C. <class 'str'>
D. <class 'double'>
B. <class 'float'>
The type() function returns the class of the value. Since 3.14 has a decimal point,
it is a float, and Python represents it as <class 'float'>. There is no double type
in Python.
5. Which operator is used for exponentiation in Python?
A. ^
B. **
C. //
D. %
*B. **
The ** operator raises a number to a power, e.g., 2 ** 3 equals 8. The ^ symbol is
a bitwise XOR, not exponentiation.
,3|Page
6. What does the % operator return?
A. The percentage of two numbers
B. The remainder of division
C. The quotient of division
D. The absolute value
B. The remainder of division
The modulus operator % returns the remainder after division. For example, 10 %
3 returns 1. It is not used for calculating percentages directly.
7. What is the result of 10 // 3?
A. 3.33
B. 3
C. 4
D. 3.0
B. 3
The // operator performs floor division, which divides and rounds down to the
nearest whole number. Since is 3.33..., floor division returns 3.
8. Which of the following is an immutable data type?
A. list
B. dictionary
C. set
D. tuple
D. tuple
Tuples cannot be changed after creation, making them immutable. Lists,
dictionaries, and sets are all mutable, meaning their contents can be modified.
9. How do you create a single-line comment in Python?
A. // comment
B. /* comment */
C. # comment
D. -- comment
C. # comment
Python uses the hash symbol # for single-line comments. The other symbols are
used in languages like C, Java, or SQL.
10. What is the correct way to define a function in Python?
A. function myFunc():
B. def myFunc():
C. define myFunc():
D. func myFunc():
B. def myFunc():
The keyword def is used to define a function in Python, followed by the function
name, parentheses, and a colon.
, 4|Page
11. What will print("Hello" + "World") output?
A. Hello World
B. HelloWorld
C. Hello+World
D. Error
B. HelloWorld
The + operator concatenates strings without adding a space. To include a space,
you would need "Hello " + "World" or use a comma in print().
12. Which method converts a string to all uppercase letters?
A. .upper()
B. .uppercase()
C. .toUpper()
D. .capitalize()
A. .upper()
The .upper() method returns a copy of the string with all characters converted to
uppercase. .capitalize() only capitalizes the first letter.
13. What is the output of len("Python")?
A. 5
B. 6
C. 7
D. Error
B. 6
The len() function returns the number of characters in a string. "Python" has 6
characters: P, y, t, h, o, n.
14. Which of the following is NOT a valid Python data type?
A. int
B. float
C. char
D. bool
C. char
Python does not have a separate char type; single characters are simply strings
of length 1. The other options are all valid Python types.
15. What does the bool data type represent?
A. Only integers
B. Only strings
C. True or False values
D. Floating-point numbers
C. True or False values
The bool type has only two possible values: True and False. It is often used in
conditional statements.