Questions with Solutions Newest Already Graded
WGU E010 Foundations of Programming (Python) Objective Assessment
120 Multiple-Choice Practice Questions with Answers & Rationales
Section 1: Basic Syntax & Data Types (Questions 1-20)
Question 1
What is the output of print(type(10/2))?
A) int
B) float
C) double
D) str
Answer: B
Rationale: In Python, the / operator performs true division and always returns a
float, even when the numbers divide evenly. 10/2 = 5.0, so type(5.0) is float .
Question 2
,Which of the following data types is immutable?
A) list
B) dict
C) set
D) tuple
Answer: D
Rationale: A tuple cannot be changed after creation (immutable), while lists,
dictionaries, and sets are mutable and can be modified .
Question 3
What will the following code print?
python
x = "Hello"
print(x[1])
A) H
B) e
,C) l
D) o
Answer: B
Rationale: String indexing starts at 0 in Python. x[0] = 'H', x[1] = 'e', so the output
is 'e' .
Question 4
What is the output of print(2 ** 3)?
A) 6
B) 8
C) 9
D) 5
Answer: B
Rationale: The ** operator is the exponentiation operator. 2 ** 3 means 2 raised
to the power of 3, which equals 8 .
Question 5
, Which type of loop is best used when the number of iterations is unknown?
A) for loop
B) while loop
C) nested loop
D) for-each loop
Answer: B
Rationale: A while loop runs until a condition becomes False, making it ideal when
the number of iterations is not known in advance .
Question 6
What does the break statement do in a loop?
A) Skips the current iteration
B) Exits the loop completely
C) Restarts the loop from the beginning
D) Pauses the loop temporarily