Advanced level 2026 Holy Infant High School mock Computer science 3

Advanced level 2026 Holy Infant High School mock Computer science 3

Advanced level 2026 Holy Infant High School mock Computer science 3

I have extracted the text and data from the latest image, which describes a programming task involving a number grid and sub-program logic.


PROGRAMMING: A COMPUTER PROGRAM FOR YOUNGER STUDENTS (35 Marks)

A team of four high-school students decided to create a computer program for younger students to help them learn to count and recognize whole numbers from 1 to 25.

A table partially completed with numbers from 1 to 25 is given to a younger student. The table consists of five rows and five columns (see Figure 1). The younger student must enter the remaining numbers. Each number from 1 to 25 should be entered only once.

Figure 1: Example table partially filled with numbers

24 1
7 14
4 6 22
10 21 3
11 25 9

Each of the four students is responsible for creating several sub-programs that will be included in the program.

The sub-program inputInRange() should return a valid input number. This will ensure that the younger student’s input is a number in the range 1–25 inclusive. If the input number is not in this range, an appropriate message is output. The process will be repeated until a valid number is input.

Example execution for N = inputInRange():

  • Screen: Enter a number: 32

  • Screen: The number is not in the range from 1 to 25. Please try again.

  • Screen: Enter a number: 0

  • Screen: The number is not in the range from 1 to 25. Please try again.

  • Screen: Enter a number: 15

  • Result: The value of N would be 15 after execution.


Questions

1) Write a programming language (PL) sub-program inputInRange(). (5 marks)

2) Write a programming language (PL) sub-program InsertValues(MAT) that inserts values to the array MAT after verifying if each number falls in the range (1-25) inclusive by calling on the sub-program inputInRange(). (5 marks)

3) Write a programming language (PL) sub-program Initialise() that initialises the one-dimensional array, FLAGS, with zero (0) values. (3 marks)

  • NB: FLAGS and N are global variables.


Would you like me to provide the code for these sub-programs in C, or perhaps help you design a marking rubric for these specific tasks?

PDF is loading please wait...


Leave a comment

Your email address will not be published. Required fields are marked *

JOIN OUR WHATSAPP GROUP! / REJOIGNEZ NOTRE GROUPE WHATSAPP!
sponsors Ads