Quiz 3 answers CSE100, Autumn 1999
This quiz is out of 10 points.
1. The meaning of a procedure call is given by the Substitution Rule,
i.e. the rule states what computation results from a procedure call.
State the Substitution Rule.
Substitution Rule: The meaning of a procedure call is the same as if
the definition of the procedure were substituted for the call with the
actual parameters replacing the corresponding formal parameters.
2. The Plumpness Index is 704 times weight in pounds divided by height in
inches squared. Write a three parameter procedure with the 1st parameter
being weight in pounds, the second parameter being height in inches, and
the last parameter the returned value of the Plumpness Index.
Private Sub plump( lbs As Double, in As Double, pi As Double)
pi = 704 * lbs / in ^ 2
End Sub
3. What happens in the iteration statement if xCoordinate = -5?
Do While xCoordinate > 0
xCoordinate = xCoordinate - 100
Print ("New position of x " & xCoordinate)
Loop
Nothing happens. When the xCoordinate value is tested, the
termination condition fails and the statements are skipped.