• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 40 pages
Exam (elaborations)

WGU D335 Intro to Python – PACKAGE DEAL – Complete Solutions for OA and PA – 2025/2026 Edition

Document preview thumbnail
Preview 4 out of 40 pages

WGU D335 Intro to Python – PACKAGE DEAL – Complete Solutions for OA and PA – 2025/2026 Edition

Content preview

WGU D335 Intro to Python – PACKAGE DEAL –
Complete Solutions for OA and PA –
2025/2026 Edition
Section 1: Python Basics (Q1–Q25)
1. Which of the following is a valid variable name in Python?
A. 2nd_variable
B. my-variable
C. my_variable
D. class
Answer: C
Rationale: Variable names must start with a letter or underscore, cannot contain
hyphens, and cannot be reserved keywords like class. my_variable follows all
rules.
2. What data type is the result of in Python 3?
A. int
B. float
C. str
D. bool
Answer: B
Rationale: The / operator always returns a float in Python 3, even if the result is a
whole number. yields 1.5.
3. What is the output of print(2 ** 3)?
A. 6
B. 8
C. 9
D. 5
Answer: B
Rationale: ** is the exponentiation operator. 2 ** 3 means 2 raised to the power
of 3, which equals 8.

,4. Which of the following is NOT a valid Python data type?
A. list
B. tuple
C. array
D. dictionary
Answer: C
Rationale: array is not a built-in Python data type (though it exists in the array
module). Built-in types include list, tuple, dict, set, etc.
5. What is the result of 10 // 3?
A. 3.33
B. 3
C. 4
D. 3.0
Answer: B
Rationale: // is floor division. It returns the integer quotient, discarding any
remainder. 10 // 3 equals 3.
6. Which operator is used for string concatenation?
A. +
B. *
C. &
D. .
Answer: A
Rationale: The + operator concatenates strings, e.g., "Hello" + "World" yields
"HelloWorld".
7. What is the output of print(type(5))?
A. <class 'int'>
B. <class 'float'>
C. <class 'str'>
D. <class 'bool'>
Answer: A
Rationale: 5 is an integer, so type(5) returns <class 'int'>.

,8. Which of the following is used to take input from the user in Python?
A. input()
B. get()
C. read()
D. scan()
Answer: A
Rationale: The input() function reads a line from the user and returns it as a
string.
9. What is the value of x after x = int("10") + 5?
A. 15
B. "105"
C. 105
D. Error
Answer: A
Rationale: int("10") converts the string to integer 10. 10 + 5 = 15.
10. Which of the following is an immutable data type?
A. list
B. dictionary
C. set
D. tuple
Answer: D
Rationale: Tuples are immutable; once created, their elements cannot be
changed. Lists, dictionaries, and sets are mutable.
11. What does the bool data type represent?
A. Only True
B. Only False
C. True or False
D. 0 or 1
Answer: C
Rationale: The bool type has two values: True and False. It is a subclass of int,
where True=1 and False=0.

, 12. What is the output of print(5 == 5.0)?
A. True
B. False
C. Error
D. None
Answer: A
Rationale: Python considers 5 and 5.0 equal in value, so == returns True.
13. Which of the following converts a string to an integer?
A. str()
B. int()
C. float()
D. chr()
Answer: B
Rationale: int() converts a string or float to an integer, e.g., int("42") returns 42.
14. What is the result of len("Python")?
A. 5
B. 6
C. 7
D. Error
Answer: B
Rationale: len() returns the number of characters in a string. "Python" has 6
characters.
15. Which of the following is used for comments in Python?
A. //
B. /* */
C. #
D. --
Answer: C
Rationale: The # symbol starts a single-line comment in Python.
16. What is the output of print(10 % 3)?
A. 1

Document information

Uploaded on
October 7, 2026
Number of pages
40
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$29.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

Sold
0
Followers
0
Items
81
Last sold
-



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