Questions & Tests for

AQA A Level
Computer Science [7517]

2017 – 2021

About N7

Use N7 to quickly find high-quality questions by syllabus criteria and question type to easily compose targeted tests complete with detailed mark schemes. You can even add your own questions to the mix and share them with your community.

Learn more
A busy cafe has decided to streamline their business by implementing a software assisted ordering system. The new system will record customer orders at the front counter whereupon they are automatically added to a queue of orders accessed by a barista working at the back of the cafe to fulfill orders uninterrupted.
State one reason why a queue would be better suited to holding coffee orders than a stack.
The new systems holds the price for each type of coffee in an array called ITEMS as follows:
+--------------+--------------+ | Espresso | 1.20 | | Latte | 2.50 | | Cappuccino | 3.70 | +--------------+--------------+
Coffee orders are held in a queue called ORDERS where each order is a single integer indicating the type of coffee to be made by their respective row index in ITEMS array.
Additionally, a 3x3 2D array called SALES is initially defined as follows:
+--------------+--------------+--------------+ | Espresso | 0 | 0 | | Latte | 0 | 0 | | Cappuccino | 0 | 0 | +--------------+--------------+--------------+
Given ITEMS, ORDERS and SALES, write pseudocode such that column one and column two contain the total number of orders and total income for each coffee type respectively.
For example, the following ORDERS queue:
+-------+-------+-------+-------+-------+ 1 0 1 2 0 +-------+-------+-------+-------+-------+
would result in the following SALES array:
+--------------+--------------+--------------+ | Espresso | 2 | 2.40 | | Latte | 2 | 5.00 | | Cappuccino | 1 | 3.70 | +--------------+--------------+--------------+
The method rowswap(ARR, ROWA, ROWB) acts on the array ARR provided to swap the row at index ROWA with the row at index ROWB.
Without using loops, write pseudocode to sort the rows of SALES from lowest to highest total income. The row for the coffee with the highest total income should be at row index 2.
Extended Response10 MarksCommunity
76 Uses217 Views2 Likes
N7 Education
At the moment marathon runners cross the finishing line of a race, their names are added to a stack called RUNNERS.
For example, a diagram of RUNNERS below indicates “Ellie” has finished first and “Jessie” last. “Jessie” is at the top of the RUNNERS stack.
Question Image
Using pseudocode, construct an efficient procedure that will search the stack RUNNERS for a name given via standard input. Once the given name is found, output the finishing place of the runner specified as a number. If a name is not found then the procedure should output the message "Runner not found". Assume all names are unique, the number of elements in RUNNERS is unknown and RUNNERS may be emptied during the search process.
For example, given an input string of "Joel" the procedure will output the number 2 to indicate Joel finished in 2nd place.
Outline why the use of a queue would make this algorithm simpler and more efficient than using a stack.
In the same way as RUNNERS saves each runner's name, another stack called TIMES saves each runner's finishing time as they cross the finish line.
The results of a particular competition where 101 runners successfully finish a race are held in RUNNERS and TIMES. Given an empty 101x2 (row x column) 2D array called RESULTS, write pseudocode such that the first column contains the names of all those runners who finished the race and the second column contains their respective times in ascending rank order.
For example, RESULTS[7][1] should contain the time of the runner who finished in 94th place, that is, having only ran faster than seven people (eighth last).
Using RESULTS, state the single line of pseudocode that represents the name of the runner with the median finishing time.
Extended Response12 MarksPremium
74 Uses212 Views2 Likes
N7 Education

Ready to dive in?Start for free today.