SET 3
Sr
Question Option A Option B Option C Option D Answer
No
Which object represents a client's HttpServletRequ HttpServletRes
ServletContext HttpSession A
request to the servlet container? est ponse
1
Which method can be used to send sendResponse( HttpServletRespo
getRequest() getResponse() D
2 a response to the client in a servlet? ) nse.getWriter()
Which of the following is NOT a
valid content type for an HTTP text/html application/json image/png audio/mp3 D
response?
Web server is used for loading the
TRUE FALSE None All A
init() method of a servlet.
How can you set an attribute in the setContextAttrib
setAttribute() addAttribute() context.set() B
ServletContext in a servlet? ute()
5
What is the purpose of the
To send an To include the To forward the To send a
RequestDispatcher interface in C
HTTP request content request response
servlets?
6
The URLConnection class can be
used to read and write data to the
TRUE FALSE a
specified resource referred by the
7 URL
Datagram is basically an
information but there is no
TRUE FALSE a
guarantee of its content, arrival or
arrival time.
8
What is the purpose of the To connect to To execute To precompile To store query
B
Statement interface in JDBC? the database SQL queries SQL statements results
9
does not commit
commits explicitly
What does setAutoCommit(false) transaction never commits
transaction after commits C
do? automatically transaction
each query transaction
10 after each query
Which of the following is used to PreparedState
Statement CallableStatment CalledStatement C
call stored procedure? ment
11
In Java, which class is commonly
used to establish a server socket for Socket ServerSocket DatagramSocket InetAddress B
network communication?
12
Which Java package provides
classes for working with sockets java.net java.io java.lang java.util A
13 and networking?
In Java, which protocol is used for
HTTP FTP TCP UDP B
transferring files over the network?
14
Which of the following is not a valid PreparedState CallableStatemen
statement QueryStatement C
statement in JDBC? ment t
15
It will not commit It allows
It rolls back It disables all
What does setAutoCommit(false) transactions manual control
transactions transaction A
do? automatically of transaction
automatically commits
16 after each query. commits.
The JDBC API has always
supported persistent storage of
TRUE FALSE A
objects defined in Java through the
methods getObject and setObject.
17
Which JDBC type represents a
"single precision" floating point
REAL DOUBLE FLOAT INTEGER A
number that supports seven digits
of mantissa?
18
In JDBC _____ imports all Java
classes that are concerned with javax.sql java.mysql java.sql com.sql C
Database connectivity.
19
In JDBC, which exception is thrown
SQLSyntaxExc SQLQueryExcept
when there is a problem with the SQLException SyntaxError A
eption ion
SQL syntax?
20