B.Eng. (Electronic Engineering)
Software Engineering 1
Session 1995-96
Exam 3 (Autumn Diet)

The examination consists of two separate exercises. Marks will be divided equally between the two exercises.

The two exercises are related, but can be attempted independently (i.e. you do not have to complete the first in order to attempt the second, or vice versa). It is strongly recommended that you plan your allocation of time between the two exercises carefully in advance, and stick to this allocation during the exam.

When you have completed this exam, your report should be emailed to the address:

exam3a@ugmail.eeng.dcu.ie

Do not email multiple copies of the report. If you experience difficulties in emailing the report, please ask for help from an invigilator.

Exercise 1: Analysis (50%)

If a voltage V, in volts, is applied to a resistor of resistance R, in tex2html_wrap_inline62 , the power dissipated P, in watts, will be given by the equation:

displaymath56

The program VPWR.C is supposed to prompt for and read in values for V and R, and then calculate and print out the corresponding power dissipation (P). It should do this repeatedly until a value of zero is entered for V, when it should terminate.

The program has various defects. You are required to correct all defects you can identify. For all changes that you make, the report should contain a clear statement of the change and a specific explanation of your rationale for the change. Of course, if you are making several similar or related changes, you may discuss these as a unit.

When you have reached the point where you think the program should work, then you should test it, and report on these tests. Carry out, and report on, further corrections if necessary.

Note carefully that you must not simply present a version of the program rewritten from scratch. You are required to identify the specific defects in the program you have been given.

Exercise 2: Synthesis (50%)

Develop a program which will prompt for, and read in, values for resistance (R), applied voltage (V), and maximum power rating ( tex2html_wrap_inline78 ) of a resistor. For this set of values, the program should then calculate, and output, the actual power dissipation in accordance with the equation given in exercise 1. The program should also compare this actual dissipation with the rated maximum dissipation for the resistor. If the actual dissipation is less than or equal to the maximum, the program should output PASS; otherwise it should output FAIL. Having completed this computation for one resistor, the program should then offer the user a choice between terminating, or repeating the calculation for a new resistor. The program should continue indefinitely (i.e. for as long as the user continues to request this).

You may develop this program from scratch, or, if you wish, you may reuse and augment your corrected program from Exercise 1. In either case, your program must conform to the following restrictions:

  1. The program must be divided into functions.
  2. The program may not use global variables--all variables must be local to some function. Use parameter passing and/or return values where appropriate to exchange information between functions.
  3. The program should demonstrate good coding practices with regard to spacing, indentation, comments etc.

Test your program severely. Record all test results.



McMullin@eeng.dcu.ie
Thu Jul 11 11:44:02 GMT 1996