33
FINALTERM EXAMINATION SEMESTER FALL 2005 CS506- Web Design & Development http://vujannat.ning.com BEST SITE TO HELP STUDENTS Total Marks:100 Duration:4 Days 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 20 th 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

Cs506 Collection of Old Papers

Embed Size (px)

DESCRIPTION

CS506 COLLECTION OF OLD PAPERS

Citation preview

Page 1: Cs506 Collection of Old Papers

FINALTERM EXAMINATION SEMESTER FALL 2005

CS506- Web Design & Development http://vujannat.ning.com BEST SITE TO HELP STUDENTS

Total Marks:100 Duration:4 Days

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

Page 2: Cs506 Collection of Old Papers

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

Question Q1 Q2 Q3

Q4

Q5 Total Marks

Marks

Question No: 1 Marks: 15You 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

Page 3: Cs506 Collection of Old Papers

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: 10List 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

Page 4: Cs506 Collection of Old Papers

Question No: 4 Marks: 15Suppose 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

Page 5: Cs506 Collection of Old Papers

Question No: 5 Marks: 30Create 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.

Page 6: Cs506 Collection of Old Papers

WWW.vujannat.ning.com http://vujannat.ning.com

Largest Online Community of VU Students FINALTERM EXAMINATION

FALL 2006

CS506 - WEB DESIGN AND DEVELOPMENT (Session - 1 )

Marks: 55

Time: 120min

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

Page 7: Cs506 Collection of Old Papers

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

Page 8: Cs506 Collection of Old Papers

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?

Page 9: Cs506 Collection of Old Papers

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

Page 10: Cs506 Collection of Old Papers

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.

Page 11: Cs506 Collection of Old Papers

WW

W.vu

jann

at.n

ing.C

OM

FINALTERM EXAMINATION

Fall 2008

CS506- Web Design and Development (Session - 1)

Ref No: 320459

Time: 120 min

Marks: 75

Student Info

StudentID:

Center: OPKST

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 16

Marks

Q No. 17 18 19 20 21 22 23 24

Marks

Q No. 25 26 27 28 29 30 31 32

Marks

Q No. 33 34 35 36 37 38 39 40

Marks

Q No. 41

Marks

W

WW

.vu

jann

at.n

ing.C

OM

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study discussions and many more.

WW

W.V

IRT

UA

LIA

NS.

CO

M

Page 12: Cs506 Collection of Old Papers

WW

W.vu

jann

at.n

ing.C

OM

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

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

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.

► None of these.

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

From the following; which approach is used in java to create threads,

► Interface

► Inheritance

► Both Interface and Inheritance

► None of these.

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

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

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

WW

W.v

uja

nnat

.nin

g.C

OM

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study discussions and many more.

WW

W.V

IRT

UA

LIA

NS.

CO

M

Page 13: Cs506 Collection of Old Papers

WW

W.vu

jann

at.n

ing.C

OM

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

► Elements

► Values

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

Tiers represent the _____________ view of application. ► Physical ► Logical ► External ► None of these

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

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

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.

WW

W.v

uja

nnat

.nin

g.C

OM

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study discussions and many more.

WW

W.V

IRT

UA

LIA

NS.

CO

M

Page 14: Cs506 Collection of Old Papers

WW

W.vu

jann

at.n

ing.C

OM

► 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 ► 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

JSP

action elements allow us to work with _____________. ► JavaScript ► JavaBeans

► ManagedBeans

► HTML

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

A

bean class ___________ have any public instance variables/attributes (fields). ► Can

► Can’t ► Must ► Shouldn’t Question No: 16 ( Marks: 1 ) - Please choose one

Expression is a code fragment which returns ___________. ► Integer ► String

► Depends on the expression

► Nothing

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

JSP

file is compiled ___________.

WW

W.v

uja

nnat

.nin

g.C

OM

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study discussions and many more.

WW

W.V

IRT

UA

LIA

NS.

CO

M

Page 15: Cs506 Collection of Old Papers

WW

W.vu

jann

at.n

ing.C

OM

► 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 ► 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

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

In

which file do we define a servlet mapping?

► Web.xml ► Servlet.mappings

► Servlet.xml ► None of the given

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

Which of the following is a type of Java web application technologies?

► JSTL

► JSF

► JSP

► All of the given

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

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

WW

W.v

uja

nn

at.n

ing.C

OM

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study discussions and many more.

WW

W.V

IRT

UA

LIA

NS.

CO

M

Page 16: Cs506 Collection of Old Papers

WW

W.vu

jann

at.n

ing.C

OM

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

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

an applet class definition, the----------method takes the place of the constructor.

► paint();

► main();

► init();

► run() ;

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

DSN stands for ___________.

► Domain System Name

► Data Source Name

► Database System Name

► Database Simple Name

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

From following classes; which one can’t be instantiated?

