Skeleton Code Mock Paper
Skeleton Code Mock Paper
Skeleton Code Mock Paper
Write a program that can takes two integers as input and determines whether or not the two numbers are
amicable.
Figure 1 shows a partially completed Hierarchy chart for the Skeleton Code
5.1 State the name of the identifier for the subroutine denoted by a)
State the name of the identifier for the subroutine denoted by c) [3 marks]
5.2 State the name of an identifier for a user-defined subroutine that returns an integer value.
[1 mark]
5.3 State the name of an identifier for an array or list variable in Main [1 mark]
6.1 -
6.2 Explain the steps involved in evaluating a postfix (RPN) expression [4 marks]
6.4 What are the benefits of evaluating RPN expressions compared to infix expressions [1 mark]
6.8 What is the problem if you have a mathematical expression where you want perform the
plus operation before a multiply operation in ConvertToRPN [1 mark]
7.1 UpdateTargets implements a linear queue. A circular queue could have been used instead.
Explain why a circular queue is a better choice than a linear queue. [2 marks]
7.2 Why is a linear queue an appropriate choice in the Skeleton Code even though circular
queues are normally a better choice. [1 mark]
8.0 What does the + metacharacter do when it is used in a regular expression [1 mark]
Section C
You are advised to spend no longer than 50 minutes on this section
9 This question refers to Main
Write a procedure called DisplayInstructions that has no input parameters and is called at the
start of the game from Main. The procedure will output the following instructions:
Welcome to the Number Puzzle Game
Your goal is to create expressions that match the target numbers using the allowed
numbers.
You can use the operators +, -, *, /
Enter your expressions in infix notation