On This Page
This set of J2EE Technologies Multiple Choice Questions & Answers (MCQs) focuses on J2Ee Technologies Set 3
Q1 | Which of the following is true about servlets?
- Servlets execute within the address space of web server
- Servlets are platform-independent because they are written in java
- Servlets can use the full functionality of the Java class libraries
- Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries
Q2 | Which method is used to specify before any lines that uses the PrintWriter?
- setPageType()
- setContextType()
- setContentType()
- setResponseType()
Q3 | Which of the following are the session tracking techniques?
- URL rewriting, using session object, using response object, using hidden fields
- URL rewriting, using session object, using cookies, using hidden fields
- URL rewriting, using servlet object, using response object, using cookies
- URL rewriting, using request object, using response object, using session object
Q4 | The getSession() method with „true? as its parameter [ getSession(true) ] it will return the appropriate session object when
- the session is completed
- the session object is passed to another method
- the session does not exists
- the session is existing
Q5 | A servlet maintain session in
- Servlet container
- Servlet context
- Servlet request heap
- Servlet response heap
Q6 | Servlet mapping defines
- an association between a URL pattern and a servlet
- an association between a URL pattern and a request page
- an association between a URL pattern and a response page
- All of the above
Q7 | The life cycle of a servlet is managed by
- servlet context
- servlet container
- the supporting protocol (such as http or https)
- all of the above
Q8 | The init parameter name and value pairs that are defined in web.xml file are handled by
- ServletConfig object
- ServletContext object
- ServletRequest object
- ServletResponse object
Q9 | 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
Q10 | Which of the following package contains servlet classes?
- javax.servlet
- javax.servlet.http
- Both of the above
- None of the above
Q11 | Which page directive should be used in JSP to generate a PDF page?
- contentType
- generatePdf
- typePDF
- contentPDF
Q12 | Which tag should be used to pass information from JSP to included JSP?
- Using <%jsp:page> tag
- Using <%jsp:param> tag
- Using <%jsp:import> tag
- Using <%jsp:useBean> tag
Q13 | Application is instance of which class?
- javax.servlet.Application
- javax.servlet.HttpContext
- javax.servlet.Context
- javax.servlet.ServletContext
Q14 | _jspService() method of HttpJspPage class should not be overridden.
- TRUE
- FALSE
- none
- all
Q15 | 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
Q16 | Default value of autoFlush attribute is?
- TRUE
- FALSE
- none
- all
Q17 | 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
Q18 | “request” is instance of which one of the following classes?
- Request
- HttpRequest
- HttpServletRequest
- ServletRequest
Q19 | Which is not a directive?
- include
- page
- export
- useBean
Q20 | Which is mandatory in tag?
- id, class
- id, type
- type, property
- type,id
Q21 | Which one of the following is correct for directive in JSP?
- <%@directive%>
- <%!directive%>
- <%directive%>
- <%=directive%>
Q22 | Which of the following action variable is used to include a file in JSP?
- jsp:setProperty
- jsp:getProperty
- jsp:include
- jsp:plugin
Q23 | Which attribute uniquely identification element?
- ID
- Class
- Name
- Scope
Q24 | “out” is implicit object of which class?
- javax.servlet.jsp.PrintWriter
- javax.servlet.jsp.SessionWriter
- javax.servlet.jsp.SessionPrinter
- javax.servlet.jsp.JspWriter
Q25 | Which object stores references to the request and response objects?
- sessionContext
- pageContext
- HttpSession
- sessionAttribute