Test 2: Class Section B

Test 2: Class Section B

Thursday 11th May 1995

This test will be made up of three parts:

  1. Debugging, running and testing a provided program.

  2. Making use of the above program in the development of a new program and then testing this extensively.

  3. 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.

Part 1 (40%)

The program MATMUL.C in supposed to take in two matrices, multiply them and print the result. 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.

Part 2 (40%)

Making use of the MATMUL.C program, derive an algorithm and develop the code to take in one matrix and evaluate its value to the nth power (the value of n to be defined by the user at runtime). The solution should then be printed to the screen. Test this program rigorously and describe all results.

Part 3 (20%)

Taking the operational MATMUL.C program which resulted from Part 1, make use of pointers to remove the necessity for the global definition of the variables Arows, Acols and Bcols and the arrays A, B and C (i.e. pointers must be passed between the various functions of the program). Test this program rigorously and describe all results.



McMullin@ugmail.eeng.dcu.ie
Wed May 3 15:25:21 BST 1995