81
87.5k

100+ J2EE Technologies Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Master of Computer Applications (MCA) .

51.

Which of the following is true about servlets?

A. Servlets execute within the address space of web server
B. Servlets are platform-independent because they are written in java
C. Servlets can use the full functionality of the Java class libraries
D. Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries
Answer» D. Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries
52.

Which method is used to specify before any lines that uses the PrintWriter?

A. setPageType()
B. setContextType()
C. setContentType()
D. setResponseType()
Answer» C. setContentType()
53.

Which of the following are the session tracking techniques?

A. URL rewriting, using session object, using response object, using hidden fields
B. URL rewriting, using session object, using cookies, using hidden fields
C. URL rewriting, using servlet object, using response object, using cookies
D. URL rewriting, using request object, using response object, using session object
Answer» B. URL rewriting, using session object, using cookies, using hidden fields
54.

The getSession() method with „true‟ as its parameter [ getSession(true) ] it will return the appropriate session object when

A. the session is completed
B. the session object is passed to another method
C. the session does not exists
D. the session is existing
Answer» D. the session is existing
55.

A servlet maintain session in

A. Servlet container
B. Servlet context
C. Servlet request heap
D. Servlet response heap
Answer» B. Servlet context
56.

Servlet mapping defines

A. an association between a URL pattern and a servlet
B. an association between a URL pattern and a request page
C. an association between a URL pattern and a response page
D. All of the above
Answer» A. an association between a URL pattern and a servlet
57.

The life cycle of a servlet is managed by

A. servlet context
B. servlet container
C. the supporting protocol (such as http or https)
D. all of the above
Answer» B. servlet container
58.

The init parameter name and value pairs that are defined in web.xml file are handled by

A. ServletConfig object
B. ServletContext object
C. ServletRequest object
D. ServletResponse object
Answer» A. ServletConfig object
59.

How many ServletContext objects are available for an entire web application?

A. One each per servlet
B. One each per request
C. One each per response
D. Only one
Answer» D. Only one
60.

Which of the following package contains servlet classes?

A. javax.servlet
B. javax.servlet.http
C. Both of the above
D. None of the above
Answer» C. Both of the above
61.

Which page directive should be used in JSP to generate a PDF page?

A. contentType
B. generatePdf
C. typePDF
D. contentPDF
Answer» A. contentType
62.

Which tag should be used to pass information from JSP to included JSP?

A. Using <%jsp:page> tag
B. Using <%jsp:param> tag
C. Using <%jsp:import> tag
D. Using <%jsp:useBean> tag
Answer» A. Using <%jsp:page> tag
63.

Application is instance of which class?

A. javax.servlet.Application
B. javax.servlet.HttpContext
C. javax.servlet.Context
D. javax.servlet.ServletContext
Answer» D. javax.servlet.ServletContext
64.

_jspService() method of HttpJspPage class should not be overridden.

A. True
B. False
C. none
D. all
Answer» A. True
65.

Which option is true about session scope?

A. Objects are accessible only from the page in which they are created
B. Objects are accessible only from the pages which are in same session
C. Objects are accessible only from the pages which are processing the same request
D. Objects are accessible only from the pages which reside in same application
Answer» B. Objects are accessible only from the pages which are in same session
66.

Default value of autoFlush attribute is?

A. true
B. false
C. none
D. all
Answer» A. true
67.

Which one is the correct order of phases in JSP life cycle?

A. Initialization, Cleanup, Compilation, Execution
B. Initialization, Compilation, Cleanup, Execution
C. Compilation, Initialization, Execution, Cleanup
D. Cleanup, Compilation, Initialization, Execution
Answer» C. Compilation, Initialization, Execution, Cleanup
68.

“request” is instance of which one of the following classes?

A. Request
B. HttpRequest
C. HttpServletRequest
D. ServletRequest
Answer» C. HttpServletRequest
69.

Which is not a directive?

A. include
B. page
C. export
D. useBean
Answer» C. export
70.

Which is mandatory in tag?

A. id, class
B. id, type
C. type, property
D. type,id
Answer» A. id, class
71.

Which one of the following is correct for directive in JSP?

A. <%@directive%>
B. <%!directive%>
C. <%directive%>
D. <%=directive%>
Answer» A. <%@directive%>
72.

Which of the following action variable is used to include a file in JSP?

A. jsp:setProperty
B. jsp:getProperty
C. jsp:include
D. jsp:plugin
Answer» C. jsp:include
73.

Which attribute uniquely identification element?

A. ID
B. Class
C. Name
D. Scope
Answer» A. ID
74.

“out” is implicit object of which class?

A. javax.servlet.jsp.PrintWriter
B. javax.servlet.jsp.SessionWriter
C. javax.servlet.jsp.SessionPrinter
D. javax.servlet.jsp.JspWriter
Answer» D. javax.servlet.jsp.JspWriter
75.

