NEW
Font size
WorksheetsServlets, JSP & XML
Total questions: 70
Worksheet time: 35mins
Which are the main features of XML?
Text data description
Human- and computer-friendly format
Handles data in a tree structure having one-and only one-root element
All mentioned above
Find the correct syntax of the declaration which defines the XML Version?
< ?xml version= "1.0" ? >
< xml version="1.0"/ >
< ?xml version="1.0" / >
None of the above
Which language is case sensitive?
HTML
XML
Both A & B
None of the above
Which are the techniques for defining the structure of a specific type of XML documents?
Schema
DTD
Both A & B
None of the above
Which is not a XML function?
Transport information
Style information
Store information
Structure information
Is this a 'well formed' XML document?
< ?xml version="1.0"? >
< note >
< to age="29" >John< /to >
< from >Smiley< / from >
< / note >
True
False
Which Characters are illegal in XML elements?
" < "
"&"
Both A & B
None of the above
Which are the XML Syntax rules?
All XML Elements Must Have a Closing Tag
XML Tags are not Case Sensitive
XML Elements Must be Properly Nested
Both A & C
XML is designed to store data and _____.
Design
Verify
Transport
Both A & B
Well formed XML document means
it contains a root element
it contain an element
it contains one or more elements
must contain one or more elements and root element must contain all other elements
Valid XML document means (most appropriate)
the document has root element
the document contains atleast one or more root element
the XML document has DTD associated with it & it complies with that DTD
Each element must nest inside any enclosing element property
What does DTD stand for?
Direct Type Definition
Document Type Definition
Do The Dance
Dynamic Type Definition
The use of a DTD in XML development is:
required when validating XML documents
no longer necessary after the XML editor has been customized
used to direct conversion using an XSLT processor
a good guide to populating a templates to be filled in when generating an XML document automatically
In XML
the internal DTD subset is read before the external DTD
the external DTD subset is read before the internal DTD
there is no external type of DTD
there is no internal type of DTD
Disadvantages of DTD are
(i)DTDs are not extensible
(ii)DTDs are not in to support for namespaces
(iii)there is no provision for inheritance from one DTDs to another
(i) is correct
(i),(ii) are correct
(ii),(iii) are correct
(i),(ii),(iii) are correct
To use the external DTD we have the syntax
<?xml version=”A.0” standalone=”no”?>
<! DOCTYPE DOCUMENT SYSTEM “order.dtd”?>
<?xml version=”A.0” standalone=”yes”?>
<! DOCTYPE DOCUMENT SYSTEM “order.dtd”?>
<?xml version=”A.0” standalone=”no”?>
<! DOCTYPE DOCUMENT “order.dtd”?>
<?xml version=”A.0” standalone=”yes”?>
<! DOCTYPE DOCUMENT SYSTEM “order.dtd”?>
A schema describes
(i) grammer
(ii) vocabulary
(iii) structure
(iv) datatype of XML document
(i) & (ii) are correct
(i),(iii) ,(iv) are correct
(i),(ii),(iv) are correct
(i),(ii),(iii),(iv) are correct
The attribute used to define a new namespace is
A. XMLNS
XmlNameSpace
XMLNS
xmlns
XmlNs
Which of the following is a valid XSLT iteration command
for
for-all
for-each
in-turn
______ tag is an extension to HTML that can enclose any number of JavaScript statements.
<SCRIPT>
<BODY>
<HEAD>
<TITLE>
What is the correct JavaScript syntax to write "Hello World"?
System.out.println("Hello World")
println ("Hello World")
document.write("Hello World")
response.write("Hello World")
What is the correct syntax for referring to an external script called " abc.js"?
<script href=" abc.js">
<script name=" abc.js">
<script src=" abc.js">
None of the above
Which of the following best describes JavaScript?
a low-level programming language.
a scripting language precompiled in the browser.
a compiled scripting language.
an object-oriented scripting language.
JavaScript is interpreted by _________
Client
Server
Object
None of the above
<script type="text/javascript">
x=4+"4";
document.write(x);
</script>
Output------?
44
8
4
Error output
Which page directive should be used in JSP to generate a PDF page?
contentType
generatePdf
typePDF
contentPDF
application is instance of which class?
javax.servlet.Application
javax.servlet.HttpContext
javax.servlet.Context
javax.servlet.ServletContext
Which option is true about session scope?
Objects are accessible only from the page in which they are created
Objects are accessible only from the pages which are in same session
Objects are accessible only from the pages which are processing the same request
Objects are accessible only from the pages which reside in same application
Which one is the correct order of phases in JSP life cycle?
Initialization, Cleanup, Compilation, Execution
Initialization, Compilation, Cleanup, Execution
Compilation, Initialization, Execution, Cleanup
Cleanup, Compilation, Initialization, Execution
“request” is instance of which one of the following classes?
Request
HttpRequest
HttpServletRequest
ServletRequest
Which is not a directive?
include
page
export
useBean
Which one of the following is correct for directive in JSP?
<%@directive%>
<%!directive%>
<%directive%>
<%=directive%>
Which of the following action variable is used to include a file in JSP?
jsp:setProperty
jsp:getProperty
jsp:include
jsp:plugin
“out” is implicit object of which class?
javax.servlet.jsp.PrintWriter
javax.servlet.jsp.SessionWriter
javax.servlet.jsp.SessionPrinter
javax.servlet.jsp.JspWriter
Java code is embedded under which tag in JSP?
Declaration
Scriptlet
Expression
Comment
Which of the following are the valid scopes in JSP?
request, page, session, application
request, page, session, global
response, page, session, application
request, page, context, application
How many jsp implicit objects are there and these objects are created by the web container that are available to all the jsp pages?
8
9
10
7
Which attribute specifies a JSP page that should process any exceptions thrown but not caught in the current page?
The ErrorPage Attribute
The IsErrorPage Attribute
Both A & B
None of the above
In JSP Action tags which tags are used for bean development?
jsp:useBean
jsp:setPoperty
jsp:getProperty
All mentioned above
Which technology do we mix our business logic with the presentation logic?
Servlet
JSP
Both A & B
None of the above
In JSP page directive which attribute defines the MIME(Multipurpose Internet Mail Extension) type of the HTTP response?
import
contentType
extends
info
A JSP page consists of which tags?
HTML tags
JSP tags
Both A & B
None of the above
Which packages does a JSP API consist of?
javax.servlet.jsp
java.servlet
javax.servlet.jsp.tagext
Both A & C
Choose an incorrect statement from the following.
JSP pages are easier to maintain than a servlet.
The Web Container translate a Servlet into JSP page.
JSP is built on Java Technology so it is platform independent.
A JSP page seperates presentation and business logic.
Which syntax is used to comment in JSP?
<!-- Comment -->
<@-- Comment -->
<%-- Comment -->
<&-- Comment -->
Which of the following is syntax of Declaration Tag?
<@ Declaration @>
<% Declaration %>
<& Declaration &>
<%! Declaration %>
Which is an example of the syntax used to import a class to JSP?
<% page import="java.util.List" %>
<%@ page import="java.util.List" @%>
<% import="java.util.List" %>
<%@ page import="java.util.List" %>
Which of the following is syntax of Expression Tag?
<% Expression %>
<%= Expression %>
<& Expression &>
<%! Expression %>
An __________ tag can hold any Java language expression that can be used as an argument to out.println() method.
Expression tag
Declaration Tag/label>
Directive Tag
Scriplet Tag
Never end an expression with semicolon inside Expression Tag?
True
False
Which implicit object of JSP is equivalent to this variable of Java programming language?
page
pageContext
config
application
Which implicit object is only available to a JSP page which is designated as error pages?
application
Throwable
runnable
exception
Choose the correct syntax of include directive?
<%@ include page="file.jsp" %>
<% include file="file.jsp" %>
<%@ include file="file.jsp" %>
<%! include page="file.jsp" %>
Servlet runs each request in a __________ ?
OS shell
JVM
Separate thread
JRE
GenericServlet class is encapsulated inside __________ package
java.lang
javax.servlet
java.servlet
javax.servlet.http
Which class provide implementation for service() method ?
GenericServlet
HttpServlet
Servlet
none of the above
_________ is responsible for managing execution of servlet
Web Container
Servlet Context
JVM
Server
Deployment Descriptor(DD) is a _________ .
Servlet used to maintain other servlet.
Text document
XML document that is used by Web Container to run servlets and JSPs.
Library file.
Which method is called only once in Servlet life cycle ?
service()
initialize()
init()
all of the above
Which of these classes define the getWriter() method that returns an object of type PrintWriter ? Select the one correct answer. ?
HttpServletRequest
HttpServletResponse
ServletConfig
ServletContext
Which method defined in the HttpServletRequest returns the object of RequestDispatcher ?
getRequestDispatcher()
getDispatcher()
getRequest()
requestDispatcher()
When the Web Container initializes a servlet, it creates a ___________ object for the servlet ?
ServletConfig
ServletInit
ServletContext
None of the above
____________ object is available to any servlet or JSPs that are part of the web app and provides communication between servlets and JSPs.
Servlet
ServletConfig
ServletContext
HttpServletContext
If the client has disabled cookie in the browser, which session management mechanism could the web container employ ?
Session Management using Cookies
Session Management using URL rewriting
Either Cookies or URL rewriting
Cookies and URL rewriting must be used together
Which statement about HttpSession is not true?
HttpSession object is used to store entire session with a specific client
Any servlet can have access to HttpSession object through the getSession() method
A session will become invalid as soon as the user close all the browser window
Attribute can be stored, retrieved and removed from HttpSession object
Given request is an HttpServletRequest, which code snippets will creates a session if one doesn't exist?
request.getSession(false);
request.createSession();
request.getNewSession();
request.getSession();
Which method is used access the cookies that are added to response object?
getCookies()
getNewCookies();
cookies();
returnCookies();
Which statement is true for request.getSession(true) method?
if session already exist, it return the existing session else create a new session
getSession(true) method always returns a new session
getSession(true) method always returns a pre existing session
none
Cookies are stored on _______ side.
Client
Server
database
none
Which method is used to delete a session?
invalidateSession()
invalidate()
deleteSession()
delete()
