Binary searching - Answers
These answers relate to testing, which is Q2.
Testing code is a whole area for explanation and the topic should be introduced early on and constantly revisited. Tests are usually split up into black box testing, white box testing, alpha testing, beta testing, unit testing, integration testing and customer acceptance testing. The following tests come under the banner of black box testing and the kinds of tests that students might think of doing include:
Having an empty list and searching for a piece of data.
Having a list with data in and searching for a piece of data that doesn't appear in the list.
Having a list with data in and searching for a piece of data that appears once in the list.
Having a list with data in and searching for a piece of data that appears many times in the list.
Entering in nothing for the data to search for.
Entering in a decimal number e.g. 4.7 for the number to search for.
Entering in a word rather than a number e.g. ten for the number to search for.
Entering in a negative number when asked for the number of items in the list.
Entering in a word rather than a number e.g. ten when asked for the number of items in the list.
Pupils may be able to think of other 'black box' tests they can do.
Back