You are on page 1of 33

FINALTERM EXAMINATION

SEMESTER FALL 2005


Total Marks:100
CS506- Web Design & Development
http://vujannat.ning.com Duration:4 Days
BEST SITE TO HELP STUDENTS

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.

For Teacher’s use only


Total
Question Q1 Q2 Q3 Q4 Q5
Marks

Marks

Question No: 1 Marks: 15


You are required to build a number guessing game using servlets only. All of the HTML
will be generated from the servlet. Computer can think a number for each user between 1 to
100. User can enter a number in the space provided for this purpose and presses “guess”
button. If this entered number is matched with the one thought by the computer, a message
“your guess is right” would be displayed on the same page. A message “your guess is too
high, choose small” would be displayed if the number entered is greater than of computer
on the same page. Similarly, a message “your guess is too low, choose high” would be
displayed if the number entered is lesser than of computer on the same page. User can
continue to play until he/she guessed the right number or closes the browser manually.
Nothing fancy is required to solve this problem.

Hint: Computer can think of a number using random function and can store it in session.

Question No: 2 Marks: 30


You are going to build a part of E-Mail system. The database that will be used for this
system is given below

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”.

The user can return to “index.jsp” by clicking on hyperlinks available at bottom of


“message.jsp” and “inbox.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.)

Question No: 3 Marks: 10


List A contains directories of a standard web application and List B contains some
files/classes. Match items of List B with List A.

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?

Name of Bean Scope Why?


MathBean

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) Assume we have a table with columns (id , course , isCurrentTrimesterCourse , year )


b) The dsn for db is “coursesdb”

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: ______________________________

Student Name: ______________________________

Center Name/Code: ______________________________

Exam Date: Tuesday, February 20, 2007

Please read the following instructions carefully before attempting any question:

1. This examination is close Handouts.

2. Answer all questions.

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. In your code syntax errors will be ignored. Concentrate on Logic

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.

6. For the MCQs Choose the best possible option.

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.

For Teacher's use only


Question 1 2 3 4 5 6 7 8 9 Total
Marks

Question No: 1 ( Marks: 2 ) - Please choose one

Which of the following is not a standard method called as part of the JSP life cycle?

► jspInit()

► jspService()

► _jspService()

► jspDestroy()

Question No: 2 ( Marks: 2 ) - Please choose one

When a JSP page is compiled, what is it turned into?

► Applet

► Servlet

► Application

► Midlet

Question No: 3 ( Marks: 2 ) - Please choose one

Which of the following is not a correct scope when a JavaBean is used with JSP?

► application

► session

► request

► response

Question No: 4 ( Marks: 2 ) - Please choose one

From which object do you ask for DatabaseMetaData?

► Connection

► ResultSet

► DriverManager
► Driver

Question No: 5 ( Marks: 2 ) - Please choose one

Which method(s) must a serializable class, implement?

► It must always implement both readObject and writeObject

► It must implement either readObject or writeObject, or both, depending upon the


desired behavior

► No Need to implement any methods

► None of the given option is correct

Question No: 6 ( Marks: 10 )

Answer these questions in short. (5+5)

Question 1: A programmer wants to use the null layout manager, what could be the most
probable reason behind this?

Question 2: Differentiate between layers and tiers.

Question No: 7 ( Marks: 10 )

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">&nbsp; Email:&nbsp;
<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.

Question No: 8 ( Marks: 10 )

Completely Explain the Thread Priority Scheduling used by the JVM?


Question No: 9 ( Marks: 15 )

You will write a part of the Hotel Reservation System.


The database used by this system is shown as below

"Rooms" Table Structure (Reserved Column has 0 or 1, 0 for not reserved/Available


and 1 room is reserved/Not Available.)

"Guest" Table Structure

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

For Teacher's Use Only


Q No. 1 2 3 4 5 6 7 8 Total

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

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study


discussions and many more.
W
Question No: 1 ( Marks: 1 ) - Please choose one

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

Question No: 3 ( Marks: 1 ) - Please choose one M


