Вы находитесь на странице: 1из 15

Question 1

Question text
A result is a string that determines which view should be rendered by the framework
Select one:
a. True
b. False

Question 2
Complete
Mark 0.00 out of 1.00

Question text
What is wrong with the following code ?
<%
if(strPassword.equals("boss"))
{
<jsp:forward page="Welcome.jsp" flush="true"/>
}
else
{
}
%>
Select one:
a. Unmatched brackets in the statements
b. Flush attribute must be false
c. Actions cannot be used within scriptlet blocks
d. 'file' should be used instead of 'page' in the <jsp:forward/> action tag

Question 3
Complete
Mark 1.00 out of 1.00

Question text
How to instantiate IoC container?
Select one:
a. ApplicationContext context = new ClassPathXmlApplicationContext(spring.xml);
b. ApplicationContent context = new ClasspathxmlApplicationContent(spring.xml);
c. ApplicationContext context = new XmlApplicationContext(Spring.bean.xml);
d. ApplicationContext context = new ApplicationContext(spring.xml);

Question 4
Complete
Mark 1.00 out of 1.00

Question text
A simple java application uses Hibernate core to access db. Which of the following statements
are true?
Select one:
a. Hibernate gets initialized when the application starts.
b. Hibernate gets initialized when a SessionFactory is created.
c. Hibernate gets initialized when one calls first db access Query object.
d. Hibernate gets initialized when first session gets created

Question 5
Complete
Mark 1.00 out of 1.00

Question text
The full form of JDBC is
Select one:
a. Java Database Connection
b. Java Database Connectivity
c. Java Database Commitment
d. Java Database Console

Question 6
Complete
Mark 1.00 out of 1.00

Question text
Action object transfers data from view to model.
Select one:
a. True
b. False

Question 7
Complete
Mark 1.00 out of 1.00

Question text
Given in JSP:

1. <%java.util.Map map = new java.util.HashMap();


2. request.setAttribute("map", map);
3. map.put("a","b");
4. map.put("b","c");
5. map.put("c","d");%>
6. <%-- insert code here -- %>
Which EL expression, inserted at line 6, is valid and evaluate to "d"?
Select one:
a. ${map[c]}
b. ${map["c"]}
c. ${map.map.b}
d. ${map.map(map.b)}

Question 8
Complete
Mark 1.00 out of 1.00

Question text
The JDBC-ODBC bridge is multithreaded
Select one:
a. False
b. True

Question 9
Complete
Mark 1.00 out of 1.00

Question text
Which of the following are the session tracking techniques?
Select one:
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

Question 10
Complete
Mark 1.00 out of 1.00

Question text
Can we retrieve a whole row of data at once, instead of calling an individual
ResultSet.getXXX method for each column ?
Select one:
a. True

b. False

Question 11
Complete
Mark 1.00 out of 1.00

Question text
How many JDBC drivers are there ?
Select one:
a. 2
b. 4
c. 3
d. 1

Question 12
Complete
Mark 1.00 out of 1.00

Question text
To get the servlet environment information
Select one:
a. ServletConfig object is used
b. ServletException object is used
c. ServletContext object is used
d. ServletRequest object is used

Question 13
Complete
Mark 0.00 out of 1.00

Question text
A JSP page needs to perform some operations before servicing the first request. Where can
this be done?
Select one:
a. within the <jsp:initialize> XML element
b. within a scriptlet at the top of the JSP page
c. within the page directive of the JSP page
d. within a method called jspInit

Question 14
Complete
Mark 0.00 out of 1.00

Question text
Struts2 Actions are singletons and must be thread-safe since there will only be one instance of
a class to handle all requests for that Action
Select one:
a. True
b. False

Question 15
Complete
Mark 1.00 out of 1.00

Question text
Which method is used to specify before any lines that uses the PintWriter?
Select one:
a. setPageType()
b. setContextType()
c. setContentType()
d. setResponseType()

Question 16
Complete
Mark 1.00 out of 1.00

Question text
Which ensures that a JSP response is of type "text/plain"?
Select one:
a. <%@ page mimeType="text/plain" %>
b. <%@ page pageEncoding="text/plain" %>
c. <%@ page contentType="text/plain" %>
d. <%@ page contentEncoding="text/plain" %>

Question 17
Complete
Mark 1.00 out of 1.00

Question text
_________ Handles task ranging from data transfer, validation to exception handling.
Select one:
a. Interceptors
b. Validators
c. Framework
d. FilterDispatcher

Question 18
Complete
Mark 1.00 out of 1.00

Question text
The JDBC-ODBC Bridge supports multiple concurrent open statements per connection.
Select one:
a. True
b. False

Question 19
Complete
Mark 1.00 out of 1.00

