Cambridge 9618 Pseudocode Guide: Arrays, Functions, Procedures and 2D Arrays Explained
- H1: Cambridge 9618 Pseudocode Guide: Arrays, Functions, Procedures and 2D Arrays Explained
- H2: Why Cambridge 9618 Pseudocode Questions Can Be Tricky
- H2: Functions vs Procedures: Know What the Subroutine Returns
- H3: How to Call a Function Correctly
- H3: Why a Function Return Value Needs Somewhere to Go
- H2: Understanding Arrays Passed as Function Parameters
- H3: What the Size Parameter Actually Means
- H3: Why Array Indexes and Size Are Different
- H2: FOR vs REPEAT UNTIL: Choosing the Correct Loop
- H3: Why Size Minus One Matters
- H2: Cambridge Pseudocode Example: Doubling Every Array Value
- H3: Declaring vs Initializing the Loop Index
- H2: Understanding 2D Arrays in Cambridge 9618
- H3: Rows and Columns Explained
- H3: Why 2D Arrays Need Two Indexes
- H2: Nested Loops: Row-by-Row vs Column-by-Column
- H2: Cambridge Example: Creating a 5×5 Game Board
- H2: Writing Procedure Headers Correctly
- H2: BYVALUE vs BYREF and Custom Records
- H2: Common Cambridge 9618 Pseudocode Mistakes
- H2: Conclusion: Build Reliable Pseudocode Through Patterns
- H2: Cambridge 9618 Pseudocode FAQs
Cambridge 9618 Pseudocode Guide: Arrays, Functions, Procedures and 2D Arrays Explained
A Cambridge Computer Science pseudocode question can look deceptively simple. You may understand what an array is, know how a FOR loop works, and recognize the difference between a function and a procedure when someone explains it. Then a past-paper question asks you to combine all three concepts—and suddenly you're wondering where the returned array goes, whether you need CALL, what size represents, and whether your loop should end at size or size - 1.
That is precisely the kind of problem-solving explored in this Cambridge Computer Science tutoring session. The lesson works through exam-style questions involving functions that accept arrays, loops that modify array contents, two-dimensional arrays, procedure headers, records, and parameter passing.
What makes these questions challenging isn't always the underlying Computer Science. Often, the difficulty comes from combining several small rules correctly. You might know how to loop through an array but choose the wrong loop. You might know how to declare a 2D array but accidentally reference only one dimension. You might understand a function but call it as though it were a procedure.
Cambridge pseudocode becomes easier when you start recognizing these recurring patterns. Instead of memorizing one past-paper answer, you want to understand why the answer has that structure. Then, when the variable names, data types, or scenario change in another exam question, the underlying pattern still feels familiar.
Why Cambridge 9618 Pseudocode Questions Can Be Tricky
Pseudocode sits in an interesting place between natural language and a real programming language. It is structured enough that syntax matters, but the bigger challenge is usually demonstrating that you understand the algorithm.
Imagine a question telling you to write a function that accepts an integer array and its size, doubles every value, and returns the modified array.
That's one sentence.
Yet hidden inside it are several decisions.
You need a function, not merely a procedure, because something is returned. You need parameters for the array and size. You need to visit each array element, which suggests a loop. Because the size tells you how many elements need processing, a count-controlled loop becomes relevant. You need to modify each element individually. Finally, the modified array needs to be returned.
The tutoring session breaks this kind of problem down rather than treating it as one giant coding task. The student initially questioned how an array without an explicitly written limit could work, and the discussion connected the separate size parameter to the loop boundaries used to process the array.
That's a valuable exam habit: extract the information already supplied by the question before deciding what information you think is missing.
Functions vs Procedures: Know What the Subroutine Returns
One of the earliest concepts reviewed in the session is the difference between calling a procedure and using a function that returns a value.
This distinction matters enormously.
A function produces a result. If a sorting function receives an array and returns the sorted array, that returned result needs to be used appropriately. The transcript specifically discusses assigning the returned array to a variable capable of storing it.
Think of a function like ordering something from a counter. You hand something over, work happens, and something comes back. If you walk away without receiving the result, you've missed the point of the operation.
How to Call a Function Correctly
Conceptually, imagine a function such as:
FUNCTION DoubleValues(IntegerArray : ARRAY OF INTEGER, Size : INTEGER)
The precise notation depends on the pseudocode specification being used, but the important conceptual structure is:
input array + size → function processing → returned array
When calling a function that returns an array, you need somewhere appropriate to receive that result.
Conceptually:
FinalData ← DoubleValues(RawData, Size)
FinalData receives what the function returns.
That differs from a procedure call where there is no function return value being assigned.
Why a Function Return Value Needs Somewhere to Go
Suppose a function calculates something useful but you never capture or use the returned result.
What was the calculation for?
This is why identifying the subroutine type should happen before you write the call.
Ask:
Is this a function or procedure?
Then:
Does it return anything?
Then:
If it returns something, what variable or data structure should receive it?
Those three questions can prevent an entire category of pseudocode errors.
Understanding Arrays Passed as Function Parameters
The next challenge in the transcript involves an array parameter where the array's size isn't written directly as part of the parameter declaration.
The student understandably asks how an array can be processed when its limit isn't shown.
The important clue is that size is also supplied as a parameter. The function therefore has access to the information needed to determine how many elements should be processed. The session uses a doubleValues example in which the array and its size are passed to the function, each element is doubled, and the modified array is returned.
What the Size Parameter Actually Means
This distinction is crucial:
size is not the array.
It is a variable containing a number representing the relevant number of elements.
Suppose:
Size = 10
Then the array might contain ten relevant positions.
Inside the function, you don't need to know beforehand that the value will specifically be 10. You can write your algorithm using the variable:
FOR Index ← 0 TO Size - 1
When the function runs with Size = 10, the loop effectively behaves as:
FOR Index ← 0 TO 9
This is one of the most powerful ideas in programming. We write algorithms using variables, allowing the same algorithm to work with different data.
Why Array Indexes and Size Are Different
Suppose an array contains 10 elements and indexing begins at zero.
The indexes are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
There are 10 elements, but the highest index is 9.
That's why the transcript emphasizes the relationship between starting at zero and using size - 1 as the upper boundary in that example.
Don't memorize size - 1 as magic.
Understand where it comes from.
FOR vs REPEAT UNTIL: Choosing the Correct Loop
The student initially attempts to use REPEAT...UNTIL for the array-processing task.
Rather than simply replacing it, the lesson asks an important question: When do we use a FOR loop, and when do we use REPEAT UNTIL?
The student's existing understanding was that a FOR loop is appropriate when the range is known, while REPEAT...UNTIL is useful when you don't know beforehand exactly how many repetitions will be required. The session then applies that distinction to the array-size problem.
If the algorithm knows the relevant array size, it has enough information to establish a definite loop range.
That makes a count-controlled FOR loop a natural choice for processing every element.
Why Size Minus One Matters
Consider:
FOR Index ← 0 TO Size - 1
If:
Size = 10
the loop runs through indexes zero to nine.
That's exactly the set of indexes needed for ten zero-indexed elements.
The important exam skill isn't merely writing the loop correctly. You should be able to explain why the boundary is correct.
Cambridge Pseudocode Example: Doubling Every Array Value
Now the algorithm becomes straightforward.
For every position:
- Access the element.
- Multiply it by two.
- Store the result back into the same position.
Conceptually:
FOR Index ← 0 TO Size - 1
IntegerArray[Index] ← IntegerArray[Index] * 2
NEXT Index
After processing all elements:
RETURN IntegerArray
The transcript follows essentially this reasoning: visit every element, double the values rather than the size, and return the modified array.
Notice how the algorithm now looks much smaller than the original problem.
That's the recurring pattern:
Read → identify inputs → choose iteration → process each element → return required result.
Declaring vs Initializing the Loop Index
Another subtle point appears when the student uses an index variable.
The session distinguishes between declaring a variable and initializing it.
Declaration establishes the variable and its type.
Initialization gives it an initial value.
If the loop itself gives Index its starting value, you don't necessarily need a separate initialization immediately beforehand. But if you later write something equivalent to:
Index ← Index + 1
before Index has received a value, you have a problem. You're effectively asking the computer to add one to something that hasn't yet been given a usable starting value.
That distinction sounds small, but small details are exactly where exam marks can disappear.
Understanding 2D Arrays in Cambridge 9618
The lesson then moves from a one-dimensional array to a two-dimensional array using a Cambridge exam-style createBoard problem.
The function needs to create a 5 × 5 board of characters, initialize its positions with a space character, and return the completed 2D array.
This requires a different mental picture.
A 1D array is like a line of lockers.
A 2D array is more like a seating chart. To identify one seat, saying only “row three” isn't enough. Which seat in row three?
You need a row and a column.
Rows and Columns Explained
Imagine:
C1 C2 C3
R1 ? ? ?
R2 ? ? ?
R3 ? ? ?
To identify the middle position, you need:
Row 2, Column 2
This is why the tutoring session recommends descriptive loop variables such as Row and Column rather than ambiguous names.
When you're learning, good variable names act like road signs.
Why 2D Arrays Need Two Indexes
A major correction in the session concerns trying to access a 2D structure using only one index.
For a one-dimensional array, one position may be enough:
Array[Index]
For a two-dimensional array, the position requires both dimensions according to the pseudocode notation being taught:
Grid[Row, Column]
The lesson explicitly reinforces that when assigning or retrieving an individual value in the 2D array, both row and column need to identify the intended location.
This is a common exam mistake because students understand the nested loops but forget to use both loop variables when accessing the array itself.
Nested Loops: Row-by-Row vs Column-by-Column
A 2D array usually requires nested loops when every position needs to be processed.
For example:
FOR Row ← 1 TO 5
FOR Column ← 1 TO 5
Grid[Row, Column] ← ' '
NEXT Column
NEXT Row
The outer loop chooses a row.
The inner loop moves across its columns.
Then the outer loop moves to the next row.
But what happens if you reverse them?
FOR Column ← 1 TO 5
FOR Row ← 1 TO 5
Grid[Row, Column] ← ' '
NEXT Row
NEXT Column
For a simple operation that eventually fills every position with the same value, both traversals may accomplish the required final state. But the order of traversal changes.
The transcript spends considerable time visualizing this distinction. With row on the outside, the grid is traversed row by row. With column on the outside, it is traversed column by column.
That's deeper understanding than simply memorizing “row outside, column inside.”
You should know what the loops are actually doing.
Cambridge Example: Creating a 5×5 Game Board
The createBoard exercise combines several concepts at once.
The function needs to:
declare a 2D character array → loop through rows → loop through columns → assign a space character → return the array
Conceptually, its structure resembles:
FUNCTION CreateBoard() RETURNS ARRAY
DECLARE Grid : ARRAY[1:5, 1:5] OF CHAR
DECLARE Row : INTEGER
DECLARE Column : INTEGER
FOR Row ← 1 TO 5
FOR Column ← 1 TO 5
Grid[Row, Column] ← ' '
NEXT Column
NEXT Row
RETURN Grid
ENDFUNCTION
The exact exam syntax should follow the pseudocode convention required by the relevant paper, but the algorithmic pattern is what matters here.
The session also highlights a surprisingly easy mistake: an empty pair of quotes is not the same thing as a space character. The required value contains an actual space between the quotation marks.
Tiny? Yes.
Potentially mark-losing? Also yes.
Writing Procedure Headers Correctly
Not every exam question asks you to implement an entire algorithm.
Sometimes it asks only for a procedure header.
That means you should pay close attention to the command and scope of the question rather than writing unnecessary code.
The transcript reviews a question involving three parameters with different data types and passing mechanisms. It also discusses an examiner note indicating that BYVALUE is assumed when not explicitly specified in the referenced 9618 pseudocode guidance, while a parameter passed by reference needs to be represented accordingly.
The larger lesson is simple:
Answer what was asked.
If the question requests a header, concentrate on producing an accurate header.
BYVALUE vs BYREF and Custom Records
The session then introduces a custom record type and a procedure that receives a parameter of that record type by reference.
This combines two ideas students sometimes blur together.
First, a record type definition describes the structure.
Second, a variable of that record type is an actual instance that can hold data.
Think of the record definition as a blueprint for a house.
The blueprint isn't the house.
You use that blueprint to create an actual structure. Similarly, a custom record type defines what fields belong together, and variables can then be declared using that type.
When the variable is passed by reference, the procedure can work with the referenced data according to the semantics being tested.
The important exam strategy is to separate the pieces:
What is the custom type?
What is the variable name?
What is the parameter's type?
Is it passed by value or by reference?
Once again, decomposition turns a complicated-looking specification into manageable information.
Common Cambridge 9618 Pseudocode Mistakes
Several useful mistake patterns emerge naturally from this tutoring session.
A student may treat a function as though it were a procedure and fail to use its returned value. They may confuse the array's size with the array itself. They may choose REPEAT...UNTIL when a known range naturally suggests a FOR loop. They may forget the relationship between zero-based indexing and the final index.
With 2D arrays, another common issue is remembering the nested loops but forgetting that the actual element access requires both row and column.
Then there are the tiny syntax and notation issues: forgetting to declare an index, confusing declaration with initialization, using empty quotes when a space character is required, or writing more than the question actually requests.
The best defense is not memorizing hundreds of individual warnings.
Build a checking routine.
For every pseudocode answer, ask yourself:
What data structures am I using? What variables have I declared? What are my loop boundaries? Am I accessing the correct array dimensions? Is this a function or procedure? What does it return? Are parameters passed in the required way?
That checklist catches mistakes before an examiner has the opportunity to.
Conclusion: Build Reliable Pseudocode Through Patterns
Cambridge 9618 pseudocode becomes much easier when you stop viewing every past-paper question as an entirely new puzzle.
Patterns repeat.
A function returns something.
An array-processing algorithm usually needs iteration.
A known number of repetitions naturally points toward a count-controlled loop.
A 2D array needs rows and columns.
Nested loops allow you to visit every grid position.
A custom record defines a structure from which variables can be created.
Parameters may need to be passed by value or reference according to the specification.
The tutoring session demonstrates why writing the solution yourself matters. Understanding an explanation is useful, but being able to produce accurate pseudocode independently is what eventually matters in an exam.
So when you revise Cambridge 9618, don't only read model answers.
Cover the answer.
Take a blank page.
Write the function header yourself. Declare the variables. Build the loop. Access the array. Return the result.
Then compare.
That moment when you discover why your answer differs from the expected one is often where the real learning happens.
Download the Lesson Slides
📘 Cambridge 9618 Pseudocode: Arrays, Functions and 2D Arrays — Lesson Slides
Use these slides to review the main ideas covered in the lesson, including functions and procedures, array parameters, loop selection, array indexes, 2D arrays, nested loops, rows and columns, records, and parameter passing.
View / Download the Lesson Slides →
Practice Exercises
📝 Cambridge 9618 Pseudocode Practice Exercises
Once you've reviewed the lesson, try the exercises without looking at the solutions. The questions are designed to help you practice writing pseudocode yourself rather than simply recognizing a correct answer.
Practice topics include 1D arrays, FOR loops, functions, returned values, 2D arrays, nested loops, procedure headers, records, BYVALUE, and BYREF.
Download the Practice Exercises →
Cambridge 9618 Pseudocode FAQs
1. What is the difference between a function and a procedure in Cambridge pseudocode?
A function returns a value, while a procedure is used differently and does not provide a function return value in the same way. This affects how the subroutine is defined and how you use or call it.
2. When should I use a FOR loop instead of REPEAT UNTIL?
A FOR loop is particularly suitable when you know the required range or number of iterations. REPEAT...UNTIL is condition-controlled and is useful when repetition continues until a specified condition becomes true.
3. Why do I sometimes use size - 1 when looping through an array?
In the transcript's zero-indexed example, an array containing size elements has indexes from 0 through size - 1. If the size is 10, those indexes are 0 through 9.
4. Why do 2D arrays need row and column indexes?
Because one index identifies only one dimension. To identify a particular cell in a two-dimensional grid, you need its row and column.
5. Should the row or column loop come first in a 2D array?
The lesson recommends the conventional pattern of using the row as the outer loop and column as the inner loop unless the task provides a reason to traverse differently. Reversing them changes the traversal from row-by-row to column-by-column; for some simple operations, the final result can still be the same.
Author Bio
Cambridge Computer Science Tutor Author Bio
Ahmed Elmalla is a Computer Science educator, Certified Cambridge International AS & A Level Computer Science (9618) teacher, and software engineer with over 20 years of teaching, software engineering, and international tutoring experience. He specializes in AP Computer Science A (Java) and Cambridge IGCSE (0478) and AS & A Level Computer Science (9618), helping students build strong programming, computational thinking, and exam-solving skills. Through his Learn with Kemo platform, he has mentored students from around the world using practical, exam-focused instruction tailored to each learner's needs. His lessons combine real-world software engineering experience with personalized one-to-one tutoring, making complex Java and Computer Science concepts easier to understand. Ahmed is passionate about helping students gain confidence, improve academic performance, and achieve outstanding results in international Computer Science examinations.
LinkedIn: https://www.linkedin.com/in/akelmalla
WhatsApp: https://wa.me/60194028484
.png)
.png)
.png)
