Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 54 pages
Exam (elaborations)

WGU D335 Introduction to Programming in Python OBJECTIVE ASSESSMENT ACTUAL EXAM 2025/2026 QUESTIONS WITH VERIFIED CORRECT SOLUTIONS || 100% GUARANTEED PASS BRAND NEW VERSION

Document preview thumbnail
Preview 4 out of 54 pages

WGU D335 Introduction to Programming in Python OBJECTIVE ASSESSMENT ACTUAL EXAM 2025/2026 QUESTIONS WITH VERIFIED CORRECT SOLUTIONS || 100% GUARANTEED PASS BRAND NEW VERSION

Content preview

WGU D335 Introduction to Programming in Python
OBJECTIVE ASSESSMENT ACTUAL EXAM 2025/2026
QUESTIONS WITH VERIFIED CORRECT SOLUTIONS ||
100% GUARANTEED PASS <BRAND NEW VERSION>
WGU D335 Python Practice Exam

1. What is the output of the following code?

python

x=5

y=2

result = x // y

print(result)

A) 2.5
B) 2 ✓
C) 3
D) 2.0

2. Which data type is mutable in Python?
A) int
B) str
C) tuple
D) list ✓

3. What keyword is used to define a function in Python?
A) func
B) define
C) def ✓
D) function

4. What will print(type(10.0)) output?
A) <class 'int'>
B) <class 'float'> ✓
C) <class 'double'>
D) <class 'number'>

,5. Which of the following is a valid variable name?
A) 2nd_var
B) my-variable
C) _my_var ✓
D) global

6. What does the append() method do?
A) Adds an element to the beginning of a list.
B) Adds an element to the end of a list. ✓
C) Removes the last element of a list.
D) Sorts the list in ascending order.

7. How do you start a single-line comment in Python?
A) //
B) /*
C) # ✓
D) --

8. What is the result of "hello" + "world"?
A) hello world
B) helloworld ✓
C) "hello"+"world"
D) An error

9. Which operator is used for exponentiation?
A) ^
B) ** ✓
C) //
D) %

10. What is the purpose of the if __name__ == "__main__": statement?
A) To ensure a script runs only if it is the main program being executed. ✓
B) To define the main function of a program.
C) To check if the user is running Python 3.
D) To import a module safely.

11. What does the open() function's 'w' mode do?
A) Opens a file for reading.
B) Opens a file for appending.

,C) Opens a file for writing (truncates the file first). ✓
D) Opens a file for both reading and writing.

12. Which collection is unordered and does not allow duplicate elements?
A) List
B) Tuple
C) Set ✓
D) Dictionary

13. What is the output?

python

my_list = [1, 2, 3, 4]

print(my_list[1:3])

A) [1, 2]
B) [2, 3] ✓
C) [1, 2, 3]
D) [2, 3, 4]

14. How do you create a tuple with a single element?
A) t = (1)
B) t = 1,
C) t = (1,) ✓
D) t = tuple(1)

15. What keyword is used to handle exceptions?
A) catch
B) throw
C) try and except ✓
D) error

16. What will the following code print?

python

for i in range(3):

print(i, end=' ')

A) 0 1 2 ✓
B) 1 2 3

, C) 0 1 2 3
D) 1 2

17. Which method is used to remove a key-value pair from a dictionary?
A) remove()
B) pop() ✓
C) delete()
D) discard()

18. What is the correct way to import only the sqrt function from the math module?
A) import math.sqrt
B) import sqrt from math
C) from math import sqrt ✓
D) from math sqrt

19. What is a correct example of a dictionary?
A) {1, 2, 3}
B) [1: 'a', 2: 'b']
C) {'name': 'Alice', 'age': 30} ✓
D) ('a', 'b', 'c')

20. What does the strip() method do for a string?
A) Splits the string into a list.
B) Removes leading and trailing whitespace. ✓
C) Converts the string to uppercase.
D) Reverses the string.

21. What is the output of bool("False")?
A) False
B) True ✓
C) None
D) An error

22. Which of these is a valid f-string?
A) f"My name is {name}" ✓
B) "fMy name is {name}"
C) f"My name is (name)"
D) "My name is f{name}"

23. What is the scope of a variable defined inside a function?
A) Global

Document information

Uploaded on
November 22, 2025
Number of pages
54
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$11.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TrustedExaminer
4.0
(9)
Sold
83
Followers
4
Items
3656
Last sold
15 hours ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions