0% found this document useful (0 votes)
9 views3 pages

Python Simulated Final Exam Set2 Answers

The document provides the answer key and marking scheme for a Python simulated final exam, totaling 100 marks. It includes multiple choice questions, code reading tasks, programming tasks, and a comprehensive task involving a book management system. Each section specifies the marks allocated and the expected answers or implementations.

Uploaded by

nii zelia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Python Simulated Final Exam Set2 Answers

The document provides the answer key and marking scheme for a Python simulated final exam, totaling 100 marks. It includes multiple choice questions, code reading tasks, programming tasks, and a comprehensive task involving a book management system. Each section specifies the marks allocated and the expected answers or implementations.

Uploaded by

nii zelia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python Simulated Final Exam – Set 2:

Answer Key & Marking Scheme


Total Marks: 100

Part I: Multiple Choice Answers (2 marks each, Total: 40 marks)


1. B

2. C

3. B

4. C

5. B

6. C

7. A

8. A

9. C

10. D

11. A

12. C

13. C

14. C

15. B

16. B

17. B

18. A

19. C

20. A
Part II: Code Reading (4 marks each, Total: 12 marks)
1. [1, 3] — removes the element 2 from the list.

2. True — one condition is true so 'or' yields True.

3. 7 — function adds two integers and returns result.

Part III: Programming Tasks (11 marks each, Total: 33 marks)


1.

def min_max(lst):
return max(lst), min(lst)

2.

def count_vowels(text):
count = 0
for ch in [Link]():
if ch in 'aeiou':
count += 1
return count

3.

def input_sum():
total = 0
while True:
n = int(input("Enter a number: "))
if n < 0:
break
total += n
print("Total:", total)

Part IV: Comprehensive Task (15 marks)


Sample implementation:

books = {}

while True:
action = input("add/show/search/exit: ")
if action == "add":
title = input("Title: ")
author = input("Author: ")
books[title] = author
elif action == "show":
for t, a in [Link]():
print(f"{t} by {a}")
elif action == "search":
title = input("Enter title: ")
print([Link](title, "Book not found."))
elif action == "exit":
break

You might also like