Which object stores references to the request and response objects?

A. sessionContext
B. pageContext
C. HttpSession
D. sessionAttribute
Answer» B. pageContext
76.

What temporarily redirects response to the browser?

A. <jsp:forward>
B. <%@directive%>
C. response.sendRedirect(URL)
D. response.setRedirect(URL)
Answer» C. response.sendRedirect(URL)
77.

Which tag is used to set a value of a JavaBean?

A. <c:set>
B. <c:param>
C. <c:choose>
D. <c:forward>
Answer» A. <c:set>
78.

Can <!–comment–> and <%–comment–%> be used alternatively in JSP?

A. True
B. False
C. none
D. all
Answer» B. False
79.

Java code is embedded under which tag in JSP?

A. Declaration
B. Scriptlet
C. Expression
D. Comment
Answer» B. Scriptlet
80.

Which of the following is not a directive in JSP?

A. page directive
B. include directive
C. taglib directive
D. command directive
Answer» D. command directive
81.

In RMI Architecture which layer Intercepts method calls made by the client/redirects these calls to a remote RMI service?

A. Stub & Skeleton Layer
B. Application Layer
C. Remote Reference Layer
D. Tr
Answer» A. Stub & Skeleton Layer
82.

Which is an object, acts as a gateway for the client side, all the outgoing requests are routed through it and it resides at the client side and represents the remote object?

A. Stub
B. Skeleton
C. Both A & B
D. None of the above
Answer» A. Stub
83.

Java supports RMI, RMI Stands for?

A. Random Method Invocation
B. Remote Memory Interface
C. Remote Method Invocation
D. Random Method Invocation
Answer» C. Remote Method Invocation
84.

An RMI Server is responsible for _______

A. Creating an instance of the remote object
B. Exporting the remote object
C. Binding the instance of the remote object to the RMI registry
D. All mentioned above
Answer» B. Exporting the remote object
85.

Abbreviate the term DGC?

A. Digital Garbage Collection
B. Distributed Garbage Collection
C. Distributed Garbage Connection
D. None of the above
Answer» B. Distributed Garbage Collection
86.

RMI and EJB, provides services to access an object running in another JVM (known as remote object).

A. True
B. False
C. none
D. all
Answer» A. True
87.

In RMI, the objects are passed by _____.

A. Value
B. Reference
C. Value and Reference
D. None of the above
Answer» A. Value
88.

RMI uses a layered architecture; each of the layers could be enhanced or replaced without affecting the rest of the system.

A. True
B. False
C. none
D. all
Answer» A. True
89.

What are the exceptions which have to be handled in a RMI client program?

A. RemoteException
B. NotBoundException
C. MalFormedURLException
D. All mentioned above
Answer» D. All mentioned above
90.

RMI is a server-side component; It is not required to be deployed on the server.

A. True
B. False
C. none
D. all
Answer» B. False
91.

Which package is used for Remote Method Invocation (RMI)?

A. java.lang.rmi
B. java.lang.reflect
C. java.applet
D. java.rmi
Answer» D. java.rmi
92.

Which program obtains a remote reference to one or more remote objects on a server and then invokes methods on them in an RMI application?

A. Server
B. Client
C. Both A & B
D. None of the above
Answer» B. Client
93.

Which objects are used by RMI for communicating with the remote object?

A. Stub
B. Skeleton
C. Both A & B
D. None of the above
Answer» C. Both A & B
94.

RMI Architecture consists of how many layers?

A. 5
B. 3
C. 4
D. 2
Answer» C. 4
95.

Which method in naming class specifies a name to the remote object?

A. bind(string name)
B. rebind(string name)
C. Both A & B
D. None of the above
Answer» A. bind(string name)
96.

1099 is the default port used by RMI Registry.

A. True
B. False
C. none
D. all
Answer» A. True
97.

RMI uses which protocol on top of TCP/IP (an analogy is HTTP over TCP/IP)?

A. Java Remote Method Protocol (JRMP)
B. Internet Inter-ORB Protocol (IIOP)
C. Jinni Extensible Remote Invocation (JERI)
D. All mentioned above
Answer» A. Java Remote Method Protocol (JRMP)
98.

Which method of the Naming class (found in java.rmi) is used to update the RMI registry on the server machine?

A. rebind ()
B. lookup()
C. Both A & B
D. None of the above
Answer» A. rebind ()
99.

What is the built on top of the socket programming?

A. EJB
B. RMI
C. Both A & B
D. None of the above
Answer» B. RMI
100.

In RMI which layer defines and supports the invocation semantics of the RMI connection and this layer maintains the session during the method call?

A. The Stub & Skeleton Layer
B. The Application Layer
C. The Remote Reference Layer
D. The Tr
Answer» A. The Stub & Skeleton Layer

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.