An autonomous drone telemetry system validates a telemetry broadcast key using the following algorithm:
variable.length returns the number of characters in variable.
isValid = false
while (isValid == false)
broadcastKey = input("Enter the broadcast key: ")
if (broadcastKey.length >= 6) AND (broadcastKey.length <= 11)
isValid = true
print("Telemetry stream connected")
else
print("Connection rejected, invalid key length")
endif
endwhile
The algorithm needs testing to ensure the validation block (if-else statement) works correctly.
Identify two different pieces of test data that can be used to test different outputs of the algorithm. Give the expected output from the program for each piece of test data.
Practise OCR GCSE Computer Science Testing with exam-style questions for GCSE Computer Science. 21 questions, matched to the OCR GCSE Computer Science (J277) specification and written in Component 01 and Component 02 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.