Testing
8
0/4

A drone operations hub is writing an algorithm to validate the callsigns of commercial drones registering for flight space (for example, "DRONE7").

variable.length returns the number of characters in variable.
variable.lower returns the characters in variable in lower case.

    valid = false

    while (valid == false)

        callsign = input("Enter callsign: ")

        if (callsign.length >= 5) AND (callsign.length <= 12)

            registeredCallsign = callsign.lower

            valid = true

            print("Callsign registered")

        else

            print("Invalid callsign format")

        endif

    endwhile

The algorithm needs testing to ensure the decision block (if-else statement) behaves correctly.

Identify two different pieces of test data that can be used to test different outputs of the algorithm. Give the output from the program for each piece of test data.

[4]

Testing Questions

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.

PreviousNext

Testing Questions

  1. GCSE
  2. /Computer Science
  3. /Testing