WGU E010 Objective Assessment 2
Foundations of Programming Python
2026/2027 – Questions and Answers |
100% Verified | Detailed Rationales –
Pass Guaranteed – A+ Graded
Question 1: Data Types & Operations
What is the output of the following code?
python
x = "5"
y = 2
print(x * y)
A) 10
B) Error
C) "55"
D) "5 5"
Correct Answer: C) "55"
Rationale: In Python, the * operator, when used with a string and
an integer, performs repetition. The string "5" is repeated 2 times,
resulting in "55". This is different from arithmetic multiplication,
which would occur if both operands were numbers .
,Question 2: Control Flow
What is the output of the following code?
python
for i in range(1, 6, 2):
print(i, end=" ")
A) 1 2 3 4 5
B) 1 3 5
C) 2 4 6
D) 1 3 5 7
Correct Answer: B) 1 3 5
Rationale: The range(1, 6, 2) function generates a sequence
starting at 1, stopping before 6, and incrementing by a step of 2.
The values produced are 1, 3, and 5 .
Question 3: Functions & Scope
Which keyword is used to define a function in Python?
A) func
B) define
C) def
D) function
Correct Answer: C) def
,Rationale: The def keyword is the correct and only way to start a
function definition in Python. It is followed by the function name,
parentheses (), and a colon : .
Question 4: Loop Control
What does the continue statement do inside a loop in
Python?
A) Terminates the loop entirely
B) Skips the rest of the current iteration and moves to the next
one
C) Pauses the program
D) Restarts the loop from the beginning
Correct Answer: B) Skips the rest of the current iteration and
moves to the next one
Rationale: The continue statement immediately stops the
current iteration of the loop and jumps to the next iteration. It
does not exit the loop; that is the job of the break statement .
Question 5: Data Structures
Given the code for item in my_list:, what
does item represent?
, A) The index of the current element
B) The current element being processed
C) The length of the list
D) The entire list
Correct Answer: B) The current element being processed
Rationale: In a Python for loop, the variable (here item) is
assigned the value of each element in the iterable (here my_list)
one at a time, from the first to the last .
Question 6: Key Python Concepts
Which of the following is an immutable data type in Python?
A) list
B) dict
C) set
D) tuple
Correct Answer: D) tuple
Rationale: An immutable object cannot be changed after it is
created. Tuples are immutable. Lists (list), dictionaries (dict),
and sets (set) are all mutable, meaning their contents can be
modified .
Question 7: String Manipulation
Foundations of Programming Python
2026/2027 – Questions and Answers |
100% Verified | Detailed Rationales –
Pass Guaranteed – A+ Graded
Question 1: Data Types & Operations
What is the output of the following code?
python
x = "5"
y = 2
print(x * y)
A) 10
B) Error
C) "55"
D) "5 5"
Correct Answer: C) "55"
Rationale: In Python, the * operator, when used with a string and
an integer, performs repetition. The string "5" is repeated 2 times,
resulting in "55". This is different from arithmetic multiplication,
which would occur if both operands were numbers .
,Question 2: Control Flow
What is the output of the following code?
python
for i in range(1, 6, 2):
print(i, end=" ")
A) 1 2 3 4 5
B) 1 3 5
C) 2 4 6
D) 1 3 5 7
Correct Answer: B) 1 3 5
Rationale: The range(1, 6, 2) function generates a sequence
starting at 1, stopping before 6, and incrementing by a step of 2.
The values produced are 1, 3, and 5 .
Question 3: Functions & Scope
Which keyword is used to define a function in Python?
A) func
B) define
C) def
D) function
Correct Answer: C) def
,Rationale: The def keyword is the correct and only way to start a
function definition in Python. It is followed by the function name,
parentheses (), and a colon : .
Question 4: Loop Control
What does the continue statement do inside a loop in
Python?
A) Terminates the loop entirely
B) Skips the rest of the current iteration and moves to the next
one
C) Pauses the program
D) Restarts the loop from the beginning
Correct Answer: B) Skips the rest of the current iteration and
moves to the next one
Rationale: The continue statement immediately stops the
current iteration of the loop and jumps to the next iteration. It
does not exit the loop; that is the job of the break statement .
Question 5: Data Structures
Given the code for item in my_list:, what
does item represent?
, A) The index of the current element
B) The current element being processed
C) The length of the list
D) The entire list
Correct Answer: B) The current element being processed
Rationale: In a Python for loop, the variable (here item) is
assigned the value of each element in the iterable (here my_list)
one at a time, from the first to the last .
Question 6: Key Python Concepts
Which of the following is an immutable data type in Python?
A) list
B) dict
C) set
D) tuple
Correct Answer: D) tuple
Rationale: An immutable object cannot be changed after it is
created. Tuples are immutable. Lists (list), dictionaries (dict),
and sets (set) are all mutable, meaning their contents can be
modified .
Question 7: String Manipulation