O
g .C
From following; which is the main reason that enters a thread into dead state:
► a)It dies a natural death because thread completes its execution.
► b)It is killed because someone invoked its stop method.
► Both a and b.
i n
.t n
► None of these.

Question No: 4 ( Marks: 1 )


a
- Please choose one

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

RPC stands for W


W
► Remote Personal Computer (RPC)
► Remote Procedure Calls (RPC).
► Remote Procedure Client (RPC)
► None of these

Question No: 6 ( Marks: 1 ) - Please choose one

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study


discussions and many more.
W
From the following which one is not a built-in validator?
► DoubleRangeValidator
► LongRangeValidator
► LengthValidator
► StringValidator

Question No: 7 ( Marks: 1 ) - Please choose one


-----
--------can be used to specify dynamic attribute values for JSTL actions without using

WWW.vujannat.ning.COM
full-blown programming language.
► EL
► RT
► Both EL and RT
► None of these

Question No: 8 ( Marks: 1 ) - Please choose one


The
dot operator in Expression Language typically used for accessing the --------------------of
an object.
► Properties M
► Elements O
► Values
► Attributes
g .C
Question No: 9 ( Marks: 1 ) - Please choose one
i n
.t n
Tiers represent the _____________ view of application.
► Physical
► Logical
n a
► External
► None of these
an
Question No: 10 ( Marks: 1 )
u j
- Please choose one

. v
Layers represent the _____________ view of application.
► Physical
► Logical W
► External
W
► None of these

W
Question No: 11 ( Marks: 1 ) - Please choose one

Which of the following is appropriate for Page-with-Bean approach?

► The code becomes a mixture of presentation, business and data access logic.
► The maintenance of the application becomes a nightmare.

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study


discussions and many more.
W
► A lot of code is also get duplicated.
► All the business logic goes into one application.

Question No: 12 ( Marks: 1 ) - Please choose one


The
___________ represent the state of component.
► View
► Model
► Controller

WWW.vujannat.ning.COM
► Component

Question No: 13 ( Marks: 1 ) - Please choose one


The
following value of JavaBean’s scope attribute has local variable.
► Page
► Request
► Session
► Application

Question No: 14 ( Marks: 1 ) - Please choose one M


O JSP
action elements allow us to work with _____________.
► JavaScript
g .C
► JavaBeans
► ManagedBeans
i n
► HTML
.t n
Question No: 15 ( Marks: 1 )
a
- Please choose one

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

Question No: 17 ( Marks: 1 ) - Please choose one


JSP
file is compiled ___________.

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study


discussions and many more.
W
► Whenever there is some modification in the file
► Whenever it is accessed
► Whenever browser is restarted
► Whenever the page is refreshed

Question No: 18 ( Marks: 1 ) - Please choose one

Servlet session and JSP session have ___________ abilities.


► Different

WWW.vujannat.ning.COM
► Same
► Critical
► None of these

Question No: 19 ( Marks: 1 ) - Please choose one

Which of the following is not part of http response?


► Result Code
► URI
► Header fields
► Body M
O
Question No: 20 ( Marks: 1 ) - Please choose one

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

Question No: 23 ( Marks: 1 ) - Please choose one

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study


discussions and many more.
W
Web server is a software which provides services to access _________.
► Internet
► Intranet
► Extranet
► All of the given

Question No: 24 ( Marks: 1 ) - Please choose one

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

Question No: 25 ( Marks: 1 ) - Please choose one


In

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

Question No: 28 W ( Marks: 1 ) - Please choose one

Converting bigger data types into smaller one is called ----------

► Up casting
► Down casting

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study


discussions and many more.
W
► In casting
► Out casting

Question No: 29 ( Marks: 1 ) - Please choose one

Java provide ------------------


► Overloading
► Overriding
► Pointers

WWW.vujannat.ning.COM
► Multiple Inheritance

Question No: 30 ( Marks: 1 ) - Please choose one

int x = 7/2;
value of x is:

►1
►2
M
► 3.5
O
.C
►3

Question No: 31 ( Marks: 1 )

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 )

What invokes a thread’s run() method?

Question No: 35 ( Marks: 3 )

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study


discussions and many more.
W
What is the significance of error page?

