2026 UPDATED QUESTIONS DOWNLOAD
WGU D335 OA Prep 300 Questions on String Formatting, File
I/O, Dictionary Manipulation, and Error Handling
This comprehensive study resource features 300 meticulously crafted multiple-choice
questions designed to mirror the logic and syntax found on the WGU D335 Objective
Assessment. Each question includes a detailed, italicized rationale to help you master
core Python concepts such as string formatting, dictionary manipulation, and file I/O
operations. Perfect for students aiming to pass the OA on their first attempt, this guide
bridges the gap between ZyBooks practice labs and the final high-stakes exam.
What is the result of 10 // 3 in Python?
A) 3.33
B) 3
C) 4
D) 3.0
Answer: B
Rationale: The // operator performs floor division, which rounds the result down to the
nearest whole integer.
Which of the following is a mutable data type?
A) Tuple
B) String
C) List
D) Integer
Answer: C
Rationale: Lists can be modified after creation (adding/removing items), whereas tuples,
strings, and integers are immutable.
How do you start a function definition in Python?
A) function myFunc():
B) define myFunc():
C) def myFunc():
D) func myFunc():
Answer: C
Rationale: The def keyword is the standard Python syntax for defining a new function.
,2026 UPDATED QUESTIONS DOWNLOAD
What is the output of print(type(5.0)) ?
A) <class 'int'>
B) <class 'number'>
C) <class 'float'>
D) <class 'str'>
Answer: C
Rationale: Any number containing a decimal point is treated as a float in Python.
Which method is used to remove only trailing whitespace from a string?
A) .strip()
B) .lstrip()
C) .rstrip()
D) .remove()
Answer: C
Rationale: .rstrip() stands for "right strip," which removes whitespace from the end
(right side) of a string.
What will bool(0) evaluate to?
A) True
B) False
C) None
D) Error
Answer: B
Rationale: In Python, the integer 0, empty sequences, and None are all evaluated as
False in a boolean context.
Which operator is used for exponentiation (power)?
A) ^
B) **
C) *
D) exp()
Answer: B
Rationale: The double asterisk ** is used to raise a number to a power (e.g., 2 ** 3 = 8).
What does the .split() method return by default?
A) A string
B) A tuple
C) A list
D) A dictionary
Answer: C
,2026 UPDATED QUESTIONS DOWNLOAD
Rationale: The .split() method breaks a string into parts and stores those parts as
elements in a list.
Which of these is the correct way to create an empty set?
A) {}
B) set()
C) []
D) ()
Answer: B
Rationale: {} creates an empty dictionary by default; set() must be used to initialize an
empty set.
What is the index of the last element in a list of length n ?
A) n
B) n + 1
C) n - 1
D) 0
Answer: C
Rationale: Because Python uses zero-based indexing, the final position is always one
less than the total count.
How do you insert a value at the end of a list?
A) .insert()
B) .add()
C) .append()
D) .extend()
Answer: C
Rationale: The .append() method adds exactly one object to the very end of an existing
list.
Which block handles errors in Python?
A) try / catch
B) try / except
C) do / except
D) error / handle
Answer: B
Rationale: Python uses the try block to test code and the except block to handle any
errors that occur.
What is the result of "Python" * 2 ?
A) PythonPython
B) Python 2
, 2026 UPDATED QUESTIONS DOWNLOAD
C) Error
D) ["Python", "Python"]
Answer: A
Rationale: Using the multiplication operator on a string performs string repetition.
Which function converts a string to an integer?
A) str()
B) float()
C) int()
D) cast(int)
Answer: C
Rationale: int() is a built-in constructor that parses a string or float into an integer.
What is the correct syntax for an if statement?
A) if x > 5 then:
B) if (x > 5)
C) if x > 5:
D) if x > 5;
Answer: C
Rationale: Python requires a colon : at the end of control flow statements like if, for,
and while.
Which of the following is used to read all lines of a file into a list?
A) file.read()
B) file.readline()
C) file.readlines()
D) file.list()
Answer: C
Rationale: .readlines() reads the entire file and returns a list where each element is a
single line.
What does the break keyword do?
A) Skips the current iteration
B) Exits the entire loop
C) Restarts the loop
D) Stops the whole program
Answer: B
Rationale: break provides an immediate exit from the innermost loop currently
executing.
What is the output of len(["apple", "banana", "cherry"]) ?
A) 3
WGU D335 OA Prep 300 Questions on String Formatting, File
I/O, Dictionary Manipulation, and Error Handling
This comprehensive study resource features 300 meticulously crafted multiple-choice
questions designed to mirror the logic and syntax found on the WGU D335 Objective
Assessment. Each question includes a detailed, italicized rationale to help you master
core Python concepts such as string formatting, dictionary manipulation, and file I/O
operations. Perfect for students aiming to pass the OA on their first attempt, this guide
bridges the gap between ZyBooks practice labs and the final high-stakes exam.
What is the result of 10 // 3 in Python?
A) 3.33
B) 3
C) 4
D) 3.0
Answer: B
Rationale: The // operator performs floor division, which rounds the result down to the
nearest whole integer.
Which of the following is a mutable data type?
A) Tuple
B) String
C) List
D) Integer
Answer: C
Rationale: Lists can be modified after creation (adding/removing items), whereas tuples,
strings, and integers are immutable.
How do you start a function definition in Python?
A) function myFunc():
B) define myFunc():
C) def myFunc():
D) func myFunc():
Answer: C
Rationale: The def keyword is the standard Python syntax for defining a new function.
,2026 UPDATED QUESTIONS DOWNLOAD
What is the output of print(type(5.0)) ?
A) <class 'int'>
B) <class 'number'>
C) <class 'float'>
D) <class 'str'>
Answer: C
Rationale: Any number containing a decimal point is treated as a float in Python.
Which method is used to remove only trailing whitespace from a string?
A) .strip()
B) .lstrip()
C) .rstrip()
D) .remove()
Answer: C
Rationale: .rstrip() stands for "right strip," which removes whitespace from the end
(right side) of a string.
What will bool(0) evaluate to?
A) True
B) False
C) None
D) Error
Answer: B
Rationale: In Python, the integer 0, empty sequences, and None are all evaluated as
False in a boolean context.
Which operator is used for exponentiation (power)?
A) ^
B) **
C) *
D) exp()
Answer: B
Rationale: The double asterisk ** is used to raise a number to a power (e.g., 2 ** 3 = 8).
What does the .split() method return by default?
A) A string
B) A tuple
C) A list
D) A dictionary
Answer: C
,2026 UPDATED QUESTIONS DOWNLOAD
Rationale: The .split() method breaks a string into parts and stores those parts as
elements in a list.
Which of these is the correct way to create an empty set?
A) {}
B) set()
C) []
D) ()
Answer: B
Rationale: {} creates an empty dictionary by default; set() must be used to initialize an
empty set.
What is the index of the last element in a list of length n ?
A) n
B) n + 1
C) n - 1
D) 0
Answer: C
Rationale: Because Python uses zero-based indexing, the final position is always one
less than the total count.
How do you insert a value at the end of a list?
A) .insert()
B) .add()
C) .append()
D) .extend()
Answer: C
Rationale: The .append() method adds exactly one object to the very end of an existing
list.
Which block handles errors in Python?
A) try / catch
B) try / except
C) do / except
D) error / handle
Answer: B
Rationale: Python uses the try block to test code and the except block to handle any
errors that occur.
What is the result of "Python" * 2 ?
A) PythonPython
B) Python 2
, 2026 UPDATED QUESTIONS DOWNLOAD
C) Error
D) ["Python", "Python"]
Answer: A
Rationale: Using the multiplication operator on a string performs string repetition.
Which function converts a string to an integer?
A) str()
B) float()
C) int()
D) cast(int)
Answer: C
Rationale: int() is a built-in constructor that parses a string or float into an integer.
What is the correct syntax for an if statement?
A) if x > 5 then:
B) if (x > 5)
C) if x > 5:
D) if x > 5;
Answer: C
Rationale: Python requires a colon : at the end of control flow statements like if, for,
and while.
Which of the following is used to read all lines of a file into a list?
A) file.read()
B) file.readline()
C) file.readlines()
D) file.list()
Answer: C
Rationale: .readlines() reads the entire file and returns a list where each element is a
single line.
What does the break keyword do?
A) Skips the current iteration
B) Exits the entire loop
C) Restarts the loop
D) Stops the whole program
Answer: B
Rationale: break provides an immediate exit from the innermost loop currently
executing.
What is the output of len(["apple", "banana", "cherry"]) ?
A) 3