Pseudocode Array Assignment- Notebook work
IGCSE – Computer Science-Grade 9
Q1
Write pseudocode to store the number of steps taken each day for 10 days in a one-
dimensional array called Steps. The array contains the following values:
[6420, 8010, 7530, 9200, 3880, 10500, 6700, 6700, 8450, 5000]
Your pseudocode must calculate and output:
• the total number of steps for the 10 days
• the average number of steps per day
Q2
Write pseudocode to store the daily sales amounts (₹) for 7 days in a one-dimensional array
called Sales. The array contains the following values:
[1250, 980, 1430, 760, 1430, 1590, 1100]
Your pseudocode must calculate and output:
• the total sales for the week
• the highest sale amount (maximum)
Q3
Write pseudocode to store hourly temperature readings (°C) for 12 hours in a one-
dimensional array called Temp. The array contains the following values:
[28, 29, 31, 33, 34, 32, 30, 29, 28, 27, 26, 27]
Your pseudocode must calculate and output:
• the minimum temperature
• the maximum temperature
• the average temperature
Q4
Delhi follows an Odd–Even traffic rule. Each vehicle has a registration number, and the last
digit of the registration number decides whether it is odd or even.
Write pseudocode to store the last digit of 12 vehicle registration numbers in a one-
dimensional array called LastDigit. The array contains the following values:
[4, 7, 2, 9, 0, 5, 6, 3, 8, 1, 2, 7]
Your pseudocode must calculate and output:
• the number of vehicles allowed on an EVEN day (last digit is even)
• the number of vehicles allowed on an ODD day (last digit is odd)
Q5
This pseudocode algorithm should allow 500 names of students and their test marks to be
entered and stored in two one-dimensional (1D) arrays. The name of a student and the mark
of that student are in the same index in both the Names[] and Marks[] arrays.
The algorithm performs as follows:
• at the start, the following data is entered:
o name of student
o mark of student (out of 100)
• the data is stored in the relevant arrays
• the marks of all students are totalled
• the highest mark is found
• the lowest mark is found
• at the end, the following is output:
o name of student with the highest mark
o highest mark
o name of student with the lowest mark
o lowest mark
o average mark of all 500 students
Q6
This pseudocode algorithm should allow 500 product names and their prices to be entered
and stored in two one-dimensional (1D) arrays. The product name and its price are in the
same index in both the Product[] and Price[] arrays.
The algorithm performs as follows:
• at the start, the following data is entered:
o name of product
o price of product
• the data is stored in the relevant arrays
• the total cost of all products is calculated
• the most expensive product is found
• the cheapest product is found
• at the end, the following is output:
o name of most expensive product
o price of most expensive product
o name of cheapest product
o price of cheapest product
o average price of all 500 products
Q7
This pseudocode algorithm should allow 500 employee names and their employee ID
numbers to be entered and stored in two one-dimensional (1D) arrays. The employee name
and employee ID are in the same index in both the EmpName[] and EmpID[] arrays.
The algorithm performs as follows:
• at the start, the following data is entered:
o employee name
o employee ID number (integer)
• the data is stored in the relevant arrays
• the number of employee IDs that are even is counted
• the number of employee IDs that are odd is counted
• at the end, the following is output:
o total number of even employee IDs
o total number of odd employee IDs
Q8
This pseudocode algorithm should allow 500 parcel weights to be entered and stored in a
one-dimensional (1D) array called Weight[].
The algorithm performs as follows:
• at the start, the following data is entered:
o parcel weight in grams
• the data is stored in the Weight[] array
• the total weight of all parcels is calculated
• the heaviest parcel is found
• the lightest parcel is found
• at the end, the following is output:
o total weight of all 500 parcels
o maximum weight
o minimum weight
o average parcel weight
Q9
This pseudocode algorithm should allow 500 bus ticket numbers to be entered and stored in
a one-dimensional (1D) array called Ticket[].
The algorithm performs as follows:
• at the start, the following data is entered:
o ticket number (integer)
• the data is stored in the Ticket[] array
• the number of even ticket numbers is counted
• the number of odd ticket numbers is counted
• at the end, the following is output:
o total number of even ticket numbers
o total number of odd ticket numbers
Q10
This pseudocode algorithm should allow 500 bus ticket numbers to be entered and stored in a
one-dimensional (1D) array called Ticket[].
The algorithm performs as follows:
• at the start, the following data is entered:
o ticket number (integer)
• the data is stored in the Ticket[] array
• the algorithm checks whether the ticket numbers are valid using these rules:
o a valid ticket number must be a 5-digit number (10000 to 99999)
o the last digit must be even (tickets printed on the “even counter”)
• the algorithm counts:
o the number of valid ticket numbers
o the number of invalid ticket numbers
• the algorithm also finds:
o the first invalid ticket number entered (store its value)
• at the end, the following is output:
o total number of valid ticket numbers
o total number of invalid ticket numbers
o the first invalid ticket number entered (or output "NONE" if all are valid)