Question No: 36 ( Marks: 3 )

Which type of information can be appended to URL?

Question No: 37 ( Marks: 3 )

WWW.vujannat.ning.COM
Differentiate between Sequential Execution and multithreading.

Question No: 38 ( Marks: 5 )

Which technology is used in JAVA to support following layers?


1. Presentation Layer
2. Business Layer
3. Data Layer

Question No: 39 ( Marks: 5 ) M


O
How cookies are sent to a client?

Question No: 40 ( Marks: 10 ) g .C


i n
.t n
What are the characteristics of web services?

Question No: 41 ( Marks: 10 )

n a
n
What is the usage of sleep (int time) method?

a
u j
. v
W
W
W

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study


discussions and many more.
CS506-Web Design and Development
Final Term Special 2006
Closed Handouts Paper
www.vujannat.ning.com

Q#1:- Answer these questions in short. (5+5)

1. Explain the purpose of Data Layer, in the Layered model for web applications?

2. Explain the usage of the keyword transient?

Q#2:- Read the below given HTML code care fully.

<form method="POST" action="exams.jsp">


Cafe New Range</br>
Visitor Name: <input type="text" name="name" size="20"></br>
Comments About Food Quality <input type="text" name="comments"
size="20"></br>
<p><input type="submit" value="Submit" name="B1"><input
type="reset" value="Reset" name="B2"></br>
</form>

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.

Q#3:-Read the given HTML code care fully.

<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

Note: No Need to write any other file, like web.xml


CS506-Web Design & Development
Midterm Fall2005
http://vujannat.ning.com
BEST SITE TO HELP STUDENTS
Q.1: Applet's paint() and JPanel's paintComponent() methods can be called
manually using repaint() method, when needed
Q.2: _________ define behavior and ____________ define implementation
Q.3: Java allows multiple inheritance
Q.4:The"Student"databasecontains"Record"table. The table contains student's records
in the following format. The
first field represents roll no (number), second field represents course name (text) and
third field represents marks (number) out of 100.

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.

displaying"GoodBye"message in the JOptionPane dialog box.


If user selects the (X) of the frame, the control should return to the command prompt
after

Q.5: The following statement


will generate numbers from
(int) (
Math.Random() *
10 );
Q.6: In java, primitive data types are always passed by reference Q.7: ServerSocket's
accept() method waits for incoming connection request and when request is received, it
returns a
Q.8: Upcasting in java is implicit
Q.9: To execute a stored procedure, what kind of statement do you need
Q.10: Readers are character oriented streams
Q.11: Applet's start( ) method is called when applet is
Q.12: Short Questions:
1. 1. Differentiate between static and nonstatic members.
2. 2. Read the following code carefully and identify the type of exception i.e.
checked/unchecked. Provide the reason for your answer.

import java.io.*;

public class CException {


public static void main (String args[ ] ) { FileReader fr = new
FileReader ("input.txt"); BufferedReader br = new
BufferedReader (fr);

String line = br.readLine();


System.out.println(line);
}
}

3. What is the difference between a server socket and an ordinary (communication)


socket? Describe the typical lifecycle of a socketbased server.
www.vujannat.ning.com

CS506 Web Design and Development


Mid Term Examination – Spring 2006
Time Allowed: 90 Minutes

Please read the following instructions carefully before attempting any question:

1. This examination is open Handouts.


2. Answer all questions.
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.
You are allowed to use Software J2SE 5.0 or 1.5.0.

**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.

Question No. 1 Marks : 15

Short Questions. (5 + 5 + 5 = 15 pts)

1. What restrictions are placed on method overriding?


2. What is a Container in a GUI?
3. What are the problems faced by Java programmers who don't use layout managers?

Question No. 2 Marks : 1

In Java a final class must be sub-classed before it.


 True
 False

Question No. 3 Marks : 1

A top level class without any modifier is accessible to

 any class
 any class within the same package
 any class within the same file
 any subclass of this class

Question No. 4 Marks : 1

A top level class may have only the following access modifier.

 Package
 Private
 Protected
 Public

Question No. 5 Marks : 1

