Skip to content

Course home

Sign up

Data types and structures

EasyMedium
12345678910111213141516171819202122232425262728293031323334
Question 31

Programmers often use uppercase letters to represent a constant value in their code.

An example of a constant is shown on line 3 in the following code snippet:

2 # Settings for the cloud storage application
3 MAX_FILE_SIZE = 50        # Maximum allowed file size in MB
4
5 current_file_size = 12    # Size of the current file being uploaded

Explain one reason why a programmer would use a named constant like MAX_FILE_SIZE instead of repeating the literal value 50 throughout their program.

[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