Skip to content

Course home

Sign up

Data types and structures

EasyMedium
12345678910111213141516171819202122232425262728293031323334
Question 9

In computer programming, constant values are often defined at the top of a program using uppercase identifiers.

An example of this is shown on line 2 of the code snippet below:

1 # Automated Greenhouse Climate Control System
2 CRITICAL_TEMP_LIMIT = 38.5  # Critical temperature in degrees Celsius
3
4 current_zone_temp = 24.2     # Current temperature reading from sensor

Explain one reason why a developer should use the named constant CRITICAL_TEMP_LIMIT rather than writing the literal value 38.5 multiple times within the control system's codebase.

[2]
Markscheme

Data types and structures Questions

  1. GCSE
  2. /Computer Science
  3. /Data types and structures

44 exam-style questions on Edexcel GCSE Computer Science Data types and structures, covering Primitive and structured data types, Using variables and constants, and Manipulating strings. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank