AI-assisted English content review; independent teacher approval pending.
Practice scope and review
Original, AI-authored English practice with worked guidance. Selected topics only; independent teacher review is pending. This is not a complete syllabus, official past-paper collection or predicted exam score. Check your own exam-board specification: these concepts are not certified against a particular board or exam year.
151 original questions across 21 selected topic areas. No account or payment required to practise.
Cambridge International AS & A Level Computer Science (9618), examination year 2027: AI-assisted conceptual alignment to official sources, not teacher or exam-board certification. Syllabus mapping and remaining coverage.
5 questions in this topic
Exact English revisions checked in an AI-assisted academic review; independent teacher approval is still pending.
All topics
Original English exercises targeting selected 9618 2027-29 requirements. Conceptual alignment only; independent teacher approval, practical competence and complete teaching coverage are not established.
Subtopics in this topic (3)
Validated input
Two-dimensional records
Bubble sort and linear search
5 of 5 questions shown
Loading saved responses
Question 1Write Cambridge pseudocode to read exactly three valid integer marks into Marks[1:3]. Each must be from 0 to 10 inclusive; re-enter an invalid value without advancing the index. Output their mean as REAL. Inputs, in order, are -1, 5, 3, 11, 8. Give accepted array, sum and mean, and explain why a post-condition loop fits each input attempt.6 indicative marks
Construct, trace and explain6 indicative marksNo calculator
Write Cambridge pseudocode to read exactly three valid integer marks into Marks[1:3]. Each must be from 0 to 10 inclusive; re-enter an invalid value without advancing the index. Output their mean as REAL. Inputs, in order, are -1, 5, 3, 11, 8. Give accepted array, sum and mean, and explain why a post-condition loop fits each input attempt.
Show indicative guidance
Worked guidance
DECLARE Marks : ARRAY[1:3] OF INTEGER
DECLARE Index : INTEGER
DECLARE Total : INTEGER
DECLARE Mean : REAL
Total <- 0
FOR Index <- 1 TO 3
REPEAT
INPUT Marks[Index]
UNTIL (Marks[Index] >= 0) AND (Marks[Index] <= 10)
Total <- Total + Marks[Index]
NEXT Index
Mean <- Total / 3
OUTPUT Mean
At slot 1, -1 fails and 5 succeeds; total becomes 5. Slot 2 accepts 3, giving 8. Slot 3 rejects 11 then accepts 8, giving 16. Division / returns REAL in the guide, so the mean is 16/3, not INTEGER quotient 5.
A FOR loop counts accepted slots, not every attempted input. REPEAT runs at least once per slot; placing the accumulator inside its retry body would wrongly include rejected inputs. Tests: 0 and 10 accepted, -1 and 11 rejected.
Self-marking points
View marking points
Declare an INTEGER array with bounds 1:3 and an index.
Use a FOR loop for three accepted slots.
Repeat INPUT for the current slot until both inclusive range conditions hold.
Accumulate only accepted values, giving [5,3,8].
Sum is 16 and REAL division gives 16/3, approximately 5.3333.
Each slot needs at least one input attempt, so REPEAT is appropriate; 0 and 10 are valid boundaries.
Examiner tip
Indicative distinct points, not an official Cambridge mark allocation. State bounds, assumptions and intermediate states; practical teacher review remains required.
Question 2A room has two rows and three seats per row. Define a Seat record with Occupied: BOOLEAN and Name: STRING, then Seats[1:2,1:3] OF Seat. Write CountOccupied() returning the number occupied without changing records. Occupied values are row1 [TRUE,FALSE,TRUE], row2 [FALSE,TRUE,FALSE]. Trace the returned count and explain why one array of STRING names alone is a weaker model.6 indicative marks
Construct, trace and explain6 indicative marksNo calculator
A room has two rows and three seats per row. Define a Seat record with Occupied: BOOLEAN and Name: STRING, then Seats[1:2,1:3] OF Seat. Write CountOccupied() returning the number occupied without changing records. Occupied values are row1 [TRUE,FALSE,TRUE], row2 [FALSE,TRUE,FALSE]. Trace the returned count and explain why one array of STRING names alone is a weaker model.
Show indicative guidance
Worked guidance
TYPE Seat
DECLARE Occupied : BOOLEAN
DECLARE Name : STRING
ENDTYPE
DECLARE Seats : ARRAY[1:2,1:3] OF Seat
FUNCTION CountOccupied() RETURNS INTEGER
DECLARE Row : INTEGER
DECLARE Column : INTEGER
DECLARE Count : INTEGER
Count <- 0
FOR Row <- 1 TO 2
FOR Column <- 1 TO 3
IF Seats[Row,Column].Occupied THEN
Count <- Count + 1
ENDIF
NEXT Column
NEXT Row
RETURN Count
ENDFUNCTION
The six tests produce running counts 1,1,2,2,3,3, so the returned value is 3. Each record groups heterogeneous fields describing one seat; the array itself remains homogeneous because every element is a Seat.
The function returns a value for use in an expression, such as OUTPUT CountOccupied(); it is not called with CALL. An empty name need not reliably mean an unoccupied seat, so a typed Boolean records the state independently.
Self-marking points
View marking points
Define Seat with both correctly typed fields.
Declare the 2D array with explicit inclusive bounds.
Initialise the count to zero.
Visit every row/column and increment only for Occupied=TRUE.
Return INTEGER 3, with row totals 2 and 1.
A separate occupancy field avoids overloading a possibly empty name to represent seat state.
Examiner tip
Indicative distinct points, not an official Cambridge mark allocation. State bounds, assumptions and intermediate states; practical teacher review remains required.
Question 3Write pseudocode to bubble-sort integer A[1:4] ascending using shrinking inner bounds, then linear-search the sorted array for the first 2 and output its one-based position, or 0 if absent. Initial A is [7,2,5,2]. Give every outer-pass array and total adjacent comparisons. Your search must stop changing Found after the first match.6 indicative marks
Construct, trace and explain6 indicative marksNo calculator
Write pseudocode to bubble-sort integer A[1:4] ascending using shrinking inner bounds, then linear-search the sorted array for the first 2 and output its one-based position, or 0 if absent. Initial A is [7,2,5,2]. Give every outer-pass array and total adjacent comparisons. Your search must stop changing Found after the first match.
Show indicative guidance
Worked guidance
DECLARE Pass : INTEGER
DECLARE Index : INTEGER
DECLARE Temp : INTEGER
DECLARE Found : INTEGER
FOR Pass <- 1 TO 3
FOR Index <- 1 TO 4-Pass
IF A[Index] > A[Index+1] THEN
Temp <- A[Index]
A[Index] <- A[Index+1]
A[Index+1] <- Temp
ENDIF
NEXT Index
NEXT Pass
Found <- 0
Index <- 1
WHILE (Index <= 4) AND (Found = 0)
IF A[Index] = 2 THEN
Found <- Index
ENDIF
Index <- Index + 1
ENDWHILE
OUTPUT Found
Pass1 swaps 7 with 2, then 5, then 2: [2,5,2,7]. Pass2 leaves 2/5 in order then swaps 5/2: [2,2,5,7]. Pass3 compares only the first pair and makes no swap. Six comparisons occur even though pass3 changes nothing.
The WHILE condition examines only scalar Index and Found, not an out-of-bounds array access. The body accesses A only after Index<=4. First match sets Found=1 and ends searching; no match leaves Found=0. Sorting is not a prerequisite for linear search, although it is for binary search.
Self-marking points
View marking points
Use three outer passes and inner bound 4-Pass.
Swap adjacent out-of-order values using temporary storage.
Pass arrays are [2,5,2,7], then [2,2,5,7], then unchanged.
Perform 3+2+1=6 adjacent comparisons.
Search with a found/position guard and valid bounds.
Output first-match position 1; output 0 for absent target.
Examiner tip
Indicative distinct points, not an official Cambridge mark allocation. State bounds, assumptions and intermediate states; practical teacher review remains required.
Question 4Write pseudocode returning the maximum of nonempty integer A[1:N], with N>=1, without sorting. Trace A=[-8,-3,-9,-3], giving the stored maximum after each element. Explain the failure of starting Largest at 0 and test N=1 with A=[-5].4 indicative marks
Analyse4 indicative marksNo calculator
Write pseudocode returning the maximum of nonempty integer A[1:N], with N>=1, without sorting. Trace A=[-8,-3,-9,-3], giving the stored maximum after each element. Explain the failure of starting Largest at 0 and test N=1 with A=[-5].
Cambridge 2027: Direct conceptual match
Checked negative and tied data, one-element path and invalid zero sentinel; this is a linear construction, not another sorting trace.
Largest <- A[1]
FOR I <- 2 TO N
IF A[I] > Largest THEN
Largest <- A[I]
ENDIF
NEXT I
OUTPUT Largest
Starting with -8 makes Largest an actual member. The next value raises it to -3, and neither -9 nor the tied -3 raises it further.
With one element the FOR body has no iterations and returns -5. Starting at 0 would falsely dominate every negative value, violating the requirement to return a member maximum.
Self-marking points
View marking points
Initialises Largest from A[1].
Scans indices 2..N, updating only for a larger element.
Trace is -8,-3,-3,-3 and final maximum -3.
Zero initialisation wrongly returns 0; single-element test returns -5.
Examiner tip
State the nonempty-array precondition before accessing A[1].
Question 5Integer Codes[1:5]=[2,1,2,3,2] contains only category codes 1..3. Construct pseudocode filling Count[1:3] with each category frequency. Show Count after the first three inputs and after all five; state a useful total-count check.4 indicative marks
Analyse4 indicative marksNo calculator
Integer Codes[1:5]=[2,1,2,3,2] contains only category codes 1..3. Construct pseudocode filling Count[1:3] with each category frequency. Show Count after the first three inputs and after all five; state a useful total-count check.
Cambridge 2027: Direct conceptual match
Independently tallied frequencies1/3/1, intermediate1/2/0 and conservation total5; explicit valid-index precondition.