DISC 3371 Spring 1999 Midterm Answers Parks
Posted 12PM 3/25/99

Click the buttons to see the answers work. Click "View Source" on your browser to see the source code answers.
Your version of the exam may utilize different names and conditions

1. (40 points) Using a 3 row-3 column table (no frames), show the HTML and VBScript code to produce:

Captain Webb States Quiz Questions
1. Capt. Webb was born in:
 NC
 CA
 GA
 TX
 VA
 TN
2. Capt. Webb vacationed last summer in:

3. Capt. Webb went to the University of:
 NC
 CA
 GA
 TX
 VA
 TN
 AND YOU ARE

This page uses a form named aform. The centered image is named "captsm.gif". The radio button is named q1. Values for the radio buttons are: "NC", "CA", "GA", "TX", "VA", and "TN". The second column (Question 2) has a select box named s2 with the same six string values as the radio values in Question 1. Question 3 uses six checkboxes named c1, c2,...c6. When the user clicks the I GUESS button (this button is named mary), the program checks the user entries. If the user chose the Georgia, Georgia, and Georgia answers for all three questions, then in the text box to the right of the string AND YOU ARE (this text box is named answer) place the string "RIGHT" otherwise place the string "WRONG" in answer. 2. (60 points) Given the following page:

ROLLTHE DICE
Enter the outcome of successive dice rolls. For each roll of two six-sided die, enter two numbers which are the face values of the two die.These numbers can only be 1,2,3,4,5,6. When finished click the GO button.


The button is named fred. The form is named someform.The input text box is named droll. When the user clicks GO:
  1. For each roll of the dice entered by the user (i.e., the two digits entered for each roll), sum the two die values.
  2. Count the occurences of each of these sums.There can only be 11 possible two die sums (i.e., 2,3,4,5,6,7,8,910,11, and 12).
  3. Accumulate these counts in an array named sumc
  4. Accumulate the total number of dice rolls entered by the user (Note: this is the number of digits entered divided by two -- this is also the sum of the eleven counts recorded in sumc above)
  5. Clear the page and create a table with 13 rows and 3 columns.
    1. The first rows contains the three text column heading strings: (1)" SUM"; (2) " Number of Occurences"; (3) "Percent of Total"
    2. Rows 2 thru 12 each contain three values: (1) the die sums (i.e., 2,3,4,5,6,...,12); (2) the Number of Occurences of the sum (from the array); and (3) the percent (not proportion) of rolls of that sum value
    3. Row 13 contains in the first column the text string: "TOTAL"; column 2 contains the sum of the counts and column three contains the text string: "100.0 "

Show only the VBscript. Do not write the html to create the inital page. Do not check the user's data for any errors or display any error messages. Assume that the user will enter at least one pair of die values.