The testing stage

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

The testing stage

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which statement describes the testing stage of the program development life cycle?
A The programmer writes the first lines of code for the program
B The finished program is run with test data to check it works and meets the requirements
2. During the testing stage, what is the actual output of the program compared with?
A The expected output
B The programmer's comments
3. A tester runs the program and the actual output does not match the expected output. What happens next?
A The program is accepted because it ran without crashing
B The error goes back to the coding stage to be fixed
4. Which is the best description of what the tester checks against?
A Every requirement from the analysis stage is met
B Only the requirements that are easy to test
5. True or false: in the testing stage, the whole finished program is run.
A True: the complete program is run with test data
B False: only single lines of code are ever run

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Expected result: 45, Actual result: 54 AChecking that a requirement is met by running the program with test data
2Requirement: Accept marks from 0 to 100. Test: enter 101 and check it is rejected BTesting -> error found -> Coding -> Testing
3Testing is the final stage of the PDLC, where the finished program is run to see if it works correctly CErrors found in testing must go back to coding to be fixed. There is no stage after testing to hide them in.
4When testing finds an error, the program goes back to the coding stage to be fixed and then tested again DAnalysis -> Design -> Coding -> Testing
5The program is tested only on one line of code, so it must work EThe results do not match, so an error has been found and must be fixed
6Test result is different from expected, so skip it and move on to the next stage FTesting means running the whole finished program, not just one part. Other parts could still contain errors.

Definitions

Testing stage

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
// The final stage of the PDLC is _______
2.
IF Actual _ Expected THEN OUTPUT "Pass" ENDIF
3.
IF Actual __ Expected THEN OUTPUT "Fail" ENDIF
4.
IF RequirementsMet = ____ THEN OUTPUT "Testing complete" ENDIF
5.
OUTPUT "Errors found: return to ______"

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Expected ← 10
B Actual ← 5 * 2
C IF Actual = Expected THEN
D OUTPUT "Test failed"
E ENDIF
Question 2
A PassedAll ← TRUE
B Errors ← 1
C IF Errors > 0
D PassedAll ← FALSE
E ENDIF
Question 3
A Expected ← 7
B Actual = 3 + 4
C OUTPUT "Expected: ", Expected
D OUTPUT "Actual: ", Actual
Question 4
A DECLARE Expected : STRING
B Expected ← 12
C Actual ← 3 * 4
Question 5
A Errors ← 2
B IF Errors > 0 THEN
C OUTPUT "Go to design"
D ELSE
E OUTPUT "Testing complete"
F ENDIF

Answer Key

The testing stage
Section A: Quick Questions
Q1
B — The finished program is run with test data to check it works and meets the requirements
Q2
A — The expected output
Q3
B — The error goes back to the coding stage to be fixed
Q4
A — Every requirement from the analysis stage is met
Q5
A — True: the complete program is run with test data
Section B: Match the Pairs
Q1
Expected result: 45, Actual result: 54 → The results do not match, so an error has been found and must be fixed
Q2
Requirement: Accept marks from 0 to 100. Test: enter 101 and check it is rejected → Checking that a requirement is met by running the program with test data
Q3
Testing is the final stage of the PDLC, where the finished program is run to see if it works correctly → Analysis -> Design -> Coding -> Testing
Q4
When testing finds an error, the program goes back to the coding stage to be fixed and then tested again → Testing -> error found -> Coding -> Testing
Q5
The program is tested only on one line of code, so it must work → Testing means running the whole finished program, not just one part. Other parts could still contain errors.
Q6
Test result is different from expected, so skip it and move on to the next stage → Errors found in testing must go back to coding to be fixed. There is no stage after testing to hide them in.
Section C: Definitions
Q1
Testing stage — The final PDLC stage: run the finished program with test data, compare results with expected results, check every requirement is met, and send any errors back to coding.
Section D: Fill in the Blanks
Q1
// The final stage of the PDLC is testing
Q2
IF Actual = Expected THEN OUTPUT "Pass" ENDIF
Q3
IF Actual <> Expected THEN OUTPUT "Fail" ENDIF
Q4
IF RequirementsMet = TRUE THEN OUTPUT "Testing complete" ENDIF
Q5
OUTPUT "Errors found: return to coding"
Section E: Spot the Error
Q1
D — The actual result equals the expected result, so the test has passed. The line should be OUTPUT "Test passed".
Q2
C — An IF statement must have THEN at the end of the condition. It should be IF Errors > 0 THEN.
Q3
B — Cambridge pseudocode stores a value in a variable with the assignment arrow ←, not =. It should be Actual ← 3 + 4.
Q4
A — Expected stores the whole number 12, so it must be declared as INTEGER, not STRING.
Q5
C — When testing finds errors, the program goes back to the coding stage to be fixed. The line should be OUTPUT "Return to coding".