














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
WGU E010 Foundations of Programming (Python) 2026 Practice Assessment
Typology: Exams
1 / 22
This page cannot be seen from the preview
Don't miss anything!















1. Which symbol begins a single-line comment in Python? A. // B. # C. * D. % Answer: B. # Rationale: Python uses # for single-line comments. 2. What data type is 3.14? A. Integer B. Float C. String D. Boolean Answer: B. Float Rationale: Numbers with decimals are floats. 3. What follows the in keyword in a for loop? A. Condition B. Iterable C. Number D. Function Answer: B. Iterable Rationale: Loops iterate over lists, strings, etc. 4. Which loop is used when the number of iterations is known? A. while B. for C. infinite D. do-while Answer: B. for Rationale: for loops iterate a fixed number of times.
5. A while loop requires: A. Variable only B. Condition + indented block C. Break statement D. List Answer: B. Condition + indented block Rationale: Loop runs while condition is True. 6. Which keyword exits a loop early? A. stop B. break C. return D. exit Answer: B. break Rationale: break terminates loop immediately. 7. In for item in list, item is: A. Index B. Value C. Length D. List Answer: B. Value Rationale: Iterates over elements. 8. Which structure prevents duplicates? A. List B. Tuple C. Dictionary D. Set Answer: D. Set Rationale: Sets store unique values only. 9. Which is immutable? A. List B. Dict
Answer: B Rationale: Python shell executes line-by-line.
14. Slice last 3 characters: A. [:3] B. [3:] C. [-3:] D. [:-3] Answer: C Rationale: Negative slicing starts from end. 15. .find("python") index in "learning python": A. 8 B. 9 C. 10 D. 7 Answer: B Rationale: Starts at index 9. 16. Which adds element to list? A. add() B. insert() C. append() D. push() Answer: C Rationale: .append() adds to end. 17. Dictionary update syntax: A. dict.add() B. dict[key] = value C. dict.insert() D. dict.append() Answer: B Rationale: Assign value using key.
18. Correct loop: A. for i with list B. for i in list C. for i from list D. for i = list **Answer: B
Answer: B
28. Even number check fix: A. return True B. return False C. return number%2== D. pass **Answer: C
Answer: B
33. Boolean values are: A. 1/ B. Yes/No C. True/False D. T/F **Answer: C
42. String concatenation uses: A. + B. * C. & D. % **Answer: A
47. Logical OR operator: A. || B. or C. | D. // **Answer: B
A. Division B. Modulus C. Floor division D. Power Answer: C Rationale: Returns integer division result.
57. Modulus operator is: A. / B. % C. // D. ** **Answer: B
61. pop() returns: A. Nothing B. Removed item C. Index D. Boolean **Answer: B
C. dict.insert() D. dict.append() Answer: B
71. Check key existence: A. key in dict B. key.exists() C. dict.has(key) D. dict.check() **Answer: A
A. int B. str C. None D. bool Answer: C
76. Keyword for optional loop skip: A. break B. skip C. continue D. pass **Answer: C
85. Boolean AND truth: A. Both True B. One True C. Both False D. Either **Answer: A
Answer: A
90. Argument is: A. Function name B. Passed value C. Loop variable D. Condition **Answer: B