Practice question · Select all that apply
A function takes a list of numbers. Select every input that is an edge case worth testing.
Hints
- Edge cases sit at boundaries: empty, single-element, first, last, or maximum.
- Two of the options are ordinary typical inputs, not boundaries.
Show the answer
- C. An empty list
- D. A list with exactly one element
- E. A list containing the largest allowed value
Why
An empty list, a single-element list and the largest value are all boundaries where bugs cluster. The two ordinary five- and three-number lists are typical cases, useful, but not the boundaries where most real bugs surface.
Practise Testing Small Programs
The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Testing Small Programs
- A program that passes one hundred typical-case tests is guaranteed to have no bugs.
- A function is meant to accept a whole number of items. Sort each test input by its kind.
- Order the steps of writing and running one test case.
- A test suite that passes on typical inputs can miss bugs that a handful of edge cases would catch…
- A test asserts that a function returns something, and passes even when the function returns the wrong answer.…