In Java an abstract class cannot be sub-classed

 True
 False

Question No. 6 Marks : 15


Fig-1 Fig-2

Fig-3 Fig-4

You will write the program whose interface is show above.


The panel consists of Two Buttons and one Text box and a string “Hello World”.
Toggle Button: The functionality of the Toggle button is that when it is pressed the color of
the text shown on the panel will be changed. Initially you will use two colors for text (here in
the figure 1 and 2 blue and red colors are used) but if you want to use more color it will be
appreciated.
Green Button
Green button will simply change the color of the text to Green.
Text Box
Whatever string you will write in the text box will appear on the panel and on this text
“Toggle” and “Green” operations can be performed as shown in 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.

Question No. 7 Marks : 1

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()

Question No. 8 Marks : 1

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

Question No. 9 Marks : 1

Which of these are valid declarations for the main method?

 public void main();


 public static void main(String args[]);
 static public void main(String);
 public static int main(String args[]);

Question No. 10 Marks : 1

Map interface is derived from the Collection interface.

 True
 False

Question No. 11 Marks : 1

In Java, which of these classes implement the LayoutManager interface?

 RowLayout
 ColumnLayout
 GridBagLayout
 FlowLayoutManager

Question No. 12 Marks : 1

BorderLayout is the default layout manager for a JFrame’s content pane


 True
 False
Connecting VU Students
1
FINALTERM EXAMINATION
SPRING 2006 Marks: 55
CS506 - WEB DESIGN AND DEVELOPMENT (Session Time: 120min
-1)

StudentID/LoginID: ______________________________

Student Name: ______________________________

Center Name/Code: ______________________________

Exam Date: Friday, August 25, 2006

Please read the following instructions carefully before attempting any question:

1. This examination is open Handouts.

2. Answer all questions.

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.

For Teacher's use only


Question 1 2 3 4 5 6 7 8 9 10 Total
Marks
Question 11 12 13
Marks

Question No: 1 ( Marks: 1 ) - Please choose one


Connecting VU Students
2

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

Question No: 2 ( Marks: 1 ) - Please choose one

In Java garbage collection is done by_______________

► JVM (Java Virtual Machine)

► Programmer

► Both JVM (Java Virtual Machine)and Programmer

► OS (Operating System)

► None of given

Question No: 3 ( Marks: 1 ) - Please choose one

Which of following can be thrown using the throw statement?

► Error

► Throwable

► Exception

► RuntimeException

► All of Given

Question No: 4 ( Marks: 1 ) - Please choose one


Connecting VU Students
3

____________is/are the JSP Implicit Object(s).

► session

► application

► config

► All of Given

► None of Given

Question No: 5 ( Marks: 1 ) - Please choose one

JavaBeans are?

► A special Java class file

► Servlets

► Applets

► A Special form of JSP

► None of Given

Question No: 6 ( Marks: 1 ) - Please choose one

An expression tag contains a scripting language expression that is evaluated.

► True

► False

Question No: 7 ( Marks: 1 ) - Please choose one

A final class can't be extended.

► True

► False

Question No: 8 ( Marks: 1 ) - Please choose one


Connecting VU Students
4
ServletConfig defines a set of methods that a servlet uses to communicate with its servlet
container.

► True

► False

Question No: 9 ( Marks: 1 ) - Please choose one

A method can not be made final until whole class is made final.

► True

► False

Question No: 10 ( Marks: 1 ) - Please choose one

Servlet session and JSP session have different abilities.

► True

► False

Question No: 11 ( Marks: 15 )

Answer the following Short Questions. (5 + 5 + 5 = 15 marks)

1. Differentiate between yielding and sleeping?


2. I am making a java application, and I need to force the garbage collection, how can I
achieve that, if not why?
3. How can a GUI component handle its own events?

Question No: 12 ( Marks: 10 )

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”.

When the first time page will be visited it will display


Connecting VU Students
5

Upon second refresh/Revisit with in hour.

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.

Question No: 13 ( Marks: 20 )

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,

EmployeeId ProjectId ProjectName ProjectDescription Project ProjectEndDate


Connecting VU Students
6

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.

You might also like