25-Comp-A6 Software Engineering · May 2015
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
National Exams — May 2015 — 98-Comp-A6 Software Engineering. Three-hour, closed-book exam, no calculator permitted. Format: eight questions, candidates answer any five (all questions equal weight — each of the five counted questions is worth 20%; only the first five questions as they appear in the answer book are marked). All eight questions are solved below for completeness.
Reference texts: Sommerville, Software Engineering (10th ed., Pearson) — software process models, function-oriented and object-oriented design, software testing, distributed software engineering, real-time software engineering, reliability engineering, verification and validation; Pressman, Software Engineering: A Practitioner's Approach (9th ed.) — supplementary process/testing coverage; Coulouris, Dollimore, Kindberg & Blair, Distributed Systems: Concepts and Design — scalability, distributed objects, client-server architectures.
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.
Function-oriented design decomposes a system top-down into a hierarchy of functions (procedures), each of which transforms some input data into output data. Data is treated as a resource that flows between functions and is typically shared or held globally rather than encapsulated inside any one function; the functions themselves, not the data, are the primary unit of decomposition and reuse. The design is conventionally documented as a data-flow diagram (DFD), showing the functions as nodes and the data flowing between them as labelled arcs, refined into a structure chart that also shows the call hierarchy and control flow. This contrasts with object-oriented design, in which state and the operations that act on it are bundled together inside objects rather than kept as separate functions and shared data.
The cruise control system decomposes naturally into five functions connected by explicit data flows: capturing the driver's target speed, sensing the actual road speed, computing the error between them, computing a corrective throttle adjustment, and applying that adjustment to the physical throttle.
Set-Speed Input reads the driver's set-speed control (typically a resume/set button pair or a rotary dial) and outputs the current target speed. Road-Speed Sensor reads the vehicle's speed sensor (e.g. a wheel-speed transducer) and outputs the measured actual speed. Speed Comparator takes both values and computes the speed error (target minus measured). Throttle Controller is the core control function: it converts the speed error into a throttle-position adjustment using a feedback control law (e.g. a proportional-integral controller, so that a sustained error such as climbing a hill is corrected rather than just an instantaneous one). Throttle Actuator is the output function that drives the physical throttle-position actuator to the commanded position. Because the system must continuously track a moving target (the car's actual speed changes with road grade, wind and load) the whole pipeline executes as a fixed-rate control loop rather than once per driver action — every function re-executes on each sample period for as long as cruise control remains engaged.