QCAA Digital Solutions Prototype digital data exchanges
15 sample questions with marking guides and sample answers · Avg. score: 55%
When blocks of code reduce the complexity of a system, this is known as
iteration.
selection.
sequencing.
modularisation.
Reveal Answer
iteration.
Incorrect. Iteration refers to the repetition of a block of code, such as a loop, rather than organizing code to reduce system complexity.
selection.
Incorrect. Selection involves using conditions (like if/else statements) to determine which path a program takes, not breaking a system into simpler blocks.
sequencing.
Incorrect. Sequencing is the fundamental process of executing code instructions in a specific, top-to-bottom order.
modularisation.
Correct. Modularisation is the practice of dividing a program into separate, independent blocks (modules or functions), which abstracts details and significantly reduces overall system complexity.
Refer to Stimulus 3 in the stimulus book.
A secondary school stores encrypted student results in a database. To access their results, students must log in using their student ID and password. Login details are checked against the database to ensure only authorised students can gain access.
Passwords are encrypted for added security. Once logged in, students must enter a public decryption key to have their results displayed.
The database contains overall results for all subjects and students. Only results linked to the relevant student ID are displayed; students cannot view other students' results.
The algorithm for this system is incomplete. Complete the algorithm using the supplied code library.
BEGIN
GET studentID from input form
GET password from input form
GET key from input form
Reveal Answer
BEGIN
IF checkLogin(studentID, hashPassword(password)) THEN
Results = getResults(studentID)
FOR i = 0 to (size of Results)-1
Display decryptData(key, results[i])
ENDFOR
ELSE
Display “Access denied”
ENDIF
END
| Descriptor | Marks |
|---|---|
Symbolises, without logic errors, an algorithmic statement for password encryption using 'hashPassword' | 1 |
Symbolises, without logic errors, an algorithmic statement for checking student ID and hashed password using 'checkLogin' | 1 |
Symbolises, without logic errors, an algorithmic statement for handling login errors | 1 |
Symbolises, without logic errors, an algorithmic statement for retrieving data for specific student ID using 'getResults' | 1 |
Symbolises, without logic errors, an algorithmic statement for outputting data for specific student ID using 'decryptData' | 1 |
Effectively uses pseudocode conventions | 1 |
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.
Refer to Stimulus 2 in the stimulus book.
Use pseudocode to symbolise a one-time pad encryption algorithm with any lower case letters. Users must input the plain text and key.
Reveal Answer
| Descriptor | Marks |
|---|---|
Symbolises, without logic errors, an algorithmic statement for user input of text | 1 |
Symbolises, without logic errors, an algorithmic statement for user input of key | 1 |
Symbolises, without logic errors, an algorithmic statement for 'indexOf' sub-procedure | 1 |
Symbolises, without logic errors, an algorithmic statement for 'lengthOf' sub-procedure | 1 |
Symbolises, without logic errors, an algorithmic statement for 'checkLowerCase' sub-procedure | 1 |
Symbolises, without logic errors, an algorithmic statement for 'lowerCaseAlphabet' | 1 |
Effectively uses pseudocode conventions | 1 |
Evaluate the encryption algorithm developed in Question 13a) by performing a desk check. Use the plain text and key provided. Specify all inputs and outputs in table form.
Plain text: Queens
Key: ryjwah
Example output: hsnanz
Reveal Answer
userText = queens
opyKey = ryjwah
Letter of userText = q u e e n s
userText letter index= 16 20 4 4 13 18
Letter of optKey = r y j w a h
otpKey letter index = 17 24 9 22 0 7
Encryption index = 7 18 13 0 13 25
cipherOutput = h s n a n z
| Descriptor | Marks |
|---|---|
Demonstrates accurate use of one programming feature that specifies all inputs and outputs in table form | 1 |
Demonstrates accurate use of a second programming feature that specifies all inputs and outputs in table form | 1 |
Demonstrates accurate use of a third programming feature that specifies all inputs and outputs in table form | 1 |
Demonstrates accurate use of a fourth programming feature that specifies all inputs and outputs in table form | 1 |
Demonstrates accurate use of a fifth programming feature that specifies all inputs and outputs in table form | 1 |
The algorithm outputs a data set according to values a user inputs.
1 BEGIN
2 INPUT firstNum
3 INPUT secondNum
4 FOR i = 1 TO firstNum
5 FOR j = 1 TO secondNum
6 CALCULATE result = i * j
7 OUTPUT i "*" j "=" result
8 ENDFOR
9 ENDFOR
10 END
If the user inputs firstNum = 6 and secondNum = 10, how many times would line 6 be executed?
1
6
10
60
Reveal Answer
1
This option assumes the code runs only once, ignoring the repetition caused by the FOR loops.
6
This is the number of times the outer loop runs (), but for each of those iterations, the inner loop runs times.
10
This is the number of times the inner loop runs () for a single iteration of the outer loop, but the outer loop repeats this process times.
60
Because the loops are nested, the total number of executions is the product of the outer loop count and the inner loop count: .
A retail store uses facial recognition to send text messages about sale items to consenting customers while they are in the store.
This use of data personally impacts customers through
invasion of privacy.
increased data accuracy.
improved store inventory management.
a more personalised shopping experience.
Reveal Answer
invasion of privacy.
Since the question specifies that the customers are "consenting," they have agreed to the data collection, so it is not considered an invasion of privacy in this context.
increased data accuracy.
Data accuracy is a technical characteristic of the system or a benefit for the store's records, rather than a direct personal impact on the customer's experience.
improved store inventory management.
Improved inventory management is an operational benefit for the business, not a personal impact on the individual customer.
a more personalised shopping experience.
The technology allows the store to identify specific individuals and direct relevant information to them, thereby tailoring the service to create a personalised experience.
A one-time pad algorithm encrypts an 8-character word and outputs the result. The algorithm uses 0 as the first index in an array. There are four errors on lines 9 to 21 inclusive.
1 BEGIN
2 INPUT word
3 word = word converted to lowercase
4 plainText = word converted to an array
5 //The GenerateOTPKey function will return an array of 8 random numbers
6 key = GenerateOTPKey()
7 cipherText = array of 8 blank characters
8 alphabet = lowercase alphabet converted to an array
9 FOR i = 0 to 9
10 alphabetLocation = -1
11 FOR j = 0 to 25
12 IF plainText[j] = alphabet[i]
13 alphabetLocation = j
14 ENDIF
15 ENDFOR
16 //Check if not found
17 IF alphabetLocation ≥ 0 THEN
18 cipherText[i] = alphabet(alphabetLocation + key[i])mod 26
19 ENDIF
20 ENDFOR
21 OUTPUT cipherText[i]
22 END
Use pseudocode to correct the four errors on lines 9 to 21. Justify your response.
Reveal Answer
Line 9:
FOR i = 0 to 7
Upper boundary of FOR Loop should be 7, otherwise it will look for values that don't exist in the plainText array.
Line 12:
IF plainText[i] = alphabet[j]
Indexes in the IF statement should be switched — the variable i is the index for the plaintext, the variable j is for the alphabet. If this is not corrected, the pseudocode will be looking for letters in the plainText array that don't exist.
Line 18:
cipherText[i] = alphabet[(alphabetLocation + key[i]) mod 26]
Bracket should be added to after the mod (otherwise it will be trying to perform a mod operation on a letter of the alphabet).
Line 21:
OUTPUT cipherText
Index should be removed from output statement as this will cause it to only output one character (or none due to scoping issues).
| Descriptor | Marks |
|---|---|
Logically symbolises a solution for the error on line 9 | 1 |
Logically symbolises a solution for the error on line 12 | 1 |
Logically symbolises a solution for the error on line 18 | 1 |
Logically symbolises a solution for the error on line 21 | 1 |
Justifies symbolised solution for line 9 | 1 |
Justifies symbolised solution for line 12 | 1 |
Justifies symbolised solution for line 18 | 1 |
Justifies symbolised solution for line 21 | 1 |
Does not introduce new logic errors | 1 |
Desk check the algorithm to predict the output for numX = 8 and numZ = 5.
BEGIN
SET numX user input
SET numZ user input
IF numX < 10 AND numZ > 10 THEN
OUTPUT ‘Condition 1’
ELSE numX > 5 OR numZ < 5 THEN
OUTPUT ‘Condition 2’
ELSE numX > 5 OR numZ < 10 THEN
OUTPUT ‘Condition 3’
ELSE
OUTPUT ‘Condition 4’
ENDIF
END
Condition 1
Condition 2
Condition 3
Condition 4
Reveal Answer
Condition 1
This condition requires both and . While is true, is false, so the AND operation evaluates to false.
Condition 2
This condition checks if OR . Since , the first part () is true, making the entire OR statement true.
Condition 3
Although the condition is true, this branch is part of an IF-ELSE structure. Because the previous condition (Condition 2) was already met, the algorithm stops there and does not evaluate this branch.
Condition 4
The final ELSE block only executes if all preceding conditions evaluate to false. Since Condition 2 was true, this block is skipped.
Complete the Caesar encryption algorithm with the correct statement at line 5.
0 BEGIN
1 INPUT userText AS STRING
2 INPUT userShift AS INTEGER
3
4 FOR each character IN userText
5
6 result = result + newCharacter
7 ENDFOR
8 OUTPUT result
9 END
newCharacter = userText + userShift
newCharacter = character + userShift
newCharacter = character - userShift
newCharacter = character + userShift MOD 26
Reveal Answer
newCharacter = userText + userShift
This incorrectly attempts to add the shift value to the entire input string (userText) rather than the individual character currently being processed in the loop.
newCharacter = character + userShift
While this adds the shift to the character, it fails to handle the "wrap-around" logic (e.g., shifting 'z' to 'a'). Without the modulo operator, the result could be a non-alphabetic symbol.
newCharacter = character - userShift
This subtracts the shift (which is typically used for decryption, not encryption) and also lacks the necessary modulo operator to handle wrapping around the alphabet.
newCharacter = character + userShift MOD 26
This is the correct logic for a Caesar cipher. It adds the shift to the character and uses MOD 26 to ensure the value wraps around the alphabet (cycling from Z back to A) and remains a valid letter.
Desk check the algorithm to determine its output.
BEGIN
SET X = 6
SET Y = 12
WHILE (X < Y)
INCREMENT X
Y = PROCESS1(X, Y)
ENDWHILE
OUTPUT Y
END
BEGIN PROCESS1 (A, B)
CALCULATE C = (B - A) * 2
RETURN C
END PROCESS1
The output value is
-10
4
8
10
Reveal Answer
-10
This incorrect value likely results from reversing the subtraction order in the function to during the first iteration, yielding .
4
First iteration: becomes 7, becomes . Second iteration: becomes 8, becomes . The loop ends because .
8
This is the final value of variable when the loop terminates, but the algorithm explicitly outputs variable .
10
This is the value of after the first iteration. However, since is still less than , the loop executes a second time.
This algorithm determines the total points a player receives from rolling a standard six-sided dice three times.
BEGIN
SET points = 0
SET count = 0
REPEAT
SET result = random number between 1 and 6 inclusive (roll die)
SET number on die as result
IF result = 1 THEN
points = points + 100
ELSE
IF result = 5
points = points + 50
ENDIF
ENDIF
INCREMENT count
UNTIL count = 3
END
How many points will a player receive if they roll a 2, then a 3, followed by a 5?
50
100
150
200
Reveal Answer
50
The rolls of 2 and 3 do not meet the conditions to add points, but the roll of 5 triggers the condition IF result = 5, adding 50 points for a total of .
100
This score would result from rolling a 1, which awards 100 points. However, the sequence (2, 3, 5) does not contain a 1.
150
This total implies rolling both a 1 (100 points) and a 5 (50 points). The provided sequence only contains a 5, so the 100 points are not awarded.
200
This total would require rolling two 1s (), which does not match the outcomes in the sequence 2, 3, 5.
An algorithm performs an operation.
0 BEGIN
1 SET x = 0
2 FOR i FROM 1 TO 100
3 IF is Prime(i) THEN
4 x = x + i
5 ENDIF
6 ENDFOR
7 OUTPUT x
8 END
What does the algorithm output?
whether a given number is prime
the sum of the first 100 prime numbers
the prime numbers between 1 and 100, including 100
the sum of the prime numbers between 1 and 100, including 100
Reveal Answer
whether a given number is prime
The algorithm outputs a single numerical value accumulated in variable , not a boolean (true/false) result regarding a specific number's primality.
the sum of the first 100 prime numbers
The loop iterates through the numbers to , summing the primes found in that range. It does not continue until it finds the first 100 distinct prime numbers.
the prime numbers between 1 and 100, including 100
The algorithm outputs the variable , which is a sum. It does not output the list of individual prime numbers found.
the sum of the prime numbers between 1 and 100, including 100
The variable acts as an accumulator, adding the value of to the total only when is prime, for every integer from to .
In an online silent auction, items are posted on a public website and participants post a secret bid on the items they would like to purchase. Bidders cannot see each other’s bids. The bidding period is 7 consecutive days.
At the end of the auction, all bid values are revealed on the website and the highest bidder pays the amount they posted to obtain the item.
Explain how checksums, encryption and authentication would improve the security of the data exchange in this scenario.
Reveal Answer
A checksum algorithm would be used to inspect the binary representation of auction data. If the checksum from the user is different from the checksum on the server, it means that the data has been corrupted or manipulated.
Encryption would be used to scramble the auction data to make it impossible to read in transit, but allowing it to be decrypted by the authorised recipient with a secret key.
Authentication would be used to verify the identity of the participant by using a digital signature or authentication code. A digital signature confirms that the bidder is who they say they are.
| Descriptor | Marks |
|---|---|
Explains how the security of the data exchange would be improved through checksums | 1 |
Explains how the security of the data exchange would be improved through encryption | 1 |
Explains how the security of the data exchange would be improved through authentication | 1 |
Recommend one encryption method to securely store auction data and justify your response.
Reveal Answer
I would recommend AES for encrypting auction data to avoid a security breach. AES supersedes DES and 3DES and uses 128-bit blocks with 128, 192 and 256-bit encryption keys, whereas DES and 3DES use 64-bit blocks and key encryption. DES and 3DES are older ciphers and easily cracked in as little as one day, which would provide an opportunity for a hacker to gain access to auction data before the bids are revealed.
| Descriptor | Marks |
|---|---|
Recommends a valid encryption method | 1 |
Effectively justifies the recommended encryption method | 1 |
Refer to Stimulus 1 in the stimulus book.
Describe the listed algorithm constructs and identify one example of each from the stimulus. Use corresponding line numbers to identify examples.
Assignment:
Example:
Condition:
Example:
Iteration:
Example:
Reveal Answer
Assignment: A value (stated or calculated) stored in a variable/memory location.
Example: Line 13, value = 0.04.
Condition: A comparison that retrieves a true or false value (or the value of a Boolean variable).
Example: Line 12, IF depositAmount <= 10000.
Iteration: A group of algorithmic statements that are repeated while a condition is met.
Example: Lines 25–27
FOR i = 0 TO years
deposit = depositAmount + depositAmount x interestRate
NEXT i
| Descriptor | Marks |
|---|---|
Describes assignment | 1 |
Describes iteration | 1 |
Describes condition | 1 |
Identifies an example of assignment | 1 |
Identifies an example of condition | 1 |
Identifies an example of iteration | 1 |
Explain the purpose of modularisation and identify an example of how it is used in the stimulus. Use corresponding line numbers in your response.
Reveal Answer
Modularisation breaks sections of code into smaller chunks so the algorithm is easier to understand, and allows the same code to be used in different parts of the application. For example, calculateInterestRate is a separate module (lines 11–22) and is called/used at line 5. It returns a value (line 21) which is stored in interestRate (line 5).
| Descriptor | Marks |
|---|---|
Explains the purpose of modularisation | 1 |
Identifies an example of how modularisation is used | 1 |
A mobile application (app) allows car owners to remotely unlock their cars if they lock the keys inside or their keys malfunction. Once users have created an account, they can request a remote unlock by entering their username and password.
The user data that is required to set up an account includes:
- full name
- date of birth
- home address
- driver licence number
- vehicle make, model and colour
- vehicle registration.
Analyse the information and evaluate risks to data confidentiality, integrity and availability for this app. Justify your response with three examples.
Reveal Answer
A data confidentiality risk is the possibility that an unauthorised person could observe the user data in transit. For example, the app requires a password for the user to log in and the data would need to be encrypted so that it cannot be stolen.
A data integrity risk is the possibility that the data could become corrupted, lost or be maliciously manipulated. For example, the wrong car might be unlocked or a hacker might use the data to cause distress.
A data availability risk is the possibility that someone may interfere with transmission to prevent data packets from reaching the intended destination, allowing them to access the person's car so that they can steal it.
| Descriptor | Marks |
|---|---|
Logically evaluates risks to data: confidentiality | 1 |
Logically evaluates risks to data: integrity | 1 |
Logically evaluates risks to data: availability | 1 |
Justifies this evaluation by providing a coherent example of a risk to data: confidentiality | 1 |
Justifies this evaluation by providing a coherent example of a risk to data: integrity | 1 |
Justifies this evaluation by providing a coherent example of a risk to data: availability | 1 |
Identify a relevant Australian Privacy Principle and explain an ethical consideration when using app data.
Reveal Answer
Australian Privacy Principle: Security of personal information. Allow an administrator to de-identify or destroy personal information once it is no longer in use.
Ethical consideration: Security of personal information is important if the user sells their car, or if the car is no longer in use. The user should not be getting unnecessary calls or marketing materials for a service they no longer use or for a car they no longer own, and it would be unsafe for the original owner to still have access to the vehicle once it has been sold.
| Descriptor | Marks |
|---|---|
Identifies a relevant Australian Privacy Principle (APP) | 1 |
Logically explains an ethical consideration relating to the identified APP | 1 |
You discover that the app uses a Caesar cipher to encrypt data, allowing you to intercept a password in transit. Perform a desk check for five iterations to decrypt the password ‘KYIWW’.
Reveal Answer
ABC DE FG H I J K L M N O P Q R S T U V W X Y Z
| KEY SHIFT | PASSWORD |
|---|---|
| 0 | K Y I W W |
| 1 | J X H V V |
| 2 | I W G U U |
| 3 | H V F T T |
| 4 | G U E S S |
| Descriptor | Marks |
|---|---|
Performs a desk check that decrypts the password using iterations | 1 |
Contains no errors | 1 |
A friend is interested in learning more about encryption. Use pseudocode to symbolise a simple Caesar cipher as a demonstration.
Reveal Answer
BEGIN
INPUT string plainText
INPUT int keyShift
SET string alphabet =ABCDEFGHIJKLMNOPQRSTUVWXYZ
SET encryptedText = ""
FOR each character in plainText
SHIFT character by keyShift
APPEND letter to encryptedText
END FOR
RETURN encryptedText
END
| Descriptor | Marks |
|---|---|
Symbolises INPUT for password string | 1 |
Symbolises INPUT for key or shift integer | 1 |
Symbolises declarative statement for alphabet | 1 |
Symbolises a FOR loop to traverse password one character at a time | 1 |
Symbolises a function to encrypt password one character at a time, using the key | 1 |
Symbolises RETURN for encrypted password | 1 |
Symbolises an algorithm with no logic errors | 1 |
Effectively uses pseudocode conventions | 1 |