WGU E010 Foundations of Programming
(Python) Practice Assessment Questions and
Answers Updated
Question 1
What must a developer do to run Python code written in a text editor?
Save the file and use a Python interpreter.
Press a run button within the editor.
Upload the code to a web server.
Convert the code to machine language first.
Correct Answer
Save the file and use a Python interpreter.
Question 2
Fix the missing return statement in this function that should return whether a number
is even.
def is_even(number):
if number % 2 == 0:
True
else:
False
Correct Answer
def is_even(number):
if number % 2 == 0:
return True
else:
return False
Page 1 of 13
, Question 3
Which keyword is used to exit a loop prematurely in Python?
return
break
stop
end
Correct Answer
break
Question 4
Which components are required in every Python while loop?
A condition and an indented code block
A variable and a return statement
A counter and a break statement
An iterator and a list
Correct Answer
A condition and an indented code block
Question 5
Which Python data structure automatically prevents duplicate values from being
stored?
List
Tuple
Dictionary
Set
Correct Answer
Set
Page 2 of 13
(Python) Practice Assessment Questions and
Answers Updated
Question 1
What must a developer do to run Python code written in a text editor?
Save the file and use a Python interpreter.
Press a run button within the editor.
Upload the code to a web server.
Convert the code to machine language first.
Correct Answer
Save the file and use a Python interpreter.
Question 2
Fix the missing return statement in this function that should return whether a number
is even.
def is_even(number):
if number % 2 == 0:
True
else:
False
Correct Answer
def is_even(number):
if number % 2 == 0:
return True
else:
return False
Page 1 of 13
, Question 3
Which keyword is used to exit a loop prematurely in Python?
return
break
stop
end
Correct Answer
break
Question 4
Which components are required in every Python while loop?
A condition and an indented code block
A variable and a return statement
A counter and a break statement
An iterator and a list
Correct Answer
A condition and an indented code block
Question 5
Which Python data structure automatically prevents duplicate values from being
stored?
List
Tuple
Dictionary
Set
Correct Answer
Set
Page 2 of 13