Level:
Correct: 0
Incorrect: 0
Marks: 0/0
Exam Practice
Course:
Topics:
OCR GCSE Computer Science (Paper 2) Smart practice A mixed round aimed at your weak spots
Unit 1
Algorithms
Unit 2
Programming fundamentals
Unit 3
Producing robust programs
Unit 4
Boolean logic
Unit 5
Programming languages and IDEs
Unit 6
Practical programming (Section B)
Avg
score:
–
Topics
done:
0/31

Test data and test plans

Practise 29 exam-style questions on Test data and test plans for OCR GCSE Computer Science (Paper 2). Write your answer as you would in the exam and get it marked in seconds against the mark scheme, point by point, with the Study Helper on hand if you get stuck.

  • 29 questions
  • 1–6 marks each
  • Instant marking
  • No sign-up needed
20 questions, marked as you go

Sample questions with model answers

Here are 4 of the questions in this topic, each with a model answer, an explanation of why it earns the marks and the mark scheme an examiner would use.

Question 1

1 mark

Describe what is meant by normal test data.

Model answer

Normal test data is typical data that the program should accept and process without causing any errors.

Explanation

Normal data checks that the program works for the everyday values it was designed for, such as 25 for a range of 1 to 50. It is the first kind of data in most test plans, but testing with normal data alone is not enough: boundary, invalid and erroneous data are also needed.

Mark scheme
  1. 1 mark

    Data that should be accepted by the program (without causing errors)

    Accept 'typical data of the correct type, within the valid range, that the program should process correctly'. Do not accept 'data that is normal' or 'ordinary data' without saying it should be accepted.

Question 2

2 marks

A menu asks the user to choose option 1, 2, 3 or 4 by entering a whole number.

Give one example of invalid test data and one example of erroneous test data for this menu.

Model answer

Invalid: 7
Erroneous: two

Explanation

7 is the correct data type (a whole number) but is not one of the menu options, so it is invalid. The word two is the wrong data type, so it is erroneous. Both should be rejected, ideally with a message asking the user to choose again.

Mark scheme
  1. 1 mark

    Invalid: a whole number that is not 1 to 4, e.g. 7 / 0 / -1 / 5

    0 and 5 are accepted here (they are rejected whole numbers; OCR also treats them as boundary data).

  2. 1 mark

    Erroneous: data of the wrong type, e.g. two / A / 2.5

Question 3

4 marks

A party booking program asks for the number of guests, a whole number from 2 to 30 inclusive.

Give one example of each of these types of test data for this program: normal, boundary, invalid and erroneous.

Model answer

Normal: 15
Boundary: 30
Invalid: 45
Erroneous: ten

Explanation

Normal data is a typical value that should be accepted, such as 15. Boundary data is on the edge of the range: 2 or 30 (OCR also accepts 1 or 31). Invalid data is a whole number outside the range, such as 45, and erroneous data is the wrong type, such as the word ten or a decimal like 12.5.

Mark scheme
  1. 1 mark

    Normal: a whole number from 3 to 29, e.g. 15

    If the same value is given for two types, award it only for the first. Do not accept 2 or 30 as normal (they are boundary data).

  2. 1 mark

    Boundary: 2 or 30

    Also accept 1 or 31 (the first invalid value at each end).

  3. 1 mark

    Invalid: a whole number less than 2 or greater than 30, e.g. 0 / 45 / -3

    Accept 1 or 31.

  4. 1 mark

    Erroneous: data of the wrong type, e.g. ten / abc / 12.5

Question 4

4 marks

A restaurant charges £8.50 per seat for a booking. This program calculates the cost of a booking:

seats = int(input("How many seats (1 to 6)?"))
cost = seats * 8.5
print("Cost: " + str(cost))

When it was tested with the invalid test data 9, it output Cost: 76.5 instead of rejecting the value.

Refine the program so that it keeps asking for the number of seats until a whole number from 1 to 6 is entered, then calculates and outputs the cost. Write your program using OCR Exam Reference Language or a high-level programming language.

Model answer

seats = int(input("How many seats (1 to 6)?"))
while seats < 1 OR seats > 6
    print("Please enter a number from 1 to 6")
    seats = int(input("How many seats (1 to 6)?"))
endwhile
cost = seats * 8.5
print("Cost: " + str(cost))

Explanation

Refining a program after testing means changing it to fix the problems the tests found. Here a validation loop keeps asking until the input is in range, so 9 is rejected and the user is asked again. After refining, the programmer should re-run the tests: 9 and 0 should now be rejected and 1, 3 and 6 accepted (3 seats gives Cost: 25.5).

Mark scheme
  1. 1 mark

    Uses a loop that repeats while the number of seats is invalid / until it is valid

    Answers must be in OCR Exam Reference Language or a high-level programming language (e.g. Python); pseudocode, natural English or bullet points score 0. Ignore minor syntax errors. Accept a while loop or a do ... until loop. A missing int() cast on the input is a minor slip and is not penalised in any mark point.

  2. 1 mark

    The condition accepts exactly 1 to 6 (e.g. seats < 1 OR seats > 6 to repeat // seats >= 1 AND seats <= 6 to stop)

    Check the boundaries: 1 and 6 must be accepted, 0 and 7 rejected.

  3. 1 mark

    Inputs the number of seats again inside the loop

  4. 1 mark

    Calculates and outputs the cost only after a valid number has been entered (after the loop)

Ready to try the rest? Every answer you write is marked against the mark scheme, so you can see exactly where the marks are.

Study Helper Hints first, answers after you try

Stuck on this one? Ask for a hint and I’ll point you in the right direction, without giving the answer away. Once you’ve checked your answer, I’ll show you how the marks are awarded.