0% found this document useful (0 votes)
6 views

Tutorial No 6 Ch 6-1

The document is a tutorial for Computer Science & Engineering focusing on Java servlets, including questions about servlet specifications, methods for handling parameters, session management, and the differences between servlets and applets. It contains multiple-choice questions that require justification for the correct answers. Additionally, it includes a programming task to create a servlet that tracks user visits to a page.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Tutorial No 6 Ch 6-1

The document is a tutorial for Computer Science & Engineering focusing on Java servlets, including questions about servlet specifications, methods for handling parameters, session management, and the differences between servlets and applets. It contains multiple-choice questions that require justification for the correct answers. Additionally, it includes a programming task to create a servlet that tracks user visits to a page.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Computer Science & Engineering

TUTORIAL NO 6
NOTE: 1. Write down the correct option with proper justification

2. Attach printout for programs

1. The Java __________ specification


defines an application programming 4. Which method is used to specify before
interface for communication between any lines that uses the PintWriter?
the Web server and the application a) setPageType()
program. b) setContextType()
a) Servlet b) Server c) setContentType()
c) Program d) Randomize d) setResponseType()

2. The doGet() method in the example


extracts values of the parameter’s type 5. What are the functions of Servlet
and number by using __________ container?
a) request.getParameter() a) Lifecycle management
b) request.setParameter() b) Communication support
c) responce.getParameter() c) Multithreading support
d) responce.getAttribute() d) All of the above

3. Which of the following code is used to


get an attribute in a HTTP Session 6. Which object of HttpSession can be
object in servlets? used to view and manipulate
a) session.getAttribute(String name) information about a session?
b) session.alterAttribute(String name) a) session identifier
c) session.updateAttribute(String b) creation time
name) c) last accessed time
d) session.setAttribute(String name) d) All mentioned above

Page 1 of 2
7. Which of the following is true about a) i,ii,iii are correct
servlets? b) i,ii are correct
a) Servlets execute within the address c) i,iii are correct
space of web server d) i,ii,iii,iv are correct
b) Servlets are platform-independent
because they are written in java
c) Servlets can use the full functionality 10.Write a servlet which shows how many
of the Java class libraries times user has visited the page in a
d) Servlets execute within the address session.
space of web server, platform
independent and uses the functionality
of java class libraries

8. Which are the session tracking SUBJECT TEACHER


techniques?
i. URL rewriting
ii. Using session object
iii.Using response object
iv. Using hidden fields
v. Using cookies
vi. Using servlet object
a) i, ii, iii, vi
b) i, ii, iv, v
c) i, vi, iii, v
d) i, ii, iii, v

9. What is the difference between servlets


and applets?
i.Servlets execute on Server; Applets
execute on browser
ii.Servlets have no GUI; Applet has
GUI
iii.Servlets creates static web pages;
Applets creates dynamic web pages
iv.Servlets can handle only a single
request; Applet can handle multiple
requests

Page 2 of 2

You might also like