ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions
2 marks · Sub-programs, parameters and scope
Formal and actual parameters are used in the code below. Line 1 FUNCTION discount(REAL price, REAL percentage) RETURNS REAL Line 2 DECLARE discountAmount AS REAL INITIALLY 0.0 Line 3 SET discountAmount TO price * (percentage/100) Line 4 SET price TO price − discountAmount Line 5 RETURN price Line 6 END FUNCTION … … Line 66 SET newPrice TO discount(originalPrice, discountRate) Identify one formal parameter and its associated actual parameter. Formal parameter Actual parameter
Formal Actual price originalPrice percentage discountRate Award 2 marks for correct pair. Award 1 mark for one correctly identified formal/actual.