Practice question · Multiple choice
Testing a program on a hundred inputs and finding no failures does not prove it correct. Why is testing nonetheless the dominant method, rather than proof?
Hints
- How many possible inputs does a function taking two 64-bit integers have?
- Ask what a test suite costs to write compared with a correctness proof.
Show the answer
B. Because tests are cheap, catch most defects, and scale to real systems.
Why
It is the counterexample asymmetry from Unit 1: a universal claim cannot be established by finite checking, and a function on two 64-bit integers has more inputs than could be tested in the lifetime of the universe. Testing dominates on economics rather than logic, and formal verification is real, with seL4 and CompCert both carrying machine-checked proofs.
Practise Programming for Mathematics
The app has 6 more questions on this lesson, and keeps your place in the course. Mathematics I is free to start.
More questions on Programming for Mathematics
- Sort each task by the kind of computation it needs.
- In a Monte Carlo estimate of pi, points are scattered in a unit square containing a quarter-circle and the…
- A test suite passes and the program is wrong. Which of these does testing structurally fail to catch?
- Complete the description of a simulated result.
- Order the steps of using a program to investigate a conjecture.
- Because a computer performs arithmetic faster and more reliably than a human, a numerical result it prints…