25-Comp-A6 Software Engineering · December 2014
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
National Exams — December 2014 — 98-Comp-A6 Software Engineering. Three-hour, closed-book exam, no calculator permitted. Format: ten questions, candidates answer any six (all questions equal weight — each question carries 20 marks, so the paper is marked out of 120; only the first six questions as they appear in the answer book are marked). All ten questions are solved below for completeness.
Reference texts: Sommerville, Software Engineering (10th ed., Pearson) — software process models, object-oriented and function-oriented design, real-time systems, software testing, configuration management, dependable/critical systems, reliability engineering, component-based software engineering; Pressman, Software Engineering: A Practitioner's Approach (9th ed.) — supplementary process/testing/quality coverage; IEEE/ISO 12207 — software life-cycle processes; SWEBOK — body-of-knowledge cross-reference.
Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.
A real-time software system is one whose correctness depends not only on the logical result it produces but also on the time at which that result is produced. It must sense and respond to stimuli arising from its physical environment — usually as an embedded component controlling or monitoring hardware — within deadlines that are dictated by that environment rather than chosen by the software designer; a logically correct output delivered after its deadline is, for a real-time system, a failure of the same kind as a logically incorrect output.
In a hard real-time system, missing a deadline constitutes a system failure with unacceptable or catastrophic consequences — the deadline is absolute, and the correctness of the whole system depends on every relevant deadline being met (a flight-control surface command, an engine-ignition timing pulse, an insulin-pump dosing cycle). In a soft real-time system, an occasional missed deadline degrades the quality or usefulness of the result but does not constitute outright failure and does not endanger the system — a late video frame causes a visible glitch, a late audio sample causes an audible click — and the system's acceptability is judged statistically (the proportion of deadlines that may be missed) rather than by an absolute guarantee on every single one.
A refrigerator controller is a small, continuously-running reactive system: it never terminates, and every one of its outputs is triggered either by an environmental stimulus or by the passage of time.
| Stimulus | Expected response |
|---|---|
| Interior temperature sensor reading rises above the set-point (compartment too warm) | Turn compressor ON |
| Interior temperature sensor reading falls to the set-point (compartment cold enough) | Turn compressor OFF |
| Door switch opens | Turn interior light ON; if held open beyond a timeout, sound the door-ajar alarm |
| Door switch closes | Turn interior light OFF; cancel any pending door-ajar alarm |
| Defrost timer elapses (periodic, e.g. every 8 hours of compressor run-time) | Suspend cooling, energize the defrost heater for a fixed duration, then resume normal control |
| Owner adjusts the temperature set-point dial | Update the stored set-point used by the compressor control loop |
| Ice-maker water-level/bin-full sensor reports bin not full and tray empty | Open the fill valve to make a fresh batch of ice |
| Power failure detected, then power restored | On restoration, resume the compressor duty cycle from a safe (compressor-off, brief delay) state rather than restarting instantaneously, to protect the compressor motor |
| Interior temperature sensor reading exceeds a food-safety high limit for longer than a set duration | Sound a distinct high-temperature warning alarm (safety condition, not routine cycling) |
The machine begins on-hook in Idle. An incoming call moves it to Ringing, and after the configured number of rings it auto-answers into Play Greeting. Once the greeting completes, the machine moves to Listen for Dial-In Tones — this single state serves both the ordinary caller (who says nothing and simply waits) and the phone's owner dialling in remotely (who enters a numeric access code as DTMF tones). If a valid owner code is detected before the listening window expires, the machine transitions to Remote Playback and plays back the stored messages over the phone line; when the owner hangs up or playback finishes, the machine returns directly to Idle with no message count change, since remote access is not itself an incoming message. If no tones arrive, or an invalid code is entered, the machine instead transitions to Recording Message and records the caller's message; when the caller hangs up or the maximum recording length is reached, the machine increments the accepted-message counter, updates the LED display with the new total, and returns to Idle.