←

Problem solving and programming

From Paper 1: Principles of computer science
6(a)4 marks
Explain the purpose of each type of test: normal, boundary, erroneous and integration.
From Paper 1: Principles of computer science
6(b)2 marks
Explain the difference between a function and a procedure.
From Paper 1: Principles of computer science
6(c)6 marks
Write a Python function that takes a list of integers and returns the second-largest distinct value, or None if there is none.
From Paper 2: Application of computational thinking (practice version)
16 marks
The code below should print the average of the scores but contains errors.
def average(values):    total = 0    for i in range(1, len(values)):        total = total + values[i]    return total / len(values) scores = [12, 15, 9, 20]print("Average is " + average(scores))
Identify and correct three errors.
From Paper 2: Application of computational thinking (practice version)
28 marks
Using the data below, write a function clean(readings) that returns a new list without the -999 values, and a function stats(values) that returns the minimum, maximum and mean (rounded to 1 d.p.).
readings = [18.5, 19.2, 21.0, -999, 22.4, 23.1, 20.7, -999, 19.8, 18.9]# -999 means the sensor failed to record a value
From Paper 2: Application of computational thinking (practice version)
315 marks
Write a program that repeatedly asks a user to enter temperature readings (or 'done' to finish), validates each one (must be a number between −50 and 60), stores valid readings, and then outputs: the number of readings, the mean, and how many readings were above the mean. Use at least two functions.
From Paper 2: Application of computational thinking (practice version)
410 marks
Extend your program so that the valid readings are saved to a text file, one per line, and can be loaded again when the program next starts.
From Paper 2: Application of computational thinking (practice version)
68 marks
Write a recursive function that returns the sum of the digits of a positive integer (e.g. 4071 → 12) and explain how the base case prevents infinite recursion.
From Paper 2: Application of computational thinking (practice version)
88 marks
Evaluate the efficiency of your solutions to Questions 3 and 5. Suggest how they could be improved for a data set of 10 million readings.
Score 0 / 67 · 0 of 9 marked

This paper is written by Plasmo in the style of the Edexcel A-Level Computer Science exam. It is not a past paper and is not produced or endorsed by the exam board.

Problem solving and programming Exam Questions: Edexcel A-Level Computer Science | Plasmo