Algorithms and programming June 2025, Question 6 18 marks
Also involves Arrays
A student is writing a program in a high-level programming language.
The student writes the program using an Integrated Development Environment (IDE).
Complete the table by identifying and describing three features of an IDE that the student can use to debug their program.
Reveal mark scheme
The program the student is developing includes both global and local variables.
Explain the difference between a global variable and a local variable.
Reveal mark scheme
Describe one drawback of using global variables in a program.
Reveal mark scheme
Describe one drawback of using local variables in a program.
Reveal mark scheme
A variable can be passed as a parameter into a function by value or by reference.
Describe what parameter passing by value means.
Reveal mark scheme
An algorithm is needed to count how many times each of the numbers from 1 to 9 appear in an array called myArray. Another array called checked is used to store each number found in myArray and the number of times it appears. For example, the contents of myArray are:
Based on these contents in myArray, the contents in checked would be:
| 7 | 2 |
| 3 | 3 |
| 6 | 2 |
| 5 | 1 |
| 2 | 1 |
| –1 | 0 |
| –1 | 0 |
| –1 | 0 |
| –1 | 0 |
–1 indicates an unused space in the array as the numbers 1, 4, 8 and 9 have not been found.
The student has written the following pseudocode for this program.
The pseudocode contains several errors.
Identify the line number of any four errors and write the corrected line for each error.
Error 1
Error 2
Error 3
Error 4
Reveal mark scheme