August 2000 QUESTION 1 (Compulsory) Total Marks: 30 Marks |
Click here to access other
questions
Click to access |
(a) (i) Declare an integer variable,
a, defined elsewhere in the program code. [1 mark] (b) (i) Briefly describe the storage
allocation of a struct. [2 marks] (c) State the result of applying the
arithmetic operators in the following expressions, given x= 5, y=
10 and z=15, in each statement: (d) State the result of applying the
bitwise operators in the following expressions, given x= 23, y= 115
and z=2, in each statement: (e) Explain, step by step, with reference
to the action of each statement in the source code, the effect of
calling the following procedure with two integer reference parameters. (f) Implement an iterative function,
called Divide, the signature of which is given below, which takes
in two integer parameters x, y and a reference parameter z. On exit,
z should reference the remainder when x is divided by y, and the function
should return the result of the division. You may not use either the
division or modulo operators. (g) Implement a recursive procedure,
called ShowBinary, the signature of which is given below, that takes
in a single integer value, and prints out the binary representation
of that integer. |