← IGCSE Computer Science Paper 2

Meaningful identifiers for arrays, procedures and functions

Each word starts with a capital. Name arrays with nouns (StudentNames); name functions and procedures with verbs (CalculateTotal, DisplayMenu) to show what they store or do.

Understanding Meaningful identifiers for arrays, procedures and functions in IGCSE Computer Science Paper 2

What it does: DisplayMenu begins with the verb Display and each word is capitalised, so the name shows what the procedure does. ExamScores is a noun phrase in PascalCase, so it describes the data stored in the array. Arrays hold data, so they are named with nouns. Verbs are for procedures and functions, which perform actions.

Common mistakes: The array name x says nothing about what it stores. Arrays should have descriptive PascalCase noun names, so this line should use StudentNames[2]. The identifier is all lower case, so the words are hard to read. PascalCase starts each word with a capital: DisplayMenu.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 347–357) and word search (Modules 337–357).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which is the better identifier for an array that stores student names?
StudentNamesx
Matches
DECLARE x : ARRAY[1:30] OF STRING
↓
The array name x is meaningless. It should be a descriptive PascalCase noun such as StudentNames.
Applying
Meanings
Term
PascalCase
Meaning
Each word starts with a capital. Name arrays with nouns (StudentNames); name functions and procedures with verbs (CalculateTotal, DisplayMenu) to show what they store or do.
Practice
DECLARE StudentNames : ARRAY[1:30] OF STRING
Testing
Gaps
DECLARE : ARRAY[1:30] OF STRING
Check Answer
Spots
1StudentNames[1] ← "Ava"
2x[2] ← "Liam"

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Seahorse' badge — Range Rider, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which is the better identifier for an array that stores student names?
A. StudentNames ✓
B. x
An array stores data, so use a descriptive PascalCase noun such as StudentNames. A single letter like x says nothing about what is stored.
2. Which is the better name for a function that works out a total?
A. Total_stuff
B. CalculateTotal ✓
Functions do something, so start with a verb. CalculateTotal is PascalCase and clear about what the function does.
3. Which is the better name for a procedure that shows a menu on screen?
A. p1
B. DisplayMenu ✓
DisplayMenu is a verb plus a noun in PascalCase, so it shows the action. p1 gives no clue about what the procedure does.
4. Which statement about naming arrays is correct?
A. Use a noun that describes the data stored, e.g. StudentNames ✓
B. Use a verb that describes an action, e.g. FillNames
Arrays hold data, so they are named with nouns. Verbs are for procedures and functions, which perform actions.
5. Which statement about naming procedures and functions is correct?
A. Start with a verb to show the action, e.g. DisplayMenu ✓
B. Use a noun for the data, e.g. MenuList
Procedures and functions do things, so a verb such as Display or Calculate makes their purpose clear. Nouns are for data.

Match the Pairs

StudentNames → A good array identifier: a PascalCase noun that shows the array stores a list of student names
CalculateTotal → A good function identifier: a PascalCase verb phrase that shows the function works out a total
A procedure that shows a menu on screen should have a verb-based PascalCase name → PROCEDURE DisplayMenu()
An array holding exam scores should be named with a noun in PascalCase → DECLARE ExamScores : ARRAY[1:30] OF INTEGER
DECLARE x : ARRAY[1:30] OF STRING → The array name x is meaningless. It should be a descriptive PascalCase noun such as StudentNames.
FUNCTION total(Price : REAL) RETURNS REAL → The function name is a lowercase noun. It should be a PascalCase verb phrase such as CalculateTotal.

Key Term

PascalCase
Each word starts with a capital. Name arrays with nouns (StudentNames); name functions and procedures with verbs (CalculateTotal, DisplayMenu) to show what they store or do.

Fill in the Blanks

1. DECLARE StudentNames : ARRAY[1:30] OF STRING
Hint: Type a PascalCase noun that names the array holding many student names.
2. PROCEDURE DisplayMenu() OUTPUT "1. Start" ENDPROCEDURE
Hint: Type the PascalCase procedure name. It starts with a verb and says what the procedure does with the menu.
3. Total ← CalculateTotal(Price, Qty)
Hint: Type the PascalCase function name, a verb phrase for working out a total, to call it.
4. CALL DisplayMenu() INPUT Choice
Hint: Type the name of the procedure being called. It is a verb followed by a noun and shows the menu.
5. FUNCTION CalculateTotal() RETURNS REAL RETURN Price * Qty ENDFUNCTION
Hint: Type the PascalCase function name. It starts with a verb and matches the calculation the function performs.

Spot the Error

Question 1
A StudentNames[1] ← "Ava"
B x[2] ← "Liam"
C OUTPUT StudentNames[1]
Line B — The array name x says nothing about what it stores. Arrays should have descriptive PascalCase noun names, so this line should use StudentNames[2].
Question 2
A PROCEDURE displaymenu()
B OUTPUT "1. Play"
C OUTPUT "2. Quit"
D ENDPROCEDURE
Line A — The identifier is all lower case, so the words are hard to read. PascalCase starts each word with a capital: DisplayMenu.
Question 3
A Price ← 12.5
B // Work out the total cost
C Total ← Maths(Price)
D OUTPUT Total
Line C — Maths is a vague noun that does not say what the function does. Functions should have verb names such as CalculateTotal.
Question 4
A GetScores[1] ← 78
B ExamScores[2] ← 91
C OUTPUT ExamScores[2]
Line A — GetScores is a verb, which suggests an action. An array stores data, so it needs a noun name such as ExamScores.
Question 5
A PROCEDURE DisplayMenu()
B OUTPUT "1. Play"
C ENDPROCEDURE
D CALL Menu()
Line D — Menu is a noun and does not match the procedure that was declared. The procedure is named with a verb, DisplayMenu, so the call should be CALL DisplayMenu().

Student with a class code? Join your class →