DISC 3371 Parks Fall 2000 Midterm Exam Answers
Both buttons on the answers work. Click View, then Source to see the code.

Person -- Enter a matching description's letterRight/WrongDescription
 1. Alan Turing A. Statistician
 2. Sherlock Holmes B. General
 3. George Patton C. Baker Street
 4. Alvin York D. Baseball
 5. Mahatma Kane Jeeves E. Sergeant
 6. Ronald Fisher F. Sailor King
 7. Ty Cobb G. W.C.Field's pen name
 8. Donald Knuth H. Starved in NJ
 9. William IV I. Our hero
10. Kurt Godel J. Fundamental Algorithms
  Grade is out of 10
1. (60 points) The HTML table shown above contains a form named f1. There are ten persons listed in the first column. There are ten descriptions in the third column labelled A through J. In the textbox beside each person, the user will enter the letter of the description that most closely matches the person. When the user presses the Grade It button, a sub named gradeit is to be executed. This sub contains a ten element array named c which contains the correct letter answer for each of the ten persons. The values are c(0)="I"; c(1)="C"; c(2)="B"; c(3)="E"; c(4)="G"; c(5)="A"; c(6)="D"; c(7)="J"; c(8)="F"; and c(9)="H" (i.e., the correct answer for Alan Turing is "I", for "Sherlock Holmes is "C", etc.)

When gradeit is executed, it first performs an edit test. Each answer (i.e., "A" thru "J") should only occur once. Test the user answers in the first column for this condition. Display a message for any of the values ("A" thru "J") if it occurs zero times OR more than once in the user's answers (e.g., in the case shown above two errors would be noted: (1) "J" is used twice and "A" is never used). If errors are detected, exit the sub after all the error messages are displayed.

Once user corrects any errors, grade the exam by counting the number of correct matches found. Display this count of correct matches in the textbox at the bottom of the table (this textbox is named gradeout). In addition, for each answer place the string "Right" if the middle column textbox if the answer matches and "Wrong" if it does not. Show NO HTML.

Make a Checkered Design
Pick a Color:
Red Green
Blue Yellow
How Many Rows/Columns
2. (40 points) The HTML page shown at the left contains a form named f2. When the "Draw It" button is clicked, a sub named drawit is executed. Five twenty pixel by twenty pixel gif files are available named "tred.gif", "tblue.gif", "tgreen.gif" and "tyellow.gif", and "tblack.gif".

The drawit sub constructs a new HTML page on-the-fly which contains a centered borderless table. This table has a number of rows and number of columns equal to the number entered by the user. Each cell of the table will contain a single gif file. The files are chosen to create a checkered pattern among the table cells by alternating the color gif chosen by the user with the "black.gif". Specifically, the first row of the table always begins with a "black.gif", then a color gif in the table cell to right, then "black.gif" in the next, a color gif in the next, etc. until the desired number of columns is reached. The second row begins with a color gif, followed by a "black.gif", followed by a color gif, etc. This pattern of alternating color/black gifs is then repeated until the desired number of rows is created.

A sample six row and six column checkered design is shown to the left. Be sure your algorithm works for odd AND even numbers of rows/columns. Show only the VBScript for drawit.

A Sample Checkered Design