► Super class

► Abstract Class

► Anonymous Class

► Concrete Class

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

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

► Up casting

► Down casting

WW

W.v

uja

nn

at.n

ing.C

OM

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study discussions and many more.

WW

W.V

IRT

UA

LIA

NS.

CO

M

Page 17: Cs506 Collection of Old Papers

WW

W.vu

jann

at.n

ing.C

OM

► In casting

► Out casting

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

Java provide ------------------ ► Overloading

► Overriding

► Pointers

► Multiple Inheritance

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

int x = 7/2;

value of x is:

► 1

► 2

► 3.5

► 3

Question No: 31 ( Marks: 1 )

Given the request path below, which part is context path, servlet path and path info?

/vubookshop/edu/index.html

Question No: 32 ( Marks: 1 )

Write the XML tags for the following scripting elements in JSP? § Comments: § Declaration:

Question No: 33 ( Marks: 2 )

What impact a JavaBeans object can produce when it is stored in Servlet Request object?

Question No: 34 ( Marks: 2 )

What invokes a thread’s run() method?

Question No: 35 ( Marks: 3 )

WW

W.v

uja

nnat

.nin

g.C

OM

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study discussions and many more.

WW

W.V

IRT

UA

LIA

NS.

CO

M

Page 18: Cs506 Collection of Old Papers

WW

W.vu

jann

at.n

ing.C

OM

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 )

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 )

How cookies are sent to a client?

Question No: 40 ( Marks: 10 )

What are the characteristics of web services?

Question No: 41 ( Marks: 10 )

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

WW

W.v

uja

nn

at.n

ing.C

OM

Visit vujannat.ning.Com For Video Lectures ,previous assigmnets ,Papers,Chat, Study discussions and many more.

WW

W.V

IRT

UA

LIA

NS.

CO

M

Page 19: Cs506 Collection of Old Papers

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.

Page 20: Cs506 Collection of Old Papers

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

Page 21: Cs506 Collection of Old Papers

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

Page 22: Cs506 Collection of Old Papers

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.

Page 23: Cs506 Collection of Old Papers

www.vujannat.ning.com

In Java a final class must be sub-classed before it. Question No. 2 Marks : 1

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

hort Questions. (5 + 5 + 5 = 15 pts) S

Question No. 1 Marks : 15

**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 are allowed to use Software J2SE 5.0 or 1.5.0.

b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to solve the problem.

a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding.

3. Do not ask any questions about the contents of this examination from anyone.

b. You will have to answer correctly all questions in this examination to get the maximum possible marks.

a. There is no choice. 2. Answer all questions. 1. This examination is open Handouts.

Please read the following instructions carefully before attempting any question:

Time Allowed: 90 Minutes Mid Term Examination – Spring 2006

CS506 Web Design and Development

Page 24: Cs506 Collection of Old Papers

Question No. 6 Marks : 15

False True

In Java an abstract class cannot be sub-classed Question No. 5 Marks : 1

Public Protected Private Package

A top level class may have only the following access modifier. Question No. 4 Marks : 1

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

A top level class without any modifier is accessible to Question No. 3 Marks : 1

False True

Page 25: Cs506 Collection of Old Papers

Given a one dimensional array arr, what is the correct way of getting the number of elements in arr

Question No. 7 Marks : 1

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.

2- When you press the “Green” button the text will become green

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

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.

Text BoxGreen button will simply change the color of the text to Green.

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

Toggle Button:The panel consists of Two Buttons and one Text box and a string “Hello World”. You will write the program whose interface is show above.

Fig-4 Fig-3

Fig-2 Fig-1

Page 26: Cs506 Collection of Old Papers

BorderLayout is the default layout manager for a JFrame’s content pane Question No. 12 Marks : 1

FlowLayoutManager GridBagLayout ColumnLayout RowLayout

In Java, which of these classes implement the LayoutManager interface? Question No. 11 Marks : 1

False True

Map interface is derived from the Collection interface.

Question No. 10 Marks : 1

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

Which of these are valid declarations for the main method? Question No. 9 Marks : 1

False True

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

Question No. 8 Marks : 1

arr.length() arr.size – 1 arr.length – 1 arr.length

Page 27: Cs506 Collection of Old Papers

False True

Page 28: Cs506 Collection of Old Papers

Connecting VU Students

1

FINALTERM EXAMINATION SPRING 2006

CS506 - WEB DESIGN AND DEVELOPMENT (Session - 1 )

Marks: 55

Time: 120min

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 TotalMarks

Question 11 12 13 Marks

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

Page 29: Cs506 Collection of Old Papers

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

Page 30: Cs506 Collection of Old Papers

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

Page 31: Cs506 Collection of Old Papers

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

Page 32: Cs506 Collection of Old Papers

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

Page 33: Cs506 Collection of Old Papers

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.