NEW
Font size
WorksheetsJSP & Servlet Multiple Choice Questions (1-10)
Total questions: 76
Worksheet time: 38mins
JSP _____ is a process which allows the bean container to examine any class at run-time to determine its method signatures.
Reflection
Cookies
Sockets
Serialization
JSP ______ is the process of creating a copy of an object suitable for passing to another object.
Reflection
Cookies
Sockets
Serialization
The tasks – authentication-blocking of requests, data compression, logging and auditing – are performed by:
Servlet filter
Servlet config
Servlet context
Servlet container
A deployment descriptor describes web component response settings.
Web component settings
Web component request objects
All of the above
A Java bean in a JSP can have which of the following attributes?
Page
Request
Session
All of the above
A servlet maintains session in:
Servlet container
Servlet context
Servlet request heap
Servlet response heap
All the __________ data is kept at the application server, __________ data is kept at the web server.
Dynamic, static
Static, dynamic
HTML, Servlet
Servlet, HTML
Dynamic interception of requests and responses to transform the information is done by:
Servlet container
Servlet config
Servlet context
Servlet filter
Following method(s) cannot be overridden in the JSP page.
jspDestroy()
jspInit()
_jspService()
getParameter()
How many ServletContext objects are available for an entire web application?
One each per servlet
One each per request
One each per response
Only one
Implementing the tag <%@ page isThreadSafe="false" %> implements the SingleThreadModel interface making the JSP ____________.
Content safe
Synchronized
Thread safe
None
In the properties files ________ defines global Servlet settings and list of servlets in the system.
Servlet.properties
Page.properties
Session.properties
None
J2EE consists of the following three tiers:
Presentation tier, Business tier, Data tier
Business tier, Implementation tier, Data tier
Presentation tier, Implementation tier, Data tier
None of the above
JSP technology offers which of the following advantages? (1) Separation of dynamic and static content (2) Support for scripting and tags (3) Component reuse (4) Web access to N-tier architecture
1 & 2
All 1,2,3,4
Only 1 & 3
Only 2 & 4
JSP is the Java platform technology for building applications containing dynamic web contents such as:
XHTML, XML, DHTML, HTML
CSS, JSON, YAML, SVG
SQL, NoSQL, JDBC, ODBC
SOAP, REST, WSDL, UDDI
RequestDispatcher object is used to:
Include other resources like servlet, JSP, HTML
Manage HTTP sessions across servers
Configure global servlet properties
Handle JDBC database connections
Servlet mapping defines an association between:
URL pattern and servlet
Session and cookie
Request and response
Filter and listener
The _____ method performs cleanup of objects created during requests and responses.
init()
resume()
destroy()
run()
The ________ component is used to locate resources over the network such as EJB components, database drivers, security credentials.
JNDI
JMS
JavaMail
EJB
The ________ represents a generic exception for the JSP packages.
JspException
JspError
ServletException
IOException
The __________________ when added to the user session tells us that the session timed out.
SessionTimeoutIndicator
SessionExpiredFlag
TimeoutAttribute
SessionEndMarker
The getSession(true) method will return the appropriate session object when:
The session does not exist
The session already exists
A session attribute is missing
Cookies are disabled
The include() method of RequestDispatcher sends a request to another resource like servlet, JSP, or HTML.
True for include()
False for include()
True only for forward()
Only for sendRedirect()
The init parameter name and value pairs defined in web.xml file are handled by:
ServletConfig object
ServletContext object
HttpSession object
FilterConfig object
The JSP Model I architecture uses which of the following:
JSP with Beans; JSP creates bean and displays data; View is JSP
Controller is Servlet or JSP; View is HTML only
JSP without Beans; Controller is only Servlet
Model handled by EJB only; View is JSP
The life cycle of a servlet is managed by
Servlet context
Servlet container
Supporting protocol
All of the above
The major difference between Servlet and CGI is:
Servlet uses threads, CGI uses processes
Servlet is slower than CGI
CGI is platform dependent, Servlet is not
All three statements
The method forward(request, response) will:
Return to caller
Not return; continue on target resource
Do both return and continue
Do none of these
The TCP/IP protocol is composed of the following layers:
Internet Protocol
Transmission Control Protocol
Secure Socket Layer
Sockets
The three basic bean tags used in JavaServer Pages are:
jsp:useBean
jsp:setProperty
jsp:getProperty
jsp:include
The three main types of JSP constructs that can be embedded in a Java Server page are:
Directives
Scripting Elements
Actions
Methods
The three most important methods of the servlets are:
init(), service(), destroy()
doGet(), doPost(), doPut()
init(), doGet(), destroy()
service(), doPost(), destroy()
The two different errors that may occur during the lifecycle of JSP are:
Translation time errors
Compile time errors
Runtime expression errors
Page load errors
The two primary constituents of JavaBean are:
Properties
Methods
Directives
Scripts
The values of
Must be same
Must not be same
Can be same or different
None
To get the servlet environment information, which object is used?
ServletConfig
ServletException
ServletContext
ServletContainer
To show money format on the JSP page, we use ________ class.
Arithmetic Format
Currency Format
Number Format
String Buffer
Under JSP 1.0, the implicit object used to refer to the Servlet generated by the JSP page is:
Servlet generated by JSP page
Previous JSP page
None
None
URL encoding is the method of replacing spaces and extra characters into their corresponding ______ characters.
Hex
Binary
Octal
Decimal
What are the mechanisms available in ServletContextListener interface?
contextInit(), contextService(), contextDestroyed()
contextInitialized(), contextDestroyed()
contextInitialized(), contextService(), contextDestroyed()
None
What exception must be declared by the methods of a servlet?
ServletException
IOException
Both A and B
None
What is another name for the JSP container?
JSP engine
JSP server
JSP compiler
JSP executor
What is the correct syntax for specifying an error page in the JSP page directive?
<%@ page errorPage = "error.jsp" %>
<%@ page error-page = "error.jsp" %>
None
What is the default session timeout in Java?
30 minutes
20 minutes
10 minutes
60 minutes
What is the full form of JSP?
Java Server Pages
Java System Pages
Java Servlet Pages
Java Service Programs
What is the key difference between include directive and include action?
Include directive is static, include action is dynamic
Include directive is dynamic, include action is static
Both are dynamic
Both are static
What is the main advantage of JSP over servlets?
Separation of presentation and processing
Faster than servlets
More secure than servlets
Fewer lines of code than servlets
What is the minimum number of threads that can exist in a Java program?
0
1
2
No limit
What is the type of object referenced by the 'application' implicit object?
ServletContext
ServletConfig
HttpSession
ServletRequest
What is used to include another file in JSP at request time?
jsp:include
<%@ include %>
Include()
Which action tag is used to forward a request to another resource?
jsp:forward
jsp:request
jsp:redirect
jsp:send
Which element in web.xml is used to define servlet mapping?
Which HTTP method is idempotent?
GET
POST
PUT
Both A and C
Which implicit object refers to the output stream used to send content to client?
out
response
output
stream
Which interface must be implemented to create a filter?
Filter
ServletFilter
HttpFilter
FilterConfig
Which is responsible for converting JSP into servlet?
JSP engine
JSP compiler
Servlet container
Web server
Which method is called only once in servlet lifecycle?
init()
service()
destroy()
run()
Which method of HttpSession is used to get session creation time?
getCreationTime()
getStartTime()
getInitTime()
getSessionTime()
Which object is used to read data from a client request?
request
response
session
servletConfig
Which tag is used to use an existing bean in JSP?
jsp:useBean
jsp:getBean
jsp:setBean
jsp:bean
Which directive defines page-dependent attributes like buffer, errorPage, contentType?
Page directive
Include directive
Taglib directive
None of the above
Which directive declares a tag library used in JSP?
Taglib directive
Include directive
Page directive
None of the above
What is the default scripting language for JSP pages?
Java
JavaScript
VBScript
Python
The implicit object request in JSP is an instance of:
HttpServletRequest
HttpServletResponse
ServletRequest
ServletResponse
The implicit object response in JSP is an instance of:
HttpServletResponse
HttpServletRequest
ServletResponse
ServletRequest
The implicit object session in JSP is an instance of:
HttpSession
Session
ServletSession
None of the above
The implicit object application in JSP is an instance of:
ServletContext
ServletConfig
HttpSession
None of the above
The implicit object out in JSP is an instance of:
JspWriter
PrintWriter
BufferedWriter
OutputStream
The implicit object pageContext in JSP provides:
Access to all JSP implicit objects
Context for current page execution
Both A and B
None of the above
Which implicit object provides information about initialization parameters for the entire application?
application
config
pageContext
request
Which implicit object is used to read parameters from client requests?
request
response
application
config
Which implicit object allows JSP to include output of another resource at request time?
request
response
pageContext
application
Which JSP bean scope associates a bean with a single HTTP request?
request scope
session scope
application scope
page scope
Which JSP action element performs a dynamic include at request processing time?
jsp:include
jsp:forward
jsp:param
jsp:useBean
In JSP, the response implicit object is an instance of:
HttpServletResponse
ServletResponse
HttpServletRequest
None of the above
Which implicit object provides a handle to ServletContext, enabling application-wide attributes?
application
request
response
out
