QCAA Digital Solutions Innovative digital solutions
5 sample questions with marking guides and sample answers · Avg. score: 63.3%
How could a developer refine the following algorithm to improve maintainability?
/* Calculate the average value of an input array */
0 START
1 INPUT x AS ARRAY
2 SET sum = 0
3 FOR n IN x
4 sum = sum + n
5 ENDFOR
6 CALCULATE result = sum / length of x
7 OUTPUT result
8 END
Use an error-checking function.
Write code comments on every line.
Rename variables n, x and result to be more descriptive.
Incorporate a function from an available code library to sum the array.
A soccer club needs to develop a system for storing members’ data, including:
• name
• address
• team
• membership type
• email address
• phone number.
The secretary wants to email weekly newsletters to members. The treasurer wants to print membership lists and store yearly payment information.
To produce this system, the developer will need to generate a database, design interfaces and develop coded modules to send emails. After adding and updating member details, they will also need to
generate reports and process payments.
generate reports and provide secure logins for users.
process payments and provide secure logins for users.
generate reports, process payments and provide secure logins for users.
The table shown is named 'Planets' and is stored in a database.
| Name | Moons | Diameter | Gravity | Mean temperature |
|---|---|---|---|---|
| Mercury | 0 | 4 879 | 3.7 | 167 |
| Venus | 0 | 12 104 | 8.9 | 464 |
| Earth | 1 | 12 756 | 9.8 | 15 |
| Mars | 2 | 6 792 | 3.7 | – 65 |
Which SQL query will return the name and mean temperature of any planet with a diameter less than 50 000, ordered in descending order of mean temperature?
SELECT Name, MeanTemperature
FROM Planets
WHERE Diameter < 50000
AND ORDER BY MeanTemperature DESC
SELECT Name, MeanTemperature
FROM Planets
WHERE Diameter < 50000
ORDER BY MeanTemperature DESCENDING
SELECT Name, MeanTemperature
FROM Planets
WHERE Diameter < 50000
ORDER BY MeanTemperature DESC
SELECT Name, MeanTemperature
FROM Planets
WHERE Diameter < 50000 AND
ORDER BY MeanTemperature DESC
An algorithm is developed to establish a seating plan in a movie theatre so that individual bookings are always separated by two seats. To maximise ticket sales, bookings of four or more guests are accepted immediately. Bookings for smaller groups are not confirmed until 2 hours before the movie starts.
BEGIN
SET seats = true //assume seats are available
SET bookingConfirmed = false
SET DateTime //current date and time
INPUT movieStartTime
INPUT guestNumber
IF guestNumber < 4 AND
IF movieStartTime - DateTime >= 2 hours
SET bookingPending = true
ELSE
IF guestNumber >= 4 THEN
SET bookingConfirmed = true
ENDIF
ENDIF
ENDIF
BEGIN bookingPending
//module to handle bookings for fewer than 4 guests
END
BEGIN bookingConfirmed
//module to handle bookings for 4 or more guests
END
END
The algorithm is incomplete. What is the best way to make the algorithm more efficient?
Use modularisation to suggest an alternative movieStartTime for bookingPending.
Add an algorithm to determine seat allocation, ensuring groups sit two seats apart.
Calculate movieStartTime - DateTime and set as a Boolean.
Use a FOR loop to check the parameters for bookingConfirmed.
The table describes a sample of the personalised numberplate range for Queensland.
| Range | Classic | Emoji |
|---|---|---|
| Description | Combination of 3 numeric characters and 3 alphabetic characters | Combination of 5 alphanumeric characters and 1 emoji |
Which SQL statement is correct for ordering a new personalised numberplate?
CREATE TABLE orders
product_range = ‘classic_theme’,
combination = ‘YIP333’
customerId = 123;
INSERT INTO orders (customerId, product_range, combination)
VALUES (123,‘classic_theme’,‘YIP333’)
UPDATE orders
SET product_range = ‘classic_theme’, combination = ‘YIP333’
WHERE customerId = 123;
ALTER TABLE orders
SET product_range = ‘classic_theme’, combination = ‘YIP333’
WHERE customerId = 123;