Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Meaningful identifiers for arrays, procedures and functions worksheet is part of the IGCSE Computer Science 0478 — 8.1a Data Types and Variables journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1StudentNames | APROCEDURE DisplayMenu() | |
| 2CalculateTotal | BA good array identifier: a PascalCase noun that shows the array stores a list of student names | |
| 3A procedure that shows a menu on screen should have a verb-based PascalCase name | CThe function name is a lowercase noun. It should be a PascalCase verb phrase such as CalculateTotal. | |
| 4An array holding exam scores should be named with a noun in PascalCase | DThe array name x is meaningless. It should be a descriptive PascalCase noun such as StudentNames. | |
| 5DECLARE x : ARRAY[1:30] OF STRING | EDECLARE ExamScores : ARRAY[1:30] OF INTEGER | |
| 6FUNCTION total(Price : REAL) RETURNS REAL | FA good function identifier: a PascalCase verb phrase that shows the function works out a total |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
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.DECLARE StudentNames : ARRAY[1:30] OF STRINGPROCEDURE DisplayMenu()
OUTPUT "1. Start"
ENDPROCEDURETotal ← CalculateTotal(Price, Qty)CALL DisplayMenu()
INPUT ChoiceFUNCTION CalculateTotal() RETURNS REAL
RETURN Price * Qty
ENDFUNCTION