Question 1 Report
The organiser of a night market needs a program to allocate stalls. Each trader enters a business name, a stall width, an electricity request and a contact telephone number. The system calculates the total width used on each row of the market. Before a record is saved, the program must reject impossible input and give the trader a useful message. The programmer has written a subroutine named checkWidth.
(a) State the data type for electricityRequested. [1]
(b) Describe the purpose of a presence check on the business name. [1]
(c) Explain why a range check is appropriate for stall width. [2]
(d) Suggest two normal test data values for checkWidth, if the permitted width is from 1.0 m to 4.0 m inclusive. [2]
(a) electricityRequested should be Boolean, because the request has two states: requested or not requested. [1]
(b) A presence check prevents an empty or blank business name from being accepted. [1]
(c) A range check ensures stall width is between the permitted minimum and maximum. This prevents an allocation that is too narrow, too wide, or unrealistic. [2]
(d) Two normal test values are 1.0 m and 2.5 m. Both are within the inclusive permitted range of 1.0 m to 4.0 m, so both should be accepted. A value of 4.0 m is also acceptable. [2]
Everything you need to excel in your exams