1
Name:_______________________
Covers Chs 39-41
Exam
Armstrong Atlantic State University
Instructor: Dr. Y. Daniel Liang
I pledge by honor that I have completed the exam
independently without consulting any person.
Signed ________________________
Date ________________________
1. Develop an addition quiz. The quiz randomly generates
two single digits and asks the user the question such as
“what is 8 + 7?“, as shown in Figure 1. After the user
2
Figure 2
2. When a new question is displayed, the answer field
should be cleared, as shown in Figure 2.
3. Your program should handle the incorrect input, as shown
in Figure 3.
4. Write two programs one using JSP and the other using
Visual Web JSF. Name them ExamJSP and ExamJSF,
respectively. Create these two programs in one NetBeans
3
project. Name the project YourNameExam1. The URL for these
two programs should be
SelfEvaluation Check List
For the JSP version:
1. User interface
2. Generate a question
3. Grade an answer
4. correct count and total count
For the JSF version:
6. User interface
7. Generate a question
8. Grade an answer
Project submission:
11. Emailed .war file.
12. Signed copy of this exam paper
4
Part II:
1. Create a database named javabook in MySQL.
2. Use MySQL to create two tables as follows:
create table Question (
questionId int not null,
question varchar(250),
constraint pkQuestion primary key (questionId));
create table Survey (
questionId int not null,
ipAddress varchar(40) not null,
answer bit, /* bit is a MySQL boolean value */
time date,
constraint pkSurvey primary key (questionId, ipAddress));
2. Write a JSP that displays the questions. Each question
accompanied by two radio buttons for the user to select as
Yes or No. When the user clicks the Submit button, the
answers will be stored in the Survey table and the current
survey result will be displayed.