Skip to content

Course home

Defensive design

Defensive design

EasyMedium
1234
Question 3

An automated climate control system should only accept target temperature settings from 15 to 30 inclusive as valid inputs. If the user input violates this validation rule, an error message is displayed.

Complete the following pseudo-code program to output "Error: Temperature out of range" if the entered temperature does not meet the validation criteria.

You must use either:

  • OCR Exam Reference Language, or
  • a high-level programming language that you have studied.
target_temp = input("Enter target temperature in Celsius: ")

if target_temp < 15 ..... target_temp ..... then
    ..... ("Error: Temperature 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