Array contents after reverse indexed assignment
2025-hsc-se-q14 · Fill in the Blanks · 1 mark
Source: NESA 2025 HSC Software Engineering HSC Q14
Question
Consider this code fragment.
FOR index = 5 TO 3
word[index] = word[index-2]
NEXT index
The array, word, contains the following data.
| index | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| word[index] | S | M | A | R | T |
Select the correct item from each dropdown menu to show the contents of the array after the code is run.
Reveal answer
- 1: S
- 2: M
- 3: S
- 4: M
- 5: A
Marking rubric
| Marks | Description |
|---|---|
| 1 | Identifies the correct item from each dropdown. |
Explanation
The loop copies earlier values into indexes 5, 4 and 3, giving the final array values S, M, S, M, A.
Metadata
- Submitter
- Seed data
- Created
- 2026-05-02
- Status
- published
- Syllabus
- y12-project-tools-for-ideas-solutions
- Tags
- arrays pseudocode trace table algorithm tracing