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
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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
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
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
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
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.
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
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"> 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.
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.
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.
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
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
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
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
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
BorderLayout is the default layout manager for a JFrame’s content pane Question No. 12 Marks : 1
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
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? ►
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.