Skip to content

Course home

Defensive design

Defensive design

EasyMedium
12345678910
Question 4

The program should only allow game scores from 1 to 1000 inclusive as valid inputs. If the data entered breaks this validation rule, an error message is displayed.

Complete the following program to output "Error: Out of range" if the data does not meet the validation rule.

You must use either:

  • OCR Exam Reference Language, or
  • a high-level programming language that you have studied.
score = input("Enter your final score: ")

if score < 1 ..... score ..... then
    ..... ("Error: Out of range")
endif
[3]
Markscheme

Defensive design Questions

  1. GCSE
  2. /Computer Science
  3. /Defensive design

14 exam-style questions on OCR GCSE Computer Science Defensive design. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank