Data types and structures

EasyMedium
1234567891011121314151617181920212223242526272829303132333435
Question 31
Easy

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]

Data types and structures Questions

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