15 Mark Questions
15 Mark Questions
company. The 2D array EmployeeSalary[] contains the salary for each employee
in different departments, for each employee. The position of each employee's
data in the two arrays is the same, for example, the employee in position 6 in
EmployeeID[] and EmployeeSalary[] is the same.
The variable EmployeeNo contains the number of employees in the company. The
variable DepartmentNo contains the number of departments in the company. All
employees work in the same number of departments.
The arrays and variables have already been set up and the data stored.
Average salary Bonus awarded greater than or equal to $75,000 $1,000 greater
than or equal to $50,000 and less than $75,000 $500 less than $50,000 no bonus
You must use pseudocode or program code and add comments to explain how
your code works. You do not need to initialize the data in the array.
// meaningful identifier names and appropriate data structures (variables, constants and the
// initialisation processes for this scenario, initialising the running totals used for
TotalBonus ← 0
TotalSalary[EmployeeCounter] ← 0
TotalSalary[EmployeeCounter] = TotalSalary[EmployeeCounter] +
EmployeeSalary[EmployeeCounter, DepartmentCounter]
NEXT DepartmentCounter
AverageSalary[EmployeeCounter] =
ROUND(TotalSalary[EmployeeCounter]/DepartmentNo)
Bonus[EmployeeCounter] = Bonus1000
Bonus[EmployeeCounter] = Bonus500
ELSE
END IF
NEXT EmployeeCounter
The variable ProductNo contains the number of products in the store. The variable
ColorNo contains the number of colors available for each product. All products have
the same number of colors available.
The arrays and variables have already been set up and the data stored.
A discount is applied to the products based on their average price.
Average price Discount applied greater than or equal to 50 10% greater than or
equal to 30 and less than 50 5% less than 30 no discount
● calculates the combined total price for each product in all its colors
● calculates the average price for each product in all its colors, rounded
to the nearest whole number
● outputs for each product:
● identification number
● combined total price
● average price
● discount applied
● calculates, stores and outputs the total discount applied to all products
in the store.
You must use pseudocode or program code and add comments to explain how your
code works. You do not need to initialize the data in the array
// meaningful identifier names and appropriate data structures (variables, constants and the
CONSTANT Discount10 = 10
CONSTANT Discount5 = 5
// initialisation processes for this scenario, initialising the running totals used for
TotalDiscount ← 0
FOR ProductCounter ← 1 to ProductNo
TotalPrice[ProductCounter] ← 0
NEXT ColorCounter
AveragePrice[ProductCounter] = ROUND(TotalPrice[ProductCounter]/ColorNo)
IF AveragePrice[ProductCounter] >= 50
ELSE
END IF
NEXT ProductCounter
The variable CustomerNo contains the number of customers in the store. The
variable PurchaseNo contains the number of purchases made by each customer. All
customers make the same number of purchases.
The arrays and variables have already been set up and the data stored.
Customers are awarded a discount on their next purchase based on the total amount
of money they spent.
Total spent Discount applied greater than or equal to 100 10% greater than or equal
to 50 and less than 100 5% less than 50 no discount
You must use pseudocode or program code and add comments to explain how your
code works. You do not need to initialize the data in the array.
Solution
// meaningful identifier names and appropriate data structures (variables, constants and the
CONSTANT Discount10 = 10
CONSTANT Discount5 = 5
// initialisation processes for this scenario, initialising the running totals used for
TotalDiscount ← 0
TotalSpent[CustomerCounter] ← 0
TotalSpent[CustomerCounter] = TotalSpent[CustomerCounter] +
CustomerPurchase[CustomerCounter, PurchaseCounter]
NEXT PurchaseCounter
Discount[CustomerCounter] = Discount10
Discount[CustomerCounter] = Discount5
ELSE
Discount[CustomerCounter] = 0
END IF
NEXT CustomerCounter
//
The 1D array StudentID[] contains the identification numbers of students in a class.
The 2D array StudentAssignment[] contains the score for each assignment, for each
student. The position of each student's data in the two arrays is the same, for
example, the student in position 4 in StudentID[] and StudentAssignment[] is the
same.
The variable StudentNo contains the number of students in the class. The variable
AssignmentNo contains the number of assignments given to each student. All
students receive the same number of assignments.
The arrays and variables have already been set up and the data stored.
Average score Bonus mark awarded greater than or equal to 80 2 greater than or
equal to 60 and less than 80 1 less than 60 0
● calculates the total score for each student on all their assignments
● calculates the average score for each student on all their assignments,
rounded to the nearest whole number
● outputs for each student:
● identification number
● total score
● average score
● bonus mark awarded
● calculates, stores and outputs the total bonus marks awarded to all
students in the class.
You must use pseudocode or program code and add comments to explain how your
code works. You do not need to initialize the data in the array.
// meaningful identifier names and appropriate data structures (variables, constants and the
The variable DriverNo contains the number of drivers in the city. The variable RoadNo
contains the number of roads on which each driver was monitored. All drivers were
monitored on the same number of roads.
The arrays and variables have already been set up and the data stored.
Maximum speed Fine applied greater than or equal to 120 100 greater than or equal
to 100 and less than 120 50 less than 100 no fine
You must use pseudocode or program code and add comments to explain how your
code works. You do not need to initialize the data in the array
Question 3
// meaningful identifier names and appropriate data structures (variables, constants and the
CONSTANT Fine5 = 5
// initialisation processes for this scenario, initialising the running totals used for
// fines
TotalFine ← 0
OUTPUT "Vehicle " + VehicleCounter + " speed: " + Speed[VehicleCounter] + " mph"
ELSE
END IF
NEXT VehicleCounter
The variable CustomerNo contains the number of customers in the store. The variable
CategoryNo contains the number of categories of items in the store. All customers
order items from the same number of categories.
The arrays and variables have already been set up and the data stored.
Customers are awarded a discount based on the total number of items they ordered.
● calculates the total number of items ordered for each customer in all
categories
● outputs for each customer:
○ identification number
○ total number of items ordered
○ discount applied
● calculates, stores and outputs the total discount applied to all customers in
the store.
You must use pseudocode or program code and add comments to explain how your
code works.
// meaningful identifier names and appropriate data structures (variables, constants and the
// given arrays) to store all the data required
DECLARE TotalItems : ARRAY[1:50] OF INTEGER
DECLARE Discount : ARRAY[1:50] OF INTEGER
DECLARE CategoryCounter : INTEGER
DECLARE CustomerCounter : INTEGER
DECLARE TotalDiscount : INTEGER
CONSTANT Discount10 = 10
CONSTANT Discount5 = 5
// initialisation processes for this scenario, initialising the running totals used for
// discounts
TotalDiscount ← 0
The 1D array CountryID[] contains the identification numbers of countries in the world.
The 2D array CountryPopulation[] contains the population for each country in different
age groups, for each country. The position of each country's data in the two arrays is
the same, for example, the country in position 9 in CountryID[] and CountryPopulation[] is
the same.
The variable CountryNo contains the number of countries in the world. The variable
AgeGroupNo contains the number of age groups in each country. All countries have
the same number of age groups.
The arrays and variables have already been set up and the data stored.
Countries are ranked based on the total population in each age group.
● calculates the total population for each country in all age groups
● outputs for each country:
○ identification number
○ total population
○ rank
● calculates, stores and outputs the average rank of all countries in the world.
You must use pseudocode or program code and add comments to explain how your
code works.
// meaningful identifier names and appropriate data structures (variables, constants and the
// given arrays) to store all the data required
DECLARE TotalPopulation : ARRAY[1:50] OF INTEGER
DECLARE Rank : ARRAY[1:50] OF INTEGER
DECLARE AgeGroupCounter : INTEGER
DECLARE CountryCounter : INTEGER
DECLARE TotalRank : INTEGER
// initialisation processes for this scenario, initialising the running totals used for
// ranking
TotalRank ← 0
Question 8
The 1D array AnimalID[] contains the identification numbers of animals in a zoo. The
2D array AnimalWeight[] contains the weight for each animal in different months, for
each animal. The position of each animal's data in the two arrays is the same, for
example, the animal in position 11 in AnimalID[] and AnimalWeight[] is the same.
The variable AnimalNo contains the number of animals in the zoo. The variable
MonthNo contains the number of months in a year. All animals have their weight
measured in the same number of months.
The arrays and variables have already been set up and the data stored.
Animals are monitored for their weight changes over the year. A warning is issued if
an animal's weight changes by more than 10% in any month.
You must use pseudocode or program code and add comments to explain how your
code works.
// meaningful identifier names and appropriate data structures (variables, constants and the
// given arrays) to store all the data required
DECLARE AverageWeight : ARRAY[1:50] OF INTEGER
DECLARE Warning : ARRAY[1:50] OF STRING
DECLARE MonthCounter : INTEGER
DECLARE AnimalCounter : INTEGER
DECLARE TotalWarnings : INTEGER
CONSTANT WarningThreshold = 10
// initialisation processes for this scenario, initialising the running totals used for
// warnings
TotalWarnings ← 0
The variable PlayerNo contains the number of players in the sports team. The variable
GameNo contains the number of games played in a season. All players have their
score recorded in the same number of games.
The arrays and variables have already been set up and the data stored.
Players are awarded points based on their average score in each game.
less than 7 1
You must use pseudocode or program code and add comments to explain how your
code works.
CONSTANT Points3 = 3
CONSTANT Points2 = 2
CONSTANT Points1 = 1
// initialisation processes for this scenario, initialising the running totals used for
// points
TotalPoints ← 0