CSE 100: Quiz 2 Solutions (April 23, 1999)


  1. When starting to design an algorithm, the first step is understanding the problem, which has three parts, inputs, outputs, and processing to transform inputs to outputs.

  2. Write a procedure named rectangleArea with three integer parameters, area, length, and width, which computes the area of a rectangle by multiplying the length times the width.

      Sub rectangleArea(area As Integer, length As Integer, width As Integer)
          area = length * width      
      End Sub
    
  3. List the concepts and give an example of each fro the following code (leave blank the concept not shown):

      
        Dim midPt As Integer
        ...
        midPt = midPt \ 2
        Call myProc( midPt )
    
    declaration
    key word
    formal parameter
    actual parameter
    assignment statement
    variable

    declaration - Dim midPt As Integer
    key word - Dim, As, Integer, or Call
    formal parameter - (does not appear in above code)
    actual parameter - midPt
    assignment statement - midPt = midPt \ 2
    variable - midPt


Last modified: Mon Apr 26 17:36:48 PDT 1999