Question text
In terms of JDBC, what is a DataSource?
Select one:
a. A DataSource is the basic service for managing a set of JDBC drivers
b. A DataSource is the Java representation of a physical data source
c. A DataSource is a registry point for JNDI-services
d. A DataSource is a factory of connections to a physical data source

Question 20
Complete
Mark 0.00 out of 1.00

Question text
From a MVC perspective, Struts2 provides the _________
Select one:
a. Model
b. View
c. Controller
d. None of the above

Question 21
Complete
Mark 1.00 out of 1.00

Question text
Which of the following statements makes your compiled JSP page implement the
SingleThreadModel interface?

Select one:
a. <%@ page isThreadSafe="false" %>
b. <%@ page isThreadSafe="true" %>

Question 22
Complete
Mark 1.00 out of 1.00

Question text
For a given ServletResponse response, which retrieves an object for writing binary data?
Select one:
a. response.getWriter()
b. response.getOutputStream()
c. response.getOutputWriter()
d. response.getWriter().getOutputSTream()

Question 23
Complete
Mark 1.00 out of 1.00

Question text
Which of the following can not be used as the scope when using a JavaBean with JSP?
Select one:
a. session
b. application
c. request
d. response

Question 24
Complete
Mark 1.00 out of 1.00

Question text
Which of the following is NOT true about servlets?
Select one:
a. They are instantiated every time a request is made.
b. They are a mechanism used by the class loader to download applets.
c. They can be used instead of CGI scripts.
d. They require a web browser that supports JDK 1.1

Question 25
Complete
Mark 1.00 out of 1.00

Question text
Given:
<% int[] nums = {42, 420, 4200};
request.setAttribute("foo", nums); %>
${5 + 3 lt 6}
${requestScope['foo'][0] ne 10 div 0}
${10 div 0}
What is the result?
Select one:
a. true true
b. true true Infinity
c. false true Infinity
d. An exception is thrown

Question 26
Complete
Mark 1.00 out of 1.00

Question text
Which method must be used to encode a URL passed as an argument to
HttpServletResponse.sendRedirect when using URL rewriting for session tracking?
Select one:
a. ServletResponse.encodeURL
b. HttpServletResponse.encodeURL
c. ServletResponse.encodeRedirectURL
d. HttpServletResponse.encodeRedirectURL

Question 27
Complete
Mark 1.00 out of 1.00

Question text
DispatchAction class does not provide an implementation of the execute() method.
Select one:
a. True
b. False

Question 28
Complete
Mark 1.00 out of 1.00

Question text
Which of the following is false for the Type 4 driver in JDBC
Select one:
a. Type 4 driver, or, "native protocol, pure Java" driver converts JDBC calls into the network
protocol used by the database directly
b. A Type 4 driver requires no client software, so it's ideal for deployment to browsers at runtime
c. As Type 4 drivers are 100% Java, use Java sockets to connect to the database, and require no
client-side data access code, they are ideal for applets or other download situations inside a firewall
d. Type 4 drivers cant be used with Netscape

Question 29
Complete
Mark 1.00 out of 1.00

Question text
How can you retrieve information from a ResultSet?
Select one:
a. By invoking the method get (..., String type) on the ResultSet, where type is the database type
b. By invoking the method get (..., Type type) on the ResultSet, where Type is an object which
represents a database type
c. By invoking the method getValue (...), and cast the result to the desired java type
d. By invoking the special getter methods on the ResultSet: getString (...), get Boolean (...), getClob
(...),

Question 30
Complete
Mark 1.00 out of 1.00

Question text
A JSP page needs to set the property of a given JavaBean to a value that is
calculated with the JSP page. Which three jsp:setProperty attributes must be used to perform
this initialization?
Select one:
a. name, value, property
b. id, val, property
c. name, param, property
d. name, id, value

Question 31
Complete
Mark 0.00 out of 1.00

Question text
An application server is required for Spring's Transaction mechanism to run. This statement
is
Select one:
a. True
b. False

Question 32
Complete
Mark 1.00 out of 1.00

Question text
_________ class provides an empty implementation of init and destroy methods.
Select one:
a. AssociatedInterceptor
b. AInterceptor
c. AbstractInterceptor
d. AnnotedInterceptor

Question 33
Complete
Mark 1.00 out of 1.00

Question text
Which of the following is not a standard method called as part of the JSP life cycle?
Select one:
a. jspService()
b. jspInit()
c. jspDestroy()
d. _jspService()

Question 34
Complete
Mark 1.00 out of 1.00

Question text
Given the definition of MyServlet:
1. public class MyServlet extends HttpServlet {
2. public void service(HttpServletRequest request, HttpServletResponse response)
3. throws ServletException, IOException {
4. HttpSession session = request.getSession()
5. session.setAttribute("myAttribute", "myAttributeValue");
6. session.invalidate();

7. response.getWriter().println("value=" +session.setAttribute("myAttribute"));
8. }
9. }
What is the result when a request is sent to MyServlet?
Select one:
a. An IllegalStateException is thrown at runtime.
b. An InvalidSessionException is thrown at runtime.
c. The string "value=null" appears in the response stream.
d. The string "value=myAttributeValue" appears in the response stream.

Question 35
Complete
Mark 0.00 out of 1.00

Question text
The include() method of RequestDispatcher
Select one:
a. sends a request to another resource like servlet, jsp or html
b. includes resource of file like servlet, jsp or html
c. appends the request and response objects to the current servlet
d. None of the above

Question 36
Complete
Mark 1.00 out of 1.00

Question text
Which implicit object is used in a JSP page to retrieve values associated with
<context-param> entries in the deployment descriptor?
Select one:
a. application
b. config
c. request
d. session

Question 37
Complete
Mark 1.00 out of 1.00

Question text
The Hibernate XML configuration file name is?
Select one:
a. hibernate.cfg.xml
b. hibernate.config.xml

c. hibernate.cg.xml
d. None

Question 38
Complete
Mark 1.00 out of 1.00

Question text
Which of the following statement is true for the Type 2 JDBC driver?
Select one:
a. A Type 2 driver converts JDBC calls into calls for a specific database.
b. This driver is referred to as a "native-API, partly Java driver."
c. As with the Type 1 driver, some binary code may be required on the client machine, which means
this type of driver is not suitable for downloading over a network to a client.
d. All of the above

Question 39
Complete
Mark 1.00 out of 1.00

Question text
In Struts2, MVC (Model - View - Controller) is implemented by _________
Select one:
a. Action - Result - FilterDispatcher
b. Action - View - FilterDispatcher
c. Model - Result - Controller
d. Model - View - Controller

Question 40
Complete
Mark 1.00 out of 1.00

Question text
How can a whole class be mapped as immutable in Hibernate?
Select one:
a. mutable-mapping="false"
b. mutable="true"
c. mutable="false"
d. None

Question 41
Complete
Mark 1.00 out of 1.00

Question text
What happens if you call the method close() on a ResultSet object?
Select one:
a. the method close() does not exist for a ResultSet. Only Connections can be closed
b. the database and JDBC resources are released
c. you will get a SQLException, because only Statement objects can close ResultSets
d. the ResultSet, together with the Statement which created it and the Connection from which the
Statement was retrieved, will be closed and release all database and JDBC resources

Question 42
Complete
Mark 1.00 out of 1.00

Question text
An action can be any ________ that contains an execute method.
Select one:
a. JSP File
b. Bean
c. XML File
d. Properties file

Question 43
Complete
Mark 1.00 out of 1.00

Question text
Which JSTL code snippet can be used to perform URL rewriting?
Select one:
a. <a href='<c:url url="foo.jsp"/>' />
b. <a href='<c:link url="foo.jsp"/>' />
c. <a href='<c:link value="foo.jsp"/>' />
d. <a href='<c:url value="foo.jsp"/>' />

Question 44
Complete
Mark 1.00 out of 1.00

Question text
The JDBC-ODBC bridge from Sun's Java Software does not provide network access to
desktop databases like Microsoft access by itself.
Select one:

a. True
b. False

Question 45
Complete
Mark 0.00 out of 1.00

Question text
The application does not want to use PK auto generation strategy of the underlying database.
It has its own algorithm which it wants to implement.
What is the best way to do that ?
Select one:
a. Use generator type guid
b. Use generator type native
c. Use generator type sequence-identity
d. User generator type assigned

Question 46
Complete
Mark 1.00 out of 1.00

Question text
execute() method of Struts2 Action returns _____________
Select one:
a. An object of ActionMap class
b. An object of String
c. A Boolean value
d. An object of ActionAware class

Question 47
Complete
Mark 0.00 out of 1.00

Question text
Servlet mapping defines
Select one:
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

Question 48
Complete

Mark 1.00 out of 1.00

Question text
An interceptor has only 2 life cycle methods:
1. intercept
2. destroy
Select one:
a. True
b. False

Question 49
Complete
Mark 1.00 out of 1.00

Question text
When using a JavaBean to get all the parameters from a form, what must the property be set
to (??? in the following code) for automatic initialization?
<jsp:useBean id="fBean" class="govi.FormBean" scope="request"/>
<jsp:setProperty name="fBean" property="???" />
<jsp:forward page="/servlet/JSP2Servlet" />
Select one:
a. ?
b. @
c. $
d. *

Question 50
Complete
Mark 1.00 out of 1.00

Question text
In Servlets, parameters are passed as _______ pair in a get request.
Select one:
a. value
b. name / value
c. Both can be used
d. None of the above

Вам также может понравиться