WGU D335 OBJECTIVE ASSESSMENT AND PRE-
ASSESSMENT NEWEST 2025 TEST BANK| D335
INTRODUCTION TO PROGRAMMING IN PYTHON
FINAL EXAM PREP WITH COMPLETE 300 REAL
EXAM QUESTIONS AND CORRECT VERIFIED
ANSWERS/ GRADED A+ (MOST RECENT!!)
A(n) _____ is the part of a program in which a variable may be
accessed.
A. declaration space
B. area of visibility
C. scope
D. mode – Correct Answer - C
A(n) _____ is a piece of data that is sent into a function.
A. argument
B. parameter
C. header
D. packet – Correct Answer - A
A(n) ____ is a special variable that receives a piece of data when a
function is called.
A. argument
pg. 1
,2|Page
B. parameter
C. header
D. packet – Correct Answer - B
A variable that is visible to every function in a program file is a .
A. local variable
B. universal variable
C. program-wide variable
D. global variable – Correct Answer - D
When possible, you should avoid using _____ variables in a program.
A. local
B. global
C. reference
D. parameter – Correct Answer - B
This is a prewritten function that is built into a programming language.
A. standard function
B. library function
C. custom function
D. cafeteria function – Correct Answer - B
pg. 2
,3|Page
This standard library function returns a random integer within a
specified range of values.
A. random
B. randint
C. random_integer
D. uniform – Correct Answer - B
This type of function returns either True or False.
A. Binary
B. true_false
C. Boolean
D. logical – Correct Answer - C
Create a solution that accepts an integer input identifying how many
shares of stock are to be purchased from the Old Town Stock Exchange,
followed by an equivalent number of string inputs representing the stock
selections. The following dictionary stock lists available stock selections
as the key with the cost per selection as the value.
stocks = {'TSLA': 912.86 , 'BBBY': 24.84, 'AAPL': 174.26, 'SOFI': 6.92,
'KIRK': 8.72, 'AURA': 22.12, 'AMZN': 141.28, 'EMBK': 12.29, 'LVLU':
2.33}
Output the total cost of the purchased shares of stock to two decimal
places.
The solution output should be in the format
pg. 3
, 4|Page
Total price: $cost_of_stocks - ANSWER - num_stock = int(input())
cost_of_stocks = 0
for _ in range(num_stock):
stock_selection = input()
if stock_selection in stocks:
cost_of_stocks += stocks[stock_selection]
print(f"Total price: ${cost_of_stocks:.2f}")
When an exception is generated, it is said to have been .
A. built
B. raised
C. caught
D. killed – Correct Answer - B
This is a section of code that gracefully responds to exceptions.
A. exception generator
B. exception manipulator
C. exception handler
D. exception monitor – Correct Answer - C
You write this statement to respond to exceptions.
A. run/handle
pg. 4