Practice question · Select all that apply
Select every edge case the lesson says the word-frequency counter's tests should cover.
Hints
- Four of these are cases the program must decide how to handle; one is not a program behaviour at all.
- Ask which option describes a limitation of the hardware rather than a decision the code makes.
Show the answer
- A. An empty input file
- B. Punctuation attached to words
- C. Ties among the top ten counts
- D. Words differing only in capitalisation
Why
Empty input, punctuation, case-folding and ties are all points where the program must make a choice, and a test pins that choice down. A file bigger than the disk cannot exist to be read, so it is not a behaviour the program can define. Edge cases are decisions, not disasters.
Practise Integrated Programming Synthesis
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 Integrated Programming Synthesis
- A word-frequency counter needs to split text, normalise case, count occurrences and report the top results.…
- Order the tasks of building the word-frequency counter so that each one can be tested as soon as it is…
- A word-frequency program is asked to handle a 50 GB file that will not fit in memory. Which part of the…
- Sort each part of the word-frequency program by whether it can be written as a pure function or must carry…