Gce Model Questions Vol1 2024 Computer Studies Question 8

Practice essay / theory question 8 from the 2024 Gce Model Questions Vol1 Computer Studies examination. This question covers Python Programming, File Input/Output, Algorithms, Error Handling, Complexity Analysis .

Gce Model Questions Vol1 2024 Computer Studies Essay / Theory
Topics: Python Programming File Input/Output Algorithms Error Handling Complexity Analysis
Question 8 GCE_MODEL_QUESTIONS_VOL1 • 2024 • COMPUTER_STUDIES • essay

You are required to develop a small Python utility that analyses a text file containing the raw marks of students in a single subject. Each line of the file holds one mark (an integer between 0 and 100). The file may contain blank lines or lines with non‑numeric characters due to data‑entry errors. Answer the following:

Question Parts

( a )
Write a Python function `compute_stats(filename)` that reads the file, ignores blank lines, skips any non‑numeric entries, and returns a tuple containing (i) the arithmetic mean, (ii) the median, and (iii) the population standard deviation of the valid marks. Do **not** use any external libraries such as `statistics` or `numpy`.
( b )
Explain how you would modify the function so that it records the line numbers of all invalid entries and reports them to the user after processing the file.
( c )
Using the function from part (a), write a short program that reads a file named `scores.txt`, prints the mean, median and standard deviation, and then prints a grade report. The grading scale is: A ≥ 70, B = 60‑69, C = 50‑59, D = 40‑49, F < 40. The report should list each valid mark together with its corresponding grade. Include error handling for the case where `scores.txt` cannot be opened.
( d )
Analyse the time complexity of your solution (including the function and the reporting program). Suggest one improvement that could reduce the overall running time or memory usage.

Detailed Solution & Marking Scheme

Get the step-by-step solution, key points required by examiners and detailed marking guidance through the Edcrib AI Tutor.

Reveal Answer

About This Question

This is Gce Model Questions Vol1 2024 Computer Studies Question 8. It is one of the essay questions from the 2024 Gce Model Questions Vol1 Computer Studies examination.

The question covers Python Programming, File Input/Output, Algorithms, Error Handling, Complexity Analysis .

Master the Exam!

You've seen a preview, but there are thousands more questions plus AI tutor to break down complex solutions.

Unlock Full Access Available for Android & Windows
Chat with Support