Sample Midterm

The Computer Science Department of Cal State LA is exploring new avenues for administering exams. They have asked you to create an on-line system that would allow CS students to take mulitple-choice exams. Your site is to record the student's first and last name, as well as their score. To accomplish this you should implement the following:

Login Page

Your login page should consist of two text boxes with the labels: first name, and last name, and a submit button that reads "Login". Both text fields must contain at least one (1) alphabet, and can not contain any other character. If the names do not validate, then the user should be presented with an error message. If the user's first and last name are both "admin", they are an administrator and should be redirected (NOT FORWARDED) to the View Scores page. If the user's first and last name validate, and they are not equal to "admin", they should be redirected to the Question Page.

View Scores Page

The view scores page can only be viewed by an administrator. If someone other than an administrator attempts to view the page, they should be redirected to the Login page. If the user is an admin, they should be presented with a table listing all user's and their scores. An example of the table is as follows:

Last Name, First Name Score
Smith, John 100%
Jane, Mary 80%
Welsch, Tom 20%

Your table must contain two headers: "Last Name, First Name", and "Score". Each row of the table will list each student that took the exam and their corresponding score listed as a percent. The score should be rounded to the nearest whole number. That is to say, a score of 33.3333333% should be displayed as 33%.

A message displaying the total number of students who have taken the exam should appear above the table. If zero (0) students have taken the exam then a message displaying "Zero (0) students have taken the exam" should be displayed, and the table should not appear.

A link to the Add Questions page should appear below all other page elements.

Add Questions Page

The Add Questions page can only be viewed by an admin. If any other user attempts to view the page, they should be redirected to the Login page.

The add questions page will consist of a textarea and a submit button. An admin can enter a single question, or multiple questions into the textarea. The questions will be in the following format:

Answer Choice 1
Answer Choice 2
Answer Choice 3
Correct Answer Choice

If multiple questions are submitted they will be separated by a single blank line. Upon submitting questions, the Add Questions page should redisplay with a message describing the number of questions that have been added. At this point, an admin can choose to add additional questions, or view all scores.

A link to the View Scores page should appear below all page elements

Question Page

The question page can only be viewed by user's who have correctly logged in through the Login page. If a user has not logged in, they should be redirected to the Login page.

When a user first visits this page, they will be prompted with the first question of the exam, followed by an unordered list of answers. The user will select their answer by selecting a radio button of their choice. Below is an example:

Question 1

Menier's disease is a disorder of the hearing and balance senses, where its sufferers hear hissing, roaring or whistling sounds. Which of these people suffered from this disease:

  1. Julius Caesar
  2. Mark Twain
  3. Abraham Lincoln

If the user submits the form without answering the question, the question should redisplay with an error message informing the user to submit an answer to proceed.
Upon submitting their answer, they will be prompted with the next question in the exam. This pattern will continue until all exam questions have been answered. Upon completing the exam, the user should be prompted with a message displaying their score. An example is below:

Congratulations John Doe! You answered 5 / 5 correct! Your score is 100%.

The user should not be allowed to "go-back" and change answers on the quiz. Once the answer is submitted, the user's answer is final.



(10 pts) Validate First and Last Name
(5 pts) Display error message
(10 pts) Redirect to appropriate page

View Scores

(10 pts) Display # of students who have taken exam
(15 pts) Correctly display table (only if there are scores to display)
(10 pts) Display names and scores in correct format
(10 pts) Layout
(5 pts) Add questions link

Add Questions

(10 pts) Layout
(10 pts) Add single question
(10 pts) Add multiple questions
(5 pts) View scores link


(10 pts) Layout
(10 pts) Do not allow user to "go back"
(10 pts) Ensures user answers each question
(10 pts) Displays results at end of quiz

May 4, 2009 - 5:59pm


CSNS All files must be submitted to CSNS prior to the due date/time.