COMP 125: Introductory Programming

Remedial (or Make-Up) Course Examination #2

Test Date: Monday, May 12, 1999


Part I (10 points)

Determine the output displayed in the picture box when the command button is clicked:

  Private Sub CmdDisplay_Click()

Dim i as Integer, j as Integer
For i = 0 to 6 step 2
For j = 0 to 3
PicBox.Print i + 3 * j - 1; " ";
Next J
PicBox.Print
Next i
End Sub


Part II (10 points)

Identify the error in the following program segment:

    Private Sub CmdDisplay_Click()

Dim i As Integer
For i = 1 to 7 step 1
PicOutput.Print i; 2 ^ i
End Sub


Part III (30 points)

Rewrite the program using a For . . . Next loop.

  Private Sub_CmdDisplay_Click()
    Dim num As Integer
    Let num = 1
    Do While num <= 25
       PicOutput.Print num
       Let num = num + 4
    Loop
  End Sub


Part IV (50 points)

Platonic Planning.

According to Plato, a man should marry a woman whose age is half his age plus seven years. Write a program that requests a man's age as input and give the ideal age of his wife.

Use the built-in InputBox( ) function to request (and receive) the man's age.

Please be sure to construct a user-defined function to carry out the calculation for the ideal age of the man's wife.


Do you have any questions, comments or suggestions? If so, please e-mail them to me at jcorlis@luc.edu.

To return to the COMP 125 web site, click here.

To go to my home page, click here.

To go to the home page of Loyola University Chicago, click here.


Jack Corliss
Mathematical and Computer Sciences
Loyola University Chicago
Revised: 3 May 1999