with Correct Answers (Verified Update)
165 questions with answers
Topic: WGU D335 Python Programming Exam
1. Student Identification Number
Answer: A 9-digit unformatted integer input representing a student's ID.
2. Formatted Student ID Output
Answer: The output format for the student ID is <ssn>.
3. Input Validation The student ID must be between 100000000 for Student ID
Answer: and 999999999.
4. Formatted ID The formatted ID is constructed Construction
Answer: using parts derived from the student ID.
5. Predefined List A list containing
Answer: the values [4, -27, 15, 33, -10].
6. Boolean Value Output
Answer: Indicates whether the input value is greater than the maximum value from
predef_list.
7. is calculated using the max() function.
Answer: Max Value Calcu- The maximum value from predef_list lation
8. Frameworks List A list of web frameworks: Gears'].
Answer: ['Django', 'Flask', 'CherryPy', 'Bottle', 'Web2Py', 'Turbo-
9. Index Value In- An integer input representing put
Answer: the index of a string element in the frameworks list.
10. Exception Han- A try block that raises an 'Error' for incompatible dling
Answer: integer inputs.
11. Water Temperature Input
Answer: An integer input representing water temperature in degrees Fahrenheit.
12. Water State De- Describes the state of water based on temperature scription
Answer: ranges.
13. Frozen Water State
Answer: Water is 'Frozen' if the temperature is below 33° F.
14. is between 33° F and 80° F.
Answer: Cold Water State Water is 'Cold' if the temperature
15. Warm Water State
Answer: Water is 'Warm' if the temperature is between 80° F and 115° F.
16. is between 115° F and 211° F.
Answer: Hot Water State Water is 'Hot' if the temperature
Page 1
, 17. Boiling Water State
Answer: Water is 'Boiling' if the temperature is greater than or equal to 212° F.
18. water_state
Answer: Describes the state of water based on temperature.
19. optional_safety_comment
Answer: Safety comment displayed based on specific water temperatures.
20. temperature
Answer: The current temperature of the water.
21. Frozen
Answer: State of water when temperature is less than 33° F.
22. Cold
Answer: State of water when temperature is between 33° F and 80° F.
23. Warm
Answer: State of water when temperature is between 80° F and 115° F.
24. Hot
Answer: State of water when temperature is between 115° F and 212° F.
25. Boiling
Answer: State of water when temperature is 212° F or higher.
26. Caution: Hot!
Answer: Safety comment displayed when water temperature is exactly 212° F.
27. is less than 33° F.
Answer: Watch out for ice! Safety comment displayed when water temperature
28. Reverse Binary
Answer: Representing an integer in reverse binary by outputting remainders of division by
2.
29. __name__ == '__main__'
Answer: Used to separate the main code from the function's code for unit testing.
30. Driving Cost Function
Answer: Function taking miles per gallon, price per gallon, and miles driven to return the
dollar cost.
31. Coin Flip Function
Answer: Function returning 'Heads' or 'Tails' based on a random value of 1 or 0.
32. Unit Tests
Answer: Testing small parts of a program in an isolated manner to ensure they work as
expected.
33. Unit test
Answer: Evaluates individual functions for correctness and proper naming, parameters, and
return type.
Page 2