TK Study

Past questions › sample-q14

2025 3 marks Pseudocode The Software Engineering Project (Year 12) Algorithm design (subroutines)

NESA HSC Software Engineering Sample Examination + Marking Guidelines (official, 2025)

PseudoPizza sells custom-designed pizzas. The price of a small pizza is $10. Added costs: Medium size $2; Large size $4; each topping $1.50. An algorithm is needed to calculate the cost of pizzas ordered for a customer. The algorithm should calculate and display: the cost of each pizza; the total cost of the order. Write the algorithm using pseudocode. Include at least one subroutine in your answer. You may assume that all inputs are valid. (3 marks)

Marking criteria

3: Substantially correct pseudocode that includes at least ONE subroutine. 2: Addresses some of the requirements. 1: Some understanding of the problem.

Sample answer

BEGIN main Get num_pizzas total_cost = 0 FOR i = 1 TO num_pizzas Get pizza_size Get num_toppings cost_per_pizza = calculate_pizza_cost(pizza_size, num_toppings) DISPLAY cost_per_pizza total_cost = total_cost + cost_per_pizza NEXT i DISPLAY total_cost END main

BEGIN calculate_pizza_cost(size, num_toppings) base_price = 10 topping_price = 1.5 IF size = "Medium" THEN base_price = base_price + 2 ELSEIF size = "Large" THEN base_price = base_price + 4 ENDIF pizza_cost = base_price + num_toppings * topping_price RETURN pizza_cost END calculate_pizza_cost

Question page · Practise and get marked