Answer all questions below — one tab per question. Q4 has an interactive playground. Your answers auto-save in this browser; export them as JSON at the bottom when done.
Test the UNSW Lecture-Theatre Booking system with Decision-Table testing. The system evaluates multi-valued conditions across several inputs to decide whether a booking is Booked, Wait-listed, or Rejected. Rules are checked one by one and the first matching rule applies.
| Input | Domain values | In your submission |
|---|---|---|
| room_size | Small, Medium, Large | 1=Small, 2=Medium, 3=Large |
| time_slot | Morning, Afternoon, Evening | 1=Morning, 2=Afternoon, 3=Evening |
| week | 1 to 12 | Numeric as is |
| equipment | Standard, AV, ComputerLab, Hybrid | 1=Standard, 2=AV, 3=ComputerLab, 4=Hybrid |
| staff_role | Academic, Admin, Guest | 1=Academic, 2=Admin, 3=Guest |
| Code | Status | Typical reason |
|---|---|---|
| 0 | Booked | Request satisfies all constraints; first available room assigned |
| 1 | Wait-list | Request valid but cannot be immediately fulfilled |
| 2 | Rejected | Request violates system rules or contains invalid input |
The program checks each rule one by one.
Assume that whenever a valid request is not blocked by Rules A–F, at least one matching theatre is always available.
Notation. ! = not; / = alternative; - = a range (e.g. room_size 1-3) or a don't-care. Week ranges are inclusive. The Default row applies when inputs are valid but match no prior rule. If a rule is already caught by an earlier rule, its outcome is N/A. Invalid rows use an out-of-domain value such as room_size 0 or week 13. Exactly one table below is correct — select it.
Draw the control-flow graph for binary_search. Below are four candidate CFGs, written as complete DOT graphs and rendered. Exactly one is correct — select it.
Develop a test suite achieving loop-boundary coverage (loop runs 0, 1, and 2 times). Fill each circled blank. Recall mid = int(round((top+bott)/2.0)).
Marking: each loop case = 1 mark; within a case, one wrong blank −0.5, two or more wrong −1.
The Q3 suite reaches loop-boundary coverage, but coverage does not guarantee fault detection. This question asks you to demonstrate that gap on the binary_search function above.
(a) Introduce exactly one single-line bug into binary_search so that all three Q3 tests still pass (the bug is invisible to the Q3 suite).
(b) Provide one extra test case — with target, key, the original output, and the variant output — that distinguishes the variant from the original (original passes it, variant fails).
Use the playground: edit the function to your variant, enter your distinguishing test, and press Run check. It reports whether your variant still passes the Q3 suite and whether your test separates the two.
(a) Describe your one-line change (form from → to):
Calculate the Halstead programming effort for the following code (parentheses are not counted as operators):