QCAA Digital Solutions Innovative digital solutions
8 sample questions with marking guides and sample answers · Avg. score: 55.6%
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.
Reveal Answer
generate reports and process payments.
While this covers the treasurer's needs for reports and payments, it fails to include secure logins, which are essential for protecting the sensitive personal and financial data stored in the system.
generate reports and provide secure logins for users.
This option misses the requirement to process or store payment information, which is explicitly stated as a need for the treasurer.
process payments and provide secure logins for users.
This option overlooks the treasurer's need to print membership lists, which requires the system to generate reports.
generate reports, process payments and provide secure logins for users.
This is the most comprehensive solution: it addresses the treasurer's need for reports (membership lists) and payment handling, while also ensuring the security of private member data through secure logins.
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.
Reveal Answer
Use modularisation to suggest an alternative movieStartTime for bookingPending.
This option suggests adding a new feature (suggesting alternative times) rather than improving the efficiency or structure of the current algorithm.
Add an algorithm to determine seat allocation, ensuring groups sit two seats apart.
While seat allocation is a necessary functional requirement, this option describes what to do rather than how to improve the algorithm's efficiency. Option D provides the specific control structure needed to implement this.
Calculate movieStartTime - DateTime and set as a Boolean.
Pre-calculating the time difference and storing it as a Boolean improves code readability but has a negligible impact on the computational efficiency of the algorithm.
Use a FOR loop to check the parameters for bookingConfirmed.
To confirm a booking, the system must verify that there are enough available seats in the theatre's seating plan (an array or grid). A FOR loop is the most efficient way to iterate through the seat data structure to check these parameters and find a suitable block of seats.
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
Reveal Answer
SELECT Name, MeanTemperature
FROM Planets
WHERE Diameter < 50000
AND ORDER BY MeanTemperature DESC
This option is incorrect because the AND operator cannot be used to connect the WHERE clause to the ORDER BY clause; ORDER BY is a separate statement that follows the filtering logic.
SELECT Name, MeanTemperature
FROM Planets
WHERE Diameter < 50000
ORDER BY MeanTemperature DESCENDING
This option is incorrect because the standard SQL keyword for sorting in descending order is DESC, not DESCENDING.
SELECT Name, MeanTemperature
FROM Planets
WHERE Diameter < 50000
ORDER BY MeanTemperature DESC
This is the correct query. It properly selects the columns, filters the rows using WHERE Diameter < 50000, and sorts the results using the standard ORDER BY ... DESC syntax.
SELECT Name, MeanTemperature
FROM Planets
WHERE Diameter < 50000 AND
ORDER BY MeanTemperature DESC
This option is incorrect because it places an AND operator at the end of the WHERE clause before ORDER BY, which causes a syntax error.
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.
Reveal Answer
Use an error-checking function.
Error checking improves the robustness and reliability of the program (e.g., preventing division by zero), but it does not primarily address the readability or ease of modifying the code.
Write code comments on every line.
Commenting every line creates visual clutter and redundancy, as the code itself should be clear enough to understand; comments should focus on explaining complex logic or intent rather than obvious syntax.
Rename variables n, x and result to be more descriptive.
Renaming single-letter variables like and to descriptive names (e.g., and ) makes the code self-documenting, significantly improving readability and making it easier for developers to understand and maintain.
Incorporate a function from an available code library to sum the array.
While using library functions is efficient, the most immediate flaw in the provided algorithm regarding maintainability is the use of ambiguous variable names, which makes the logic harder to follow.
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;
Reveal Answer
CREATE TABLE orders
product_range = ‘classic_theme’,
combination = ‘YIP333’
customerId = 123;
This is incorrect because CREATE TABLE is used to define the structure of a new table, not to add data to an existing one. Furthermore, the syntax shown is invalid for creating a table.
INSERT INTO orders (customerId, product_range, combination)
VALUES (123,‘classic_theme’,‘YIP333’)
This is correct because the INSERT INTO statement is the standard SQL command used to add a new row (record) of data into a table, which corresponds to placing a new order.
UPDATE orders
SET product_range = ‘classic_theme’, combination = ‘YIP333’
WHERE customerId = 123;
This is incorrect because UPDATE is used to modify existing records. Ordering a new item requires creating a new record rather than changing data in an existing one.
ALTER TABLE orders
SET product_range = ‘classic_theme’, combination = ‘YIP333’
WHERE customerId = 123;
This is incorrect because ALTER TABLE is a Data Definition Language (DDL) command used to modify the structure of a table (e.g., adding columns), not to insert or update specific data rows.
In a game, scores are averaged for players in the same team. Each team consists of five players. Player names and scores are to be stored in arrays.
The referee was given the first version of the algorithm, which they then improved to create the second version.
First version
ProcessGroup (name[], score[])
BEGIN
SET total = 0
PRINT name[1]
CALCULATE total = total + score[1]
PRINT name[2]
CALCULATE total = total + score[2]
PRINT name[3]
CALCULATE total = total + score[3]
PRINT name[4]
CALCULATE total = total + score[4]
PRINT name[5]
CALCULATE total = total + score[5]
CALCULATE average = total / 5
PRINT average
END
Second version
ProcessGroup (name[], score[])
BEGIN
SET groupSize = 5
SET count = 0
SET total = 0
WHILE count < groupSize
PRINT name[count]
CALCULATE total = total + score[count]
INCREMENT count
ENDWHILE
CALCULATE average = total / groupSize
PRINT average
END
Which features of good algorithms have been improved in the second version?
efficiency, effectiveness
reliability, effectiveness
maintainability, efficiency
reliability, maintainability
Reveal Answer
efficiency, effectiveness
Effectiveness refers to whether the algorithm solves the problem correctly. Since both versions calculate the correct average, the effectiveness has not changed.
reliability, effectiveness
Neither reliability nor effectiveness is the primary improvement. Both algorithms are reliable and effective for a fixed group of 5, but the second version is better structured.
maintainability, efficiency
The second version is more maintainable because changing the team size only requires updating the groupSize variable rather than adding new lines of code. It is more efficient (concise and scalable) because it avoids code repetition.
reliability, maintainability
While maintainability is improved, reliability is not the main distinction. The first version is reliable for the specific case of 5 players; the loop primarily improves how the code is written and scaled (efficiency).
This data dictionary is for a table containing data on basketball players in a professional league.
Table: players
| Column name | Data type | Primary key? | Length |
|---|---|---|---|
| playernumber | VARCHAR | Yes | 2 |
| playerheight | INTEGER | ||
| playername | TEXT | ||
| teamname | VARCHAR | Yes | 10 |
The following SQL query returned an error on execution:
INSERT INTO players (teamname, playernumber, playername, playerheight)
VALUES ('Raptors', '2', 'Edward Lee', 183.5);
Which column needs to be adjusted for the query to work?
playernumber
playerheight
playername
teamname
Reveal Answer
playernumber
The value '2' is a string with a length of 1, which fits perfectly within the defined VARCHAR(2) constraint.
playerheight
The query attempts to insert 183.5 (a decimal value), but the column is defined as INTEGER. To store decimal values, the data type must be changed to FLOAT or DECIMAL.
playername
The value 'Edward Lee' is a standard string that is fully compatible with the TEXT data type.
teamname
The string 'Raptors' contains 7 characters, which is within the limit of the VARCHAR(10) definition.
This table contains the posts published to a rock climbing group on a social networking site.
Table: posts
| Date | Author | Content | Likes |
|---|---|---|---|
| 15/06/2019 | Lui Chan | Would anyone like to rock climb tomorrow? | 5 |
| 15/06/2019 | Lui Chan | Who is going to the boulder festival? | 15 |
| 14/06/2019 | Lui Chan | Who wants to go to yoga tonight? | 7 |
| 14/06/2019 | Amy Smith | Has anyone picked up a chalk bag? | 9 |
An SQL query is executed:
SELECT Date, Author, SUM(Likes)
FROM Posts
GROUP BY Date, Author
What is the output of this query?
| Date | Author | Content | SUM(Likes) |
|---|---|---|---|
| 15/06/2019 | Lui Chan | Would anyone like to rock climb tomorrow? | 20 |
| 14/06/2019 | Lui Chan | Who wants to go to yoga tonight? | 7 |
| 14/06/2019 | Amy Smith | Has anyone picked up a chalk bag? | 9 |
| Date | Author | SUM(Likes) |
|---|---|---|
| 15/06/2019 | Lui Chan | 27 |
| 14/06/2019 | Amy Smith | 9 |
| Date | Author | SUM(Likes) |
|---|---|---|
| 14/06/2019 | ||
| 15/06/2019 | Lui Chan | 27 |
| 14/06/2019 | Amy Smith | 9 |
| Date | Author | SUM(Likes) |
|---|---|---|
| 15/06/2019 | Lui Chan | 20 |
| 14/06/2019 | Lui Chan | 7 |
| 14/06/2019 | Amy Smith | 9 |
Reveal Answer
| Date | Author | Content | SUM(Likes) |
|---|---|---|---|
| 15/06/2019 | Lui Chan | Would anyone like to rock climb tomorrow? | 20 |
| 14/06/2019 | Lui Chan | Who wants to go to yoga tonight? | 7 |
| 14/06/2019 | Amy Smith | Has anyone picked up a chalk bag? | 9 |
This option incorrectly includes the Content column. The SQL query only specifies SELECT Date, Author, SUM(Likes), so Content should not appear in the output.
| Date | Author | SUM(Likes) |
|---|---|---|
| 15/06/2019 | Lui Chan | 27 |
| 14/06/2019 | Amy Smith | 9 |
This option incorrectly groups all of Lui Chan's posts together regardless of the date (summing ). Since the query uses GROUP BY Date, Author, posts by the same author on different dates must remain in separate rows.
| Date | Author | SUM(Likes) |
|---|---|---|
| 14/06/2019 | ||
| 15/06/2019 | Lui Chan | 27 |
| 14/06/2019 | Amy Smith | 9 |
This option displays incorrect sums and row structures. It aggregates all of Lui Chan's likes into one value () despite the different dates and includes a row with missing data that would not be generated by a standard GROUP BY clause.
| Date | Author | SUM(Likes) |
|---|---|---|
| 15/06/2019 | Lui Chan | 20 |
| 14/06/2019 | Lui Chan | 7 |
| 14/06/2019 | Amy Smith | 9 |
This option correctly groups the data by both Date and Author. Lui Chan has two distinct groups (15/06 with likes, and 14/06 with likes), while Amy Smith has one group (14/06 with likes).