Professional Documents
Culture Documents
StudentID/LoginID
Name
PVC Name/Code
Date
Please read the following instructions carefully before attempting any question:
The examination mode for the cs506 final term examination is take home examination,
which mean that you are allowed to take your examination papers to your home or
computer labs and complete it using all available resources. Followings are the instructions
for doing the take home examination.
• You are all directed to come to the examination centre on the date as per the date
sheet of the final term examination provided by the Virtual University. Please come
on the time for the first session of the exam.
• On reaching the examination center you are directed to mark your attendance
• After marking the attendance the exam supervisor will hand you the hard copy of
the examination paper
• After taking the paper you can either go home to complete your paper or use PVC
labs.
• The duration of this take home examination is four days of the examination. i.e. for
cs506 it is till 20th March 2006
• On third day (on the last day) upload the solved examination paper on the
assignments page of your course. You are allowed to use the lab facilities of the
campuses, books and handouts and any other references material available to you.
• The examination papers submitted after the due date will be marked as zero
• Plagiarism or cheating by the students will be dealt severely by Virtual University
therefore it is strongly recommended that you do your own work.
• Further instructions will be available to you with the examination paper
• You are allowed to use Software J2SE 5.0 or 1.5.0, Microsoft Access, Java
5.0 Documentation, NetBeans4.1 and Tomcat 5.5.15.
Note: Write your code carefully with proper commenting, the instructor would not
go extra mile to understand your code. Avoid cluttering of code
Note: All the files will be packed in to zip format before uploading e.g.
bc020200111.zip
**WARNING: Please note that Virtual University takes serious note of unfair
means. Anyone found involved in cheating will get an `F` grade in this course.
Marks
Hint: Computer can think of a number using random function and can store it in session.
When your application starts, the “index.jsp” would be displayed. User will provide user
name & password to login.
If user name & password are correct, the program will lead to “inbox.jsp”. This page will
display “from” & “subject” of the messages related to the user in tabular format. By
selecting any message, user can read the message text on “message.jsp”.
If the user supplies incorrect username or password, the user will be taken to a page
“invalidlogin.jsp” with an option of going back to the index.jsp page
You are required to use JSP (and /or Servlets) and JavaBeans to solve this problem.
Simplifications
No fancy HTML is required. Selection of message can be done by any means (e.g.
hyperlinks, radio buttons etc.)
List A List B
1 Customer\ web.xml
2 Customer\Web-INF\ CustomerLibDAO.class
3 Customer\Web-INF\classes Customer.jsp
4 Customer\Web-INF\lib Somelib.jar
Question No: 4 Marks: 15
Suppose there is a web application in which a user can determine the factorial of a number.
User gives a number in a text field and presses submit button. The application calculates
the factorial and displays it on the same page. There is a bean known as “MathBean” which
has a method for calculating factorial.
User can repeat the process as many times as required. When user presses the finish button,
user is taken to a page where all the results, which the user has calculated, will be displayed
with a Thank you message. The results calculated by user are stored in a bean known as
“ResultsBean”.
Besides calculating factorial user can do different operations such as nCr, nPr through this
application, a bean known as “OperationListBean” contains the list of all the operations
that a user can do. These operations are common for all users. Identify the scope (session,
request, page, application etc) for each of the above mentioned beans in a web application.
Why you would put that bean in that scope?
ResultsBean
OperationListBean
Question No: 5 Marks: 30
Create a simple web application that takes the id of a student and list the courses in which
the student has enrolled, either for the current semester or all courses he or she has attended
so far (depending upon the option selected). If the user gives an invalid id, it asks the user
to give a valid one.
A JSP (findcourses.jsp) to get id and option from the user. The option indicates whether a
student wants to see the courses of the current semester or wants to see the full list. You
can use any method to get option (e.g. checkbox, text field etc.)
A java bean that will get the courses from the database and send an object back which
contains the registered courses.
A JSP (courselist.jsp) to present the data to user and a jsp to indicate invalid
Id(invalidId.jsp) with an option to go back to findcourses.jsp
You are required to use JSP (and /or Servlets) and JavaBeans to solve this problem.
Simplifications
No fancy HTML is required.
WWW.vujannat.ning.com
http://vujannat.ning.com
Largest Online Community of VU Students
FINALTERM EXAMINATION
FALL 2006 Marks: 55
CS506 - WEB DESIGN AND DEVELOPMENT (Session Time: 120min
-1)
StudentID/LoginID: ______________________________
Please read the following instructions carefully before attempting any question:
a. There is no choice.
b. You will have to answer correctly all questions in this examination to get the
maximum possible marks.
3. Do not ask any questions about the contents of this examination from anyone.
a. If you think that there is something wrong with any of the questions, attempt
it to the best of your understanding.
5. If you are required to write a code and you do not know the exact syntax you can
write the steps required to accomplish that task.
But You are not allowed to use compiler or any IDE for writing code.
**WARNING: Please note that Virtual University takes serious note of unfair means.
Anyone found involved in cheating will get an `F` grade in this course.
Which of the following is not a standard method called as part of the JSP life cycle?
► jspInit()
► jspService()
► _jspService()
► jspDestroy()
► Applet
► Servlet
► Application
► Midlet
Which of the following is not a correct scope when a JavaBean is used with JSP?
► application
► session
► request
► response
► Connection
► ResultSet
► DriverManager
► Driver
Question 1: A programmer wants to use the null layout manager, what could be the most
probable reason behind this?
You are required to write a "FormReaderServlet" that servlet will read the parameters
submitted from the page, whose code is given below,
<html>
<body>
<form method="POST" action="/FormReaderServlet ">
<p><b><font size="4">Data Entry Form </font></b></p>
<p>Name: <input type="text" name="name" size="20"> Email:
<input type="text" name="email" size="20"></p>
<p>Your comments about food Quality? </p>
<p><textarea rows="2" name="comments" cols="20"></textarea></p>
<p><input type="submit" value="Submit" name="B4"><input type="reset"
value="Reset" name="B5"></p>
</form>
</body>
</html>
Your servlet will read the parameters posted and will save them in to a text file
“DataFormSite.txt”
Note:
¾ No Fancy HTML is required.
¾ No Need to do any other task, just write the parameter values into the text file.
First you will write the index.html, which looks like below
Then you will write the “Reservation.jsp”, this page will read the Rooms table, if there
is no room that has reserved value as 0
( i-e no room available )then you will print the message “Sorry there is no room
available”
And if there is some room available, then you will store the Name of the Guest and
number of the empty room in the Guests table. And display the message “Room Has
been reserved for you, your room number is the (Room No reserved)”.
You will also set the “Reserved” column value for in Rooms table to 1.
You can implement this just using only JSP or JSP and JavaBeans which ever you like
convenient.
Simplifications:
¾ Assume the Name of DSN is HotalDSN
¾ No Fancy HTML is required. For index.html just write HTML code for form.
¾ You can use only JSPs or (JSPs and JavaBeans) which ever is convenient and
time saving for you.
¾ You can write any intermediate jsp page or servlet or JAVA Beans if you want
to.
¾ MS Access DataBase is being used.
W
FINALTERM EXAMINATION
Fall 2008
CS506- Web Design and Development (Session - 1)
Ref No: 320459
Time: 120 min
Marks: 75
Student Info
StudentID:
Center: OPKST
WWW.vujannat.ning.COM
ExamDate: 2/6/2009 12:00:00 AM
Marks
Q No. 9 10 11 12 13 14 15
M
16
Marks O
Q No. 17 18 19 20 21 22
g .C
23 24
Marks
i n
Q No. 25 26 27 28 29
.t n
30 31 32
Marks
n a
Q No. 33 34 35 36
an 37 38 39 40
Marks
u j
Q No. 41
. v
Marks
W
W
W
From the Following; which we don’t include in simple tag while creating JSP custom tags:
► Start of tag
► End of tag
► Attributes
► None of these
WWW.vujannat.ning.COM
Question No: 2 ( Marks: 1 ) - Please choose one
From the following; which component is/are used in directory Structure of web components:
► index.htm, JSP, Images etc..
► Web-inf, web.xml
► Classes, servlets classes
► lib, jar files
► All of these
n
n
From the following; which approach is used in java to create threads,
a
► Interface
► Inheritance
u j
. v
► Both Interface and Inheritance
► None of these.
Question No: 5 W
( Marks: 1 ) - Please choose one
WWW.vujannat.ning.COM
full-blown programming language.
► EL
► RT
► Both EL and RT
► None of these
. v
Layers represent the _____________ view of application.
► Physical
► Logical W
► External
W
► None of these
W
Question No: 11 ( Marks: 1 ) - Please choose one
► The code becomes a mixture of presentation, business and data access logic.
► The maintenance of the application becomes a nightmare.
WWW.vujannat.ning.COM
► Component
n A
► Can
an
bean class ___________ have any public instance variables/attributes (fields).
► Can’t
► Must
u j
► Shouldn’t
. v
Question No: 16
W
( Marks: 1 ) - Please choose one
W
Expression is a code fragment which returns ___________.
► Integer
► String
W
► Depends on the expression
► Nothing
WWW.vujannat.ning.COM
► Same
► Critical
► None of these
g .C In
which file do we define a servlet mapping?
► Web.xml
i n
► Servlet.mappings
► Servlet.xml .t n
► None of the given
n a
Question No: 21 ( Marks: 1 )
n
- Please choose one
a
► JSTL
u j
Which of the following is a type of Java web application technologies?
► JSF
► JSP . v
► All of the given
W
Question No: 22
W ( Marks: 1 ) - Please choose one
W
Extra information can be appended to URL using ____________.
► Extra path information
► Added parameters
► Custom change
► All of the given
WWW.vujannat.ning.COM
When defining a method you must include a ___________ to declare any exception that might
be thrown but is not caught in the method.
► try block
► finally block
► catch block
► throws-clause
M
an applet class definition, the----------method takes the place of the constructor.
► paint();
► main();
O
► init();
► run() ;
g .C
Question No: 26 ( Marks: 1 ) - Please choose one
i n
DSN stands for ___________.
.t n
► Domain System Name
► Data Source Name
n a
► Database System Name
► Database Simple Name
an
Question No: 27 ( Marks: 1 )
u j
- Please choose one
. v
From following classes; which one can’t be instantiated?
► Super class
► Abstract Class W
W
► Anonymous Class
► Concrete Class
► Up casting
► Down casting
WWW.vujannat.ning.COM
► Multiple Inheritance
int x = 7/2;
value of x is:
►1
►2
M
► 3.5
O
.C
►3
n g
i
Given the request path below, which part is context path, servlet path and path info?
/vubookshop/edu/index.html
.t n
Question No: 32 ( Marks: 1 )
n a
an
§ Comments:
u j
Write the XML tags for the following scripting elements in JSP?
§ Declaration:
. v
Question No: 33
W
( Marks: 2 )
W
What impact a JavaBeans object can produce when it is stored in Servlet Request
object?
W
Question No: 34 ( Marks: 2 )
WWW.vujannat.ning.COM
Differentiate between Sequential Execution and multithreading.
n a
n
What is the usage of sleep (int time) method?
a
u j
. v
W
W
W
1. Explain the purpose of Data Layer, in the Layered model for web applications?
You are required to writer a simple jsp page (exam.jsp) this page will read the
comments sent for the above given HTML page and store these into a database table
(Visitors)
Whose structure is given as below.
Simplifications:-
1. No need to use the java beans.
2. Just write One page , only code the required functionality.
3. Assume that Name of DSN is VisitorDSN.
<html>
<body>
<FORM METHOD="GET"ACTION="http://localhost:8084/ examservlet"
NAME="myform" >
<BR> Firstname:
<INPUT TYPE = “text” NAME="Name1">
<BR> Surname:
<INPUT TYPE = “text” NAME="Name2">
<BR>
<INPUT TYPE="submit" value="Submit Form">
<INPUT TYPE="reset" value="Reset">
</FORM>
</body>
</html>
Fig (1)
Write down a simple servlet (examservlet), this servlet will read the parameter passed
from the above given HTML code (As shown in the ), your servlet should read the
parameters and then print back to Browser
Like
If you don't know how to use database you can use file for 50% marks reduction
Write code to construct the following GUI and handle appropriate events. (GUI carries
minimum marks so nothing fancy is required). You can use flow layout if you want to.
If a user enters roll no and pressesaveragebutton, the average marks for a student
should be
calculated as sum of marks divided by number of courses on the GUI displayed in the
marks field.
If user provides all three values for roll no, course & marks and pressesaddbutton, a
new record
should be created in the database.
import java.io.*;
Please read the following instructions carefully before attempting any question:
**WARNING: Please note that Virtual University takes serious note of unfair
means. Anyone found involved in cheating will get an `F` grade in this course.
any class
any class within the same package
any class within the same file
any subclass of this class
A top level class may have only the following access modifier.
Package
Private
Protected
Public
True
False
Fig-3 Fig-4
1- “Toggle” button will be pressed the color of text will be changed and By press the Toggle
button again the color will be changed again you have to use two colors at least for toggling
(Here in this case blue and red color are shown).
2- When you press the “Green” button the text will become green
3- There is a text box, when you write some string in the text box the Text on the Panel will
change as shown in Fig-3.
Given a one dimensional array arr, what is the correct way of getting the number of elements in
arr
arr.length
arr.length – 1
arr.size – 1
arr.length()
When recursive method is called to solve a problem, the method actually is capable of solving
only the simpler case(s), or base case(s).
True
False
True
False
RowLayout
ColumnLayout
GridBagLayout
FlowLayoutManager
StudentID/LoginID: ______________________________
Please read the following instructions carefully before attempting any question:
a. There is no choice.
b. You will have to answer correctly all questions in this examination to get the
maximum possible marks.
3. Do not ask any questions about the contents of this examination from anyone.
a. If you think that there is something wrong with any of the questions, attempt it to the
best of your understanding.
b. If you believe that some essential piece of information is missing, make an appropriate
assumption and use it to solve the problem.
4. It is not necessary that your code should compile accurately, but your logic should be
correct.
**WARNING: Please note that Virtual University takes serious note of unfair means.
Anyone found involved in cheating will get an `F` grade in this course.
You want a class to have access to members of another class in the same package. Which is the
most restrictive access that accomplishes this objective?
► public
► private
► protected
► transient
► default access
► Programmer
► OS (Operating System)
► None of given
► Error
► Throwable
► Exception
► RuntimeException
► All of Given
► session
► application
► config
► All of Given
► None of Given
JavaBeans are?
► Servlets
► Applets
► None of Given
► True
► False
► True
► False
► True
► False
A method can not be made final until whole class is made final.
► True
► False
► True
► False
You are required to write a servlet named “CookiCounter”, that will act like a counter, i.e.; it will
display the number of time user has visited the page. You are required to implement this using
“Cookies”.
And so on counter will keep on increasing depending upon refresh or revisit with in an hour. Note:
1. No Fancy HTML is required.
2. If you will use any other technique then cookies to implement this requirement you will get
zero marks.
You are going to build a part of Project Tracking System. The database that will be used for this
system is shown below,
When your application starts, the “index.jsp” would be displayed. Employee will provide its
EmployeeID & password to login.
If EmployeeID & password are correct, the program will lead to “project.jsp”. This page will
display all the projects the
current Employee is working on in tabular format the fields this table will have will be
EmployeeId , ProjectId, ProjectName,ProjectDescription, ProjectBeginDate and ProjectEndDate, a
sample table is shown below,
Begin
Date
The user can return to “index.jsp” by clicking on hyperlinks available at bottom of “project.jsp”.
If the username and password is not correct then user will be sent/redirected back to "index.jsp".
You are required to use JSP (and /or Servlets) and JavaBeans to solve this problem.
Simplifications
For username and password varification you can write intermediate jsp page like
"authenticate.jsp” page.
Note:
1. Assume name of DSN is “projectDsn”.
2. Assume that all the fields in the database are of type String/Text.
3. Assume that user’s Username is first name and is also unique of each Employee.
4. No Fancy HTML is required.
5. Concentrate on Logic/Usage of proper classes.