All Units Advanced Java MCQ Question Bank
All Units Advanced Java MCQ Question Bank
Answer: d
a) java.applet
b) java.rmi
c) java.lang.rmi
d) java.lang.reflect
Answer: b
Answer: a
Answer: a
5. Which of these class is used for creating a client for a server-client operations?
a) serverClientjava
b) Client.java
c) AddClient.java
d) ServerClient.java.
Answer: c
6. Which of these package is used for all the text related modifications?
a) java.text
b) java.awt
c) java.lang.text
d) java.text.modify
Answer: a
7. Which of the following is advantage of using JDBC connection pool?
a) Slow performance
b) Using more memory
c) Using less memory
d) Better performance
Answer: d.
8. Which of the following is advantage of using PreparedStatement in Java?
a) Slow performance
b) Encourages SQL injection
c) Prevents SQL injection
d) More memory usage
Answer: c
Answer: c
Answer: d
Answer: a
a) Type 3 Driver
b) Type-2 Driver
c) Type-4 Driver
d) Type-1 Driver
Answer: C
13) Which of the following method is static and synchronized in JDBC API?
a) getConnection()
b) prepareCall()
c) executeUpdate()
d) executeQuery()
Answer: a
a) Type 4
b) Type 3
c) Type 1
d) Type 2
Answer: c
a) JDBC tracing
b) Exception handling
c) Error handling
d) Debugging
Answer: a
Answer: c
17) Which of the following interface provides the commit() and rollback() methods?
a) Statement Interface
b) ResultSet Interface
c) Connection Interface
d) RowSet Interface
Answer: c
18. Which of the following code is used to get an attribute in a HTTP Session object in servlets?
a) session.getAttribute(String name)
b) session.alterAttribute(String name)
c) session.updateAttribute(String name)
d) session.setAttribute(String name)
Answer: a
19. Which method is used to get three-letter abbreviation for locale’s country in servlets?
a) Request.getISO3Country()
b) Locale.getISO3Country()
c) Response.getISO3Country()
d) Local.retrieveISO3Country()
Answer: a
20. Which of the following code retrieves the body of the request as binary data?
a) DataInputStream data = new InputStream()
b) DataInputStream data = response.getInputStream()
c) DataInputStream data = request.getInputStream()
d) DataInputStream data = request.fetchInputStream()
Answer: c
Answer: a
22. Which of the following code is used to retrieve the request header?
a) Header.getHeaderName(headerName)
b) response.getHeader(headerName)
c) request.getHeader(headerName)
d) response.containsHeader(headerName)
Answer: c
23. How is the dynamic interception of requests and responses to transform the information done?
a) servlet container
b) servlet config
c) servlet context
d) servlet filter
Answer: d
24. RMIArchitectureconsists ofhowmanylayers?
a) 5
b) 3
c) 4
d) 2
Answer: c
25. WhatisreturntypeofthegetSession()method?
a) Session
b) int
c) HttpSession
d) Boolean
Answer: c
26. Which of the following code is used to get PrintWriter object in servlet?
a) response.getWriter()
b) request.getWriter()
c) new PrintWriter()
d) new getWriter()
Answer: a
27. Which of the following is stored at client side?
a) URL rewriting
b) Hidden form fields
c) SSL sessions
d) Cookies
Answer: d
28.What is the maximum size of cookie?
a) 4 KB
b) 4 MB
c) 4 bytes
d) 40 KB
Answer: a
(a)EJB Deployer
(b)Application Assembler
(c)Network Engineer
(d)Server Provider
Answer:d
32.Which of the following is the format is used for EJB deployment descriptor files?
(a)XML
(b)XSL
(c)HTML
(d)DHTML.
Answer:a
33.Which JSP tag is used to transfer processing to another JSP page?
(a) <jsp:include>
(b) <jsp:forward>
(c) <jsp:redirect>
(d) <jsp:useBean>
Answer:b
34.Which EJB usually represents persistent data?
Answer: a
(a) Page
(b) Session
(c) Request
(d) Application
Answer: a
36.Which method of the request object is used to extract values of the input fields in a form when it is
submitted?
(a) getParameter
(b) getParameterNames
(c) getValues
(d) putValues
Answer: a
37.Which method of the servlet is/are called several times in its life?
(a) init()
(b) doPost()
(c) destroy()
(d) getPost()
Answer: b
38.Which EJB uses EJB-QL for query operations?
Answer: b
39.Which object is used to forward the request processing from one servlet to another?
(a) ServeltContext
(b) ServletConfig
(c) RequestDispatcher
(d) ResponseDispatcher
Answer: c
40. Which of the following is used to redirect the response from a servlet to a JSP page?
(a) response.sendRedirect()
(b) request.sendRedirect()
(c) request.forward()
(d) response.forward()
Answer: a
41. Which technology do we use to combine our business logic with the presentation logic?
a) Servlet
b) JSP
c) EJB
d) MVC
Answer: a
42. Which tag is used to execute java source code in JSP?
a) Declaration Tag
b) Scriptlet tag
c) Expression tag
d) StandardAaction tag
Answer: b
43. Which JSP life cycle is in the correct order?
a) Translation → Request Processing →Initializing → Destroying
b) Translation → Initializing → Destroying → Request Processing
c) Initializing → Translation → Request Processing → Destroying
d) Translation → Initializing → Request Processing → Destroying
Answer: d
44. What executes EJB components?
a) Awebserver
b) Anapplicationserver
c) AnEJBcontainer
d) Adatabaseserver
Answer: c
45.Application is instance of which class?
a) javax.servlet.Application
b) javax.servlet.HttpContext
c) javax.servlet.Context
d) javax.servlet.ServletContext
Answer: d
46. 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
47.Which is mandatory in <jsp:useBean /> tag?
a) id, class
b) id, type
c) type, property
d) type,id
Answer: a
48.Which one of the following classes is instance of “request”?
a) Request
b) HttpRequest
c) HttpServletRequest
d) ServletRequest
Answer: c
49. Which one of the following is, a following statement is a prepared statements?
a) Insert into department values(?,?,?)
b) Insert into department values(x,x,x)
c) SQLSetConnectOption(conn, SQL AUTOCOMMIT, 0)
d) SQLTransact(conn, SQL ROLLBACK)
Answer: a
50. The doGet() method in the example extracts values of the parameter’s type and number by using
__________
a) request.getParameter()
b) request.setParameter()
c) responce.getParameter()
d) responce.getAttribute()
Answer: a
51. Where is metadata stored in MySQL?
a) In the MySQL database metadata
b) In the MySQL database metasql
c) In the MySQL database mysql
d) In the MySQL database sql
Answer: c
52. What is bytecode?
a) Machine-specific code
b) Java code
c) Machine-independent code
d) Machine dependent code
Answer: c
53. MVC Architecture stands for___________
a) Model ViewController
b) ModeViewControl
c) Maximum View Control
d) ModeViewController
Answer: a
54. Manifestfileisa specialfile thatcontains informationabout thefiles packedin
a) JAR file
b) GIF
c) JPEG
d) XML
Answer: a
55. JavaServlets areefficientand powerful solutionforcreating ............................. fortheweb.
a) dynamiccontent
b) staticcontent
c) hardware
d) staticpage
Answer: a
56. The MVC approach is to use the forward method of RequestDispatcher to transfer control
from __________.
a) servlet to the JSP page
b) servlet to the xml page
c) servlet to the jscript page
d) JSP to the servlet page
Answer: a
57. Model layer is also called as __________
a) Presentation layer
b) Data layer
c) Interface layer
d) Session layer
Answer: b
58. The model layer consist of the ______________of the system.
a) Presentation logic
b) Business logic
c) Interface logic
d) Control logic
Answer: b
59.Which layer shows the data on UI of the application?
a) Model layer
b) Presentation layer
c) View layer
d) Controller layer
Answer: c
60. Which layer process the request coming from view layer?
a) Model layer
b) Presentation layer
c) View layer
d) Controller layer
Answer: d
Answer: a
63. Which of the following method is static and synchronized in JDBC API?
a) getConnection()
b) prepareCall()
c) executeUpdate()
d) executeQuery()
Answer: a
64. Which of the following driver is the fastest one?
a) JDBC-ODBC Bridge Driver
b) Native API Partly Java Driver
c) Network Protocol Driver
d) JDBC Net Pure Java Driver
Answer: d
65. What is JDBC Savepoint?
a) An intermediate or checkpoint in a transaction
b) A point where we can store queries
c) A point where the JDBC application starts execution
d) A memory where we can store transaction
Answer: a
66. Which of the following function is used to find the column count of the particular resultset?
a) getMetaData()
b) Metadata()
c) getColumn()
d) get Count()
Answer: a
67.Which of the following driver converts the JDBC calls into database-specific calls?
a) JDBC-ODBC Bridge Driver (Type 1)
b) Native API-partly Java Driver (Type 2)
c) Net Protocol-pure Java Driver (Type 3)
d) Native Protocol-pure Java Driver (Type 4)
Answer: b
68. Which is used to call the stored procedures and functions?
a) CallableStatement Interface
b) PreparedStatement Interface
c) ProcedureStatement Interface
d) StoredStatement Interface
Answer: a
69. In MVC Architecture, JSP work as______
a) Model layer
b) Presentation layer
c) View layer
d) Controller layer
Answer: b
70.WhichoftheseclassesdefinethegetWriter()methodthatreturnsanobjectoftypePrintWriter?
a) HttpServletRequest
b) HttpServletResponse
c) ServletConfig
d) ServletContext.
Answer: a
71.Which method is used to update the state of the given instance from the underlying database?
a) Session.store()
b) Session.keep()
c) Session.update()
d) Session.load()
Answer: a
72. Which of the following code retrieves the fully qualified name of the client making this
request?EJB
a) request.getRemoteHost()
b) response.getRemoteHost()
c) Header.getRemoteHost()
d) request.getPathInfo()
Answer: a
74. Which component can be used for sending messages from one application to another?
a) server
b) client
c) mq
d) webapp
Answer: c
75. Which of the following header must be included in java program to establish database connectivity
using JDBC ?
a) Import java.sql.*;
b) Import java.sql.odbc.jdbc.*;
c) Import java.jdbc.*;
d) Import java.sql.jdbc.*;
Answer: a
UNIT 1
1) Java supports RMI, RMI Stands for?
a. Random Method Invocation
b. Remote Memory Interface
c. Remote Method Invocation
d. Random Method Invocation
ANS : c
2) 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
ANS :a
6) 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
ANS : a
9. The package contains classes that help in connecting to a database, sending SQL
statements to the database and process the query request.
(a) connection.sql
(b) db.sql
(c) pkg.sql
(d) java.sql
ANS :d
10. Database programming using Java throws which of the following exception?
(a) SQLException
(b) ClassNotFoundException
(c) None of these
(d) Both of these
ANS :d
11. In the below statement, which type of query can be used with executeUpdate( )
method. statement.executeUpdate(query here)
(a) Insert, Update, Delete
(b) Insert, Select, Delete
(c) Only Select
(d) Any Query
ANS:a
12. SQL stands for .
(a) Structured Query Language
(b) Sequential Query Language
(c) Structured Question Language
(d) Sequential Question Language
ANS:a
13. is a table of data which represents a data from table.
(a) MetaData
(b) ResultSetMetaData
(c) ResultSet
(d) Statement
ANS:c
14. Which of the following method is supported by Statement interface?
(a) public boolean execute(String query)
(b) public ResultSet executeQuery(String query)
(c) public int executeUpdate(String query)
(d) All of above
ANS:d
15. What does the following code do : smt = con.createStatement( )
(a) A PreparedStatement object is created to send SQL commands to database.
(b) A Statement object is created to send SQL commands to database.
(c) A CallableStatement is created to send SQL commands to database.
(d) A Statement object is created to execute parameterized SQL commands.
ANS:b
16. Which kind of driver converts JDBC calls into calls on the Client API for Oracle, Sybase, Informix,
IBM DB2, or other DBMS
(a) JDBC ODBC bridge + ODBC Driver
(b) Native API partly – Java Driver
(c) JDBC – Net pure Java Driver
(d) Native Protocol Pure Java Driver
ANS:b
17. Which of the following function is used to find the column count of the particular ResultSet.
(a) getMetadata( )
(b) metadata( )
(c) getColumnCount( )
(d) getCount( )
ANS:c
18. DatabaseMetadata are retrieved through
(a) getDatabaseMetadata( )
(b) getMetaData( )
(c) getDBMetaData( )
(d) getDatabaseMeta( )
ANS:a
18. What is returntype of the getSession() method?
1. Session
2. int
3. HttpSession
4. boolean
5. void
ANS:3
19. Which is correct package for HttpServlet and HttpServletResponse?
1. javax.servlet.*;
2. javax.servlet.http.*;
3. javax.servlet.httpservlet.*;
4. java.lang.*;
ANS :2
20. Which of the following method is invoked when Http post request?
1. doPost()
2. doPostCall()
3. doHttpPost()
4. doPut()
5. doTrace()
ANS 1
UNIT 2
21. Java servlets are an efficient and powerful solution for creating................... for the web.
A) Dynamic content
B) Static content
C) Hardware
D) Both a and b
22. Native-protocol pure Java converts ……….. into the ................ used by DBMSs directly.
A) JDBC calls, network protocol
B) ODBC class, network protocol
C) ODBC class, user call
D) JDBC calls, user call
23. The JDBC-ODBC bridge allows ……….. to be used as ………..
A) JDBC drivers, ODBC drivers
B) Drivers, Application
C) ODBC drivers, JDBC drivers
D) Application, drivers
24. For the execution of DELETE SQL query in JDBC, .................. method must be used.
A) executeQuery()
B) executeDeleteQuery()
C) executeUpdate()
D) executeDelete()
25. Prepared Statement object in JDBC used to execute .............. queries.
A) Executable
B) Simple
C) High level
D) Parameterized
26. In Java servlet method init( ) is called ............................ times.
A) 1
B) 2
C) 0
D) multiple
27. …………………… of a remotely accessible object must implement …………….
A) all methods, RemoteException
B) class, RemoteException
C) class, RemoteInterface
D) all methods, RemoteInterface
28. In Java RMI, a stub is located in
A) client machine
B) proxy
C) server
D) none of the above
29. ODBC stands for
A) Object Data Binding Command
B) Open Database Console
C) Open Database Connectivity
D) Open Database Command
30. Which of the following is the default HttpRequest method?
(a) doGet( )
(b) doPost( )
(c) doTrace( )
(d) doPut( )
ANS:a
31. Given an HttpServletRequest request and HttpServletResponse response instances. Which
sets a cookie “username” with the value “joe” in a servlet?
(a) request.addCookie(new Cookie(“username” , “joe));
(b) response.addCookie(new Cookie(“username” , “joe”))
(c) request.addCookie(“username” , “joe);
(d) request.addCookie(“username” , “joe);
ANS:b
32. is a small piece of information that is passed back & forth in HTTP request & response.
(a) Servlet
(b) Applet
(c) Cookie
(d) Session
ANS:c
34. Which life cycle method is used to process a client’s request?
(a) start( )
(b) init( )
(c) service( )
(d) destroy( )
ANS:c
35. Apache Tomcat is .
(a) Servlet
(b) Java Program
(c) API
(d) Web server capable of running Java programs
ANS: d
36. What the getSession( ) method with “true” parameter will do?
(a) The session is completed
(b) The session object is passed to another method
(c) Creates new session if, the session does not exist
(d) The session is exist
ANS: c
37. Life cycle of a servlet is managed by
(a) Servlet Context
(b) Servlet Container
(c) Supporting protocol
(d) All of the above
ANS : b
38. is the first Phase of Servlet Life cycle.
(a) service( )
(b) init( )
(c) destroy( )
(d) Both B & C
ANS:b
39. Which method is used to specify before any lines that used the PrintWriter?
(a) setPageType( )
(b) setContextType( )
(c) setContentType( )
(d) setResponseType( )
ANS : c
40. is used to read data from a client request.
(a) ServletResponse
(b) ServletRequest
(c) Servlet
(d) ServletConfig
ANS :b
41. The following methods belongs to the life cycle methods of the servlet.
(a) init( )
(b) service( )
(c) destroy( )
(d) All of the above
ANS : d
42. Java servlet
(i) is a key component of the server side java development.
(ii) is a small pluggable extension to a server that enhances functionality
(iii) runs only in windows OS
(iv) allows developers to customize any java enabled server
(a) i, ii and iii are true
(b) i,iii and iv are true
(c) ii,iii and iv are true
(d) i,ii and iv are true
ANS : d
43. The major difference between Servlet and CGI is .
(a) Servlets are thread based and CGI is process based.
(b) Servlet executes slower than CGI.
(c) Servlet has no platform specific API where as CGI has.
(d) All of these
ANS : d
UNIT - 3
1) Which attribute specifies a JSP page that should process any exceptions thrown but not
caught in the current page?
ANS:B
2) In JSP Action tags which tags are used for bean development?
a. jsp:useBean
b. jsp:setPoperty
c. jsp:getProperty
d. All mentioned above
ANS:D
3) JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you can do
with Java servlets.
a. True
b. False
ANS:A
4) How many jsp implicit objects are there and these objects are created by the web container
that are available to all the jsp pages?
a. 8
b. 9
c. 10
d. 7
ANS:B
5) Which technology do we mix our business logic with the presentation logic?
a. Servlet
b. JSP
c. Both A & B
d. None of the above
ANS:A
6) Which tag is used to execute java source code in JSP?
a. Declaration Tag
b. Scriptlet tag
c. Expression tag
d. None of the above
ANS:B
7) Which JSP Action tags is used to include the content of another resource, it may be jsp, html
or servlet?
a. jsp:include
b. jsp:forward
c. jsp:plugin
d. jsp:papam
ANS:A
8) In JSP page directive which attribute defines the MIME(Multipurpose Internet Mail
Extension) type of the HTTP response?
a. import
b. Content Type
c. Extends
d. Info
ANS:B
9) A JSP page consists of which tags?
a. HTML tags
b. JSP tags
c. Both A & B
d. None of the above
ANS:C
10 - Which of the following is true about page scope?
A - Object created with request scope are accessible only from the page in which they are
created.
B - Object created with request scope are accessible only from the pages which are in same
session.
C - Object created with request scope are accessible only from the pages which are processing
the same request.
D - Object created with request scope are accessible only from the pages which reside in same
application.
ANS:A
11 - application is instance of which class?
A - javax.servlet.ServletContext
B - javax.servlet.HttpContext
C - javax.servlet.Context
D - javax.servlet.Application
ANS:A
12. JSP page perform request processing by calling method ?
A. service
B. jspService
C. _jspService
D. jsp_Service
ANS:C
13. Choose an incorrect statement from the following.
A. JSP pages are easier to maintain than a servlet.
B. The Web Container translate a Servlet into JSP page.
C. JSP is built on Java Technology so it is platform independent.
D. A JSP page seperates presentation and business logic.
ANS:B
14. Which JSP life cycle is in the correct order?
A. Translation → Initializing → Request Processing → Destroying
B. Translation → Request Processing → Initializing → Destroying
ANS:A
15. Which statement about jspInit() is true?
A. It does not have access to ServletConfig.
B. It does not have access to ServletContext.
C. It is called only once.
D. It cannot be overridden.
ANS:C
16. Which method in JSP is used to perform cleanup ?
A. jspDestroy() B. destroy()
C. _jspDestroy() D. jsp_Destroy()
ANS:A
17. Which of the following is syntax of Declaration Tag?
A. <@ Declaration @> B. <% Declaration %>
C. <& Declaration &> D. <%! Declaration %>
ANS:D
18. Which is an example of the syntax used to import a class to JSP?
A. <% page import="java.util.List" %>
B. <%@ page import="java.util.List" @%>
C. <% import="java.util.List" %>
D. <%@ page import="java.util.List" %>
ANS:D
19. Which directives specify an HTTP response that will be of type image/svg?
A. <%@ page type="image/svg" %>
B. <%@ page mimetype="image/svg" %>
C. <%@ page language="image/svg" %>
D. <%@ page contentType="image/svg" %>
ANS:D
21. Given a request with two parameters: one named "first" represents a user's first name and
another named "last" represents his last name. Which JSP scriplet code outputs these parameter
values?
A. <% out.println(request.getParameter("first")); out.println(request.getParameter("last")); %>
B. <% out.println(apps.getInitParameter("first")); out.println(apps.getInitParameter("last")); %>
C. <% println(request.getParameter("first")); println(request.getParameter("last")); %>
D. <% println(application.getInitParameter("first")); println(application.getInitParameter("last"));
%>
ANS:A
22. Which of the following is syntax of Expression Tag?
A. <% Expression %> B. <%= Expression %>
C. <& Expression &> D. <%! Expression %>
ANS:B
UNIT - 4
1) Which services are provided to EJB components by the EJB container?
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
Ans: d. All mentioned above
2) A message driven bean is like statefull session bean that encapsulates the business logic and
doesn't maintain state.
a. True
b. False
Ans : b false
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
ANS: c. Naming support
6) Which component does the Entity bean represent the persistent data stored in the database?
a. Server-side component
b. Client-side component
c. server and client side component
d. None of the above
ANS: a. Server-side component
7) EJB is like COM, Abbreviate the term COM?
a. Component Object Model
b. Component Oriented Model
c. Common Object Model
d. Common Oriented Model
a. Entity Bean
b. Session Bean
c. Both A & B
d. None of the above
ANS: a. Entity Bean
9) How many types of session beans are available in EJB?
a. 2
b. 3
c. 4
d. 5
ANS: b. 3
10) Which session bean does the conversational state between multiple method calls is not
maintained by the container?
a. True
b. False
ANS: b. False
12 - Which of the following is true about EJB?
A - EJB is an essential part of a J2EE platform.
B - EJB provides an architecture to develop and deploy component based enterprise
applications considering robustness, high scalability and high performance.
C - EJB stands for Enterprise Java Bean.
D - All of the above.
ANS: D - All of the above.
13 - When a remote session bean is used in EJB?
A - If ejb client is in same environment where ejb session bean is to be deployed then we use
remote session bean.
B - If ejb client is in different environment where ejb session bean is to be deployed then we use
remote session bean.
C - By default we use remote session bean.
D - None of the above.
ANS: B - If ejb client is in different environment where ejb session bean is to be deployed then
we use remote session bean.
14. Which of the following is true about session bean?
A. . This type of bean stores data of a particular user for a single session
B. . This is a type of enterprise bean which is invoked by EJB container when it receives a
message from queue or topic
C. . This type of bean represents persistent data storage
D. . None of the above
ANS: . This type of bean stores data of a particular user for a single session
15. Which of the following is true?
A. Preserving of any state across method calls does not performed by Stateless session beans
B. Multiple users can access Stateful session beans at the same time
C. Both are correct
D. None
Ans :A
16. Stateful Session beans contains
A. Remote Interface
B. All options are correctcorrect
C. Home Interface
D. Bean class
ANS:B
17. Which of the following is correct about a transaction in EJB?
A. A transaction is a single unit of work items
B. A transaction follows the ACID properties
C. Both of the above
D. None of the above
ANS:C
18. The EJB specification architecture does NOT define
A. transactional components
B. client side security and encryption
C. distributed object components
D. server-side components
ANS:B
19. 19. What executes EJB components?
A. A web server
B. An application server
C. An EJB container
D. A database server
ANS C
20. Choose different kinds of enterprise beans in EJB from following
A. Session beans
B. Entity beans
C. Message-driven beans
D. All of the above
ANS :D
Unit 5
1. MVC is composed of three components:
ANS:C
2. In the model-view-controller (MVC) architecture, the model defines the
A. Data-access layer
B. Presentation layer
C. Business-logic layer
D. Interface layer
ANS:C
ANS:B
4. Once a JDBC driver has been registered, what method is used to make the database
connection?
7. Why use Request Dispatcher to forward a request to another resource, instead of using a
sendRedirect?
A. Redirects are no longer supported in the current servlet API
B. Redirects are not a cross-platform portable mechanism
C. The RequestDispatcher does not use the reflection API
D. The RequestDispatcher does not require a round trip to the client, and thus is more
efficient and allows the server to maintain request state
ANS:D
A. java compiler
B. Java API
C. Java interpreter
D. Both A and B
ANS : B
11. Which of the following will not cause a JDBC driver to be loaded and registered with the
DriverManager?
A. Class.forName (driverString,);
B. new DriverClass ();
C. Include driver name in jdbc.drivers system property
D. None of the above
The answer is: D
12. Which of the following can not be used as the scope when using a JavaBean with JSP?
A. application
B. session
C. request
D. response
E. page
The answer is: A
13. Choose the statement that best describes the relationship between JSP and servlets:
A. Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime
usage.
B. JSP and servlets are unrelated technologies.
C. Servlets and JSP are competing technologies for handling web requests. Servlets are
being superseded by JSP, which is preferred. The two technologies are not useful in
combination.
D. JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime
usage.
The answer is: D
14. What is a benefit of using JavaBeans to separate business logic from presentation markup
within the JSP environment?
A. It allows the JSP to access middleware.
B. It creates a cleaner role separation between the web-production team and the software
development team, so that the web-production team can focus on presentation markup, while
the software team can focus on building reusable software components for helping to generate
dynamic displays .
C. It provides a dynamic markup environment, such that JavaBeans are integrated seamlessly
with the template presentation content, in order to create the dynamic display for the client.
D. It provides the developer with full access to the Java 2 Platform Enterprise Edition (J2EE),
which is unavailable from outside the JavaBean environment.
The answer is: B
15. What is the difference between doing an include or a forward with a RequestDispatcher?
A. The forward method transfers control to the designated resource, while the include
method invokes the designated resource, substitutes its output dynamically in the display,
and returns control to the calling page.
B. The two methods provide the same functionality, but with different levels of persistence.
C. The forward method is deprecated as of JSP 1.1 and the include method should be used in
order to substitute portions of a dynamic display at runtime.
D. The include method transfers control to a dynamic resource, while the forward method
allows for dynamic substitution of another JSP pages output, returning control to the calling
resource.
The answer is: D
16. A Java program cannot directly communicate with an ODBC driver because .......
ANS:A
17. The JDBC-ODBC Bridge driver translates the JDBC API to the ODBC API and used with
.......
A) JDBC drivers
B) ODBC drivers
C) Both A and B
A) putConnection()
B) setConnection()
C) Connection()
D) getConnetion()
ANS:D