Test 2: Class Section A
Test 2: Class Section A
Thursday 4th May 1995
This test will be made up of three parts:
- Debugging, running and testing a provided program.
- Making use of the above program in the development of a new
program and then testing this extensively.
- Making minor alterations to the original program in order to
improve the quality of the code, and/or to add additional
functionality.
Note that marks will be awarded purely on the quality of the content of
the final report. Therefore, at all stages of the test, please describe
plans, algorithms, problems encountered, tests carried out and, when the
required tasks have been completed, describe any conclusions drawn from
the exercise.
The program ENCODE.C in supposed to take
in five characters from the keyboard and encrypt them by:
- (i) reversing their order,
- (ii) shifting the first character by one, the second by two
and so on.
The resultant code is then printed to the screen. There are, however, a
number of errors in the program.
- (a) Present a reformatted version of this program which
demonstrates satisfactory practice for spacing, line
breaking and indentation. Add comments where relevant to
improve the understandability of the program.
- (b) Correct any compiler / linker errors. In the case of
compiler warnings, either resolve them or explain why
they can be ignored.
- (c) When the program compiles successfully, run it and
establish the presence of any runtime errors. Correct
these.
- (d) Test the program extensively to ensure correct
operation.
Write a program to decrypt the output of the above encoder. You may
either do this through reuse of code from the original
ENCODE.C program,
or you may create your own version of the program. However, the
following guidelines must be followed:
- The program must be divided into functions.
- No global variables - all variables must be local
to some function. Use parameter passing and/or return values
where appropriate to exchange information between functions.
- The program should not be restricted to decoding five characters
only - any number of characters (up to 50) may be entered and
completion of entry should be signified by EOF.
- The program should demonstrate good coding practices with regard
to spacing, comments etc.
Test this program rigorously - this may be done in conjunction with the
original encoder. Describe all results.
It is required to extend the original encoder so that it repeatedly
takes in five characters and prints the equivalent code. It should
continue doing so until an EOF is encountered, at which stage the
program should terminate. Test this program rigorously and detail all
results.
McMullin@ugmail.eeng.dcu.ie
Wed May 3 15:20:39 BST 1995