0% found this document useful (0 votes)
32 views14 pages

Ajp MCQ For Retest

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views14 pages

Ajp MCQ For Retest

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Sr No Question Option A Option B Option C

1 UDP stands for User Data Port User Datagram Protocol Used Data Provider
2 IPv6 uses . 4 groups of 8 bits each 4 group of 8 hexa‐decimal digits 8 groups of 4 digits each

3 Communication using TCP protocol is and . Connection less, Iterative Connection less, concurrent Connection oriented, Iterative

4 Name the class which is used to create a port where Server Socket ServerSocket
the server will listen.
Which of these is not a factory method of static InetAddress getLocalHost() static InetAddress getByName static InetAddress getAllName
5 InetAddress class? (String hostname) (String hostname)

6 Which from the below use “Middle tier”? 3 tier 4 tier n-tier
7 Which of these is a bundle of information passed MIME Cache Datagram
between machines?
returns the port number on which returns the port name on which returns the server number on
8 int getServerPort() method this request was received. the request was received. which this request was
received.
In this constructor ServerSocket(int port, int
9 max_queue) what is the default value for 100 50 75
max_queue?
10 The constructor of URL can throw an exception called MalformedUrlException UrlNotFoundException UrlException

11 Which IP address is multicast IP address? 192.168.2.32 235.55.45.2 12.22.1.2


12 How many ports of TCP/IP are reserved for specific 10 1024 2048
protocols?
13 How many bits are in a single IP address? 8 16 32
14 Which of these is a full form of DNS? Data Network Service Data Name Service Domain Network Service
15 Which of these class is used to encapsulate IP DatagramPacket URL InetAddress
address and DNS?
16 Network programming in any language definitely user names; port numbers IP addresses; link‐layer address IP addresses; port numbers
needs to deal with and .
17 The class used in Java network programming for InetAddress Socket address InetSocketAddress
socket address is the class.
18 Which method is used to establish a connection accept() open() getLocalHost()
between server and client?
19 Which of these package contains classes and
interfaces for networking?
java.io java.util
java.net
20 In the following URL, identify the protocol identifier? https php //mcqmate.com:80/course.php
https://mcqmate.com:8080/course.php
Local IP, Remote IP, Local MAC, Local IP, Local PORT, Remote Local MAC, Local PORT, Remote
21 Which 5 parameters uniquely identify a connection? Remote MAC and Protocol MAC, Remote PORT and MAC, Remote PORT and
Protocol Protocol
With stream sockets there is no Stream sockets are said to Datagram sockets are said to
need to establish any connection provide a connection‐less provide a connection‐oriented
22 Which of the following statement is TRUE? and data flows between the service and UDP protocol is service and TCP protocol is used
processes are as continuous used
streams.
23 Which of the following method call is valid to obtain getCodeBase().host() getCodeBase().getHost() getCodeBase().hostName()
the server's hostname by invoking an applet?
24 The server listens for a connection request from a Socket s = new Socket Socket s = serverSocket. Socket s = serverSocket.
client using which of the following statement? (ServerName, port); accept() getSocket()
25 The client requests a connection to a server using Socket s = new Socket Socket s = serverSocket. Socket s = serverSocket.
which of the following statement? (ServerName, port); accept(); getSocket();
To connect to a server running on the same machine
26 with the client, which of the following cannot be used "localhost" "127.0.0.1" InetAddress.getLocalHost()
for the hostname?
In the socket programming, for an IP address, which
27 can be used to find the host name and IP address of The ServerSocket class The Socket class The InetAddress class
a client/ server?
28 To create an InputStream on a socket, say s, which of InputStream in = new InputStream in = s. InputStream in = s.
the following statement is necessary? InputStream(s); getInputStream(); obtainInputStream();
Which of the following protocols is/are for splitting
29 and sending packets to an address across a network? TCP/IP FTP SMTP

30 Which of the following type of JDBC driver, is also JDBC‐ODBC Bridge plus ODBC Native‐API, partly Java driver JDBC‐Net, pure Java driver
called Type 1 JDBC driver? driver
31 Select the method used to create URL connection. URL Connection open Connection URL
32 Which of the following type of JDBC driver, is also JDBC‐ODBC Bridge plus ODBC Native‐API, partly Java driver JDBC‐Net, pure Java driver
called Type 2 JDBC driver? driver
Which of the following holds data retrieved from a
33 database after you execute an SQL query using ResultSet JDBC driver Connection
Statement objects?
Which of the following is not a valid type of ResultSet. TYPE_FORWARD_ONLY ResultSet. ResultSet.
34 ResultSet? TYPE_SCROLL_INSENSITIV E TYPE_SCROLL_SENSITIVE

35 Which of the following type of JDBC driver, uses JDBC‐ODBC Bridge plus ODBC Native‐API, partly Java driver JDBC‐Net, pure Java driver
database native protocol? driver
JDBC is a standard Java API for JDBC is a specification to tell
database‐independent how to connect to a database.
36 What is JDBC? JDBC is a java based protocol. connectivity between the Java
programming language and a
wide range of databases.
37 URL is an acronym for? Uniform Resource Locator Unified Resource Locator Uniform Restore Locator
URL stands for Uniform Resource Locator and
38 represents a resource on the World Wide Web, such TRUE FALSE
as a Web page or FTP directory.
39 Which class is used to create servers that listen for ServerSockets httpServer httpResponse
either local client or remote client programs?
Which constructor of DatagramSocket class is used DatagramSocket(int port,
40 to create a datagram socket and binds it with the DatagramSocket(int port) InetAddress address) DatagramSocket()
given Port Number?
41 Which methods are commonly used in ServerSocket public OutputStream public Socket accept() public synchronized void close()
class? getOutputStream()
42 Which classes are used for connection‐less socket DatagramSocket DatagramPacket Both A & B
programming?
Which method of URL class represents a URL and it
43 has complete set of methods to manipulate URL in java.net.URL java.net.URLConnection Both A & B
Java?
44 The class is used to create TCP server. Server SocketServer ServerSocket
45 Which package provides core functionality?
java.net java.rmi java.lang
The DatagramSocket and DatagramPacket classes
46 are not used for connection‐less socket TRUE FALSE
programming.
47 Which of the following manages a list of database DriverManager JDBC driver Connection
drivers in JDBC?
Which of the following type of JDBC driver should be
48 used if your Java application is accessing multiple Type 1 Type 2 Type 3
types of databases at the same time?
JDBC architecture decouples an JDBC follows a bridge design
49 Which of the following is correct about JDBC? abstraction from its pattern. Both of the above.
implementation.
50 Which of the following is true about JDBC? The JDBC API is an API to access You use it to access relational JDBC stands for Java DataBase
different relational databases. databases without embedding a Connectivity.
dependency on a specific
database type in your code.
51 The client in socket programming must know which IPaddress of Server Port number Both A & B
information?
The URLConnection class can be used to read and
52 write data to the specified resource referred by the TRUE FALSE
URL
53 Datagram is basically an information but there is no TRUE FALSE
guarantee of its content, arrival or arrival time.
54 Which of the following type of JDBC driver, is also JDBC‐ODBC Bridge plus ODBC Native‐API, partly Java driver JDBC‐Net, pure Java driver
called Type 1 JDBC driver? driver
55 What does the java.net.InetAddress class represent? Socket IP Address Protocol

56 The flush() method of PrintStream class flushes any TRUE FALSE


uncleared buffers in memory
Which method of ServerSocket will wait for a client to
57 initiate communication and then communicate with wait() connect() waitForClient()
the client?
58 A server socket can connect to clients. 1 2 10
59 Resolver in DNS system maps . Domain name to IP address IP address to domain name Domain name to MAC address
60 TCP does not support Multicasting and Broadcasting It supports full duplex It provides error control. It provides flow control
because . communication.
61 Which is the proper method to retrieve the host static InetAddress getLocalHost() static InetAddress getByName static InetAddress
name of local machine? throws UnknownHostException (String host_name ) throws getAllByName(String
UnknownHostException host_name ) throws
UnknownHostException
Which constructor of DatagramPacket class are used DatagramPacket(byte data[], int DatagramPacket(byte data[], DatagramPacket(byte data[],
for receiving purpose? size) DatagramPacket(byte data int size, InetAddress ip, int port) int size) DatagramPacket(byte
62 [], int size, int offset, int port) DatagramPacket(byte data[], data[], int size, InetAddress ip,
int offset, int size, InetAddress int port)
ip, int port)
Socket socket = new Socket Socket socket = new Socket Socket socket = new Socket
("example.com", 80); PrintWriter ("example.com", 80); ("example.com", 80);
Which of the following Java code snippets correctly out = new PrintWriter(socket. OutputStream out = socket. BufferedWriter writer = new
63 sends an HTTP GET request to a server at getOutputStream()); out.println getOutputStream(); PrintWriter BufferedWriter(new
"example.com" on port 80? ("GET / HTTP/1.1"); writer = new PrintWriter(out); OutputStreamWriter(socket.
writer.println("GET / HTTP/1. getOutputStream())); writer.
1"); write("GET / HTTP/1.1");
64 You want to create a Java program to establish a Socket clientSocket = new ServerSocket serverSocket = DatagramSocket
client-server connection. Which code snippet Socket("localhost", 8080); new ServerSocket(8080); datagramSocket = new
correctly creates a client socket and connects to a DatagramSocket(8080);
server running on "localhost" at port 8080?
You are developing a Java program to establish a ServerSocket serverSocket = Socket serverSocket = new Socket serverSocket = new
server-client connection. Which code snippet new ServerSocket(8888); Socket("localhost", 8888); Socket(8888);
65 correctly creates a server socket that listens on port
8888 and accepts incoming connections from clients?

66 What does the acronym "HTTP" stand for in the Hyperlink Transfer Protocol Hypertext Transfer Protocol Hyper Transfer Text Protocol
context of web communication?
67 In Java, which class is commonly used to establish a Socket ServerSocket DatagramSocket
server socket for network communication?
68 Which Java package provides classes for working
with sockets and networking?
java.net java.io java.lang

69 Which protocol is typically used for sending email in HTTP FTP SMTP
Java applications?
70 Which Java class is used to represent an IP address? IPAdress InetAddress IPHost

71 What is the purpose of the "URLConnection" class in To represent a URL connection To establish a secure SSL To handle HTTP requests and
Java? connection responses
72 In Java, which protocol is used for transferring files HTTP FTP TCP
over the network?
73 Which Java class is used to read and write binary BufferedReader BufferedWriter ObjectInputStream
data over a network stream?
74 What is the role of the "SocketTimeoutException" in It indicates a successful network It occurs when a socket is It signals a timeout when
Java networking? connection. closed gracefully. waiting for data on a socket.
75 Which Java class allows you to create and manage URLBuilder URLManager URLEncoder
URL objects?
76 What does HTTP stand for in the context of Hyper Transfer Text Protocol Hypertext Transfer Protocol Hyperlink Text Transfer Protocol
networking?
77 Which Java class is used for creating network Socket ServerSocket DatagramSocket
sockets?
78 Which protocol is commonly used for sending email FTP SMTP HTTP
in Java applications?
79 In Java, which class is used to represent an IP IP IPAddress InetAddress
address?
80 Which Java library is commonly used for making
HTTP requests?
java.net javax.servlet java.http

81 What does DNS stand for? Dynamic Network System Domain Name System Data Network Service
82 Which port is commonly used for HTTP 21 80 443
communication?
83 Which Java class is used for handling UDP (User DatagramSocket UDPSocket DatagramConnection
Datagram Protocol) communication?
What is the primary purpose of a firewall in a To block all incoming and To protect the network from
84 network? To increase network speed outgoing traffic unauthorized access and
threats
85 Which Java method is used to establish a connection connect() open() accept()
to a remote server using TCP/IP?
86 Which protocol is used for secure communication SSL HTTP FTP
over the internet?
87 Which of the following is not a valid IP address 192.168.1.1 300.200.100.50 10.0.0.1
format?
88 Which Java class is used for creating a server socket? SocketServer ServerSocket TCPServer

89 In Java, which protocol is commonly used for sending FTP SMTP HTTP
and receiving email?
90 What is the purpose of the HttpURLConnection class To connect to a database To establish a secure To work with HTTP connections
in Java? connection
91 Which Java class is used for reading and writing data ServerSocket Socket DatagramSocket
to a network socket?
92 In Java networking, what is the purpose of the To get the IP address of a domain To retrieve the host's hostname To set the local host's IP
InetAddress.getByName() method? name address
93 What is the role of the java.net.URL class in To read and write files locally To manage database To represent a Uniform
networking? connections Resource Locator
94 Which Java package is commonly used for socket java.sql java.io java.util
programming?
In following statement rs is an object of
95 interface of JDBC API. System. RowSet Statement Connection
prinln(re.getString(3)).
96 Which is main component of JDBC API? DriverManager Driver Connection
97 How many steps are used to connect any Java 5 4 3
application with the database using JDBC?
98 ODBC minimum SQL grammar contains Stored procedure Date, Time, and Timestamp create or drop View
only
99 Which class/interface is used for an SQL statement Statement CallableStatement PreparedStatement
that is executed frequently?
100 What does the following code do: smt = con. A PreparedStatement object is A Statement object is created to A CallableStatement is created
createStatement()? created to send SQL commands send SQL commands to to send SQL commands to
to database database database

Which kind of driver converts JDBC calls into calls on JDBC ODBC bridge + ODBC Driver
101 the Client API for Oracle, Sybase, Informix, IBM DB2, Native API partly – Java Driver JDBC – Net pure Java Driver
or other DBMS
102 Which method executes an SQL statement that may executeUpdate() executeQuery() execute()
return multiple results?
103 Identify correct syntax of executeQuery() of public static ResultSet public ResultSet executeQuery public void executeQuery
Statement interface. executeQuery() (String q) (String q)
104 Native API converts into the used by DBMS. JDBC API, Network Protocol JDBC API, Native API calls JDBC API, use calls
105 Which of the following function is used to find the getMetadata() metadata() getColumnCount()
column count of the particular ResultSet.
106 In JDBC imports all Java classes that javax.sql java.mysql java.sql
are concerned with Database connectivity.
107 The package contains classes that help in connection.sql db.sql pkg.sql
connecting to a database, sending SQL statements to
the database, and processing the query request.

108 Which of the following is not a type of JDBC driver? 100% pure Java Driver JDBC – net pure Java Driver JDBC – Native API driver

109 Database programming using Java throws which of SQLException ClassNotFoundException None of these
the following exceptions?
In the below statement, which type of query can be
110 used with executeUpdate() method: statement. Insert, Update, Delete Insert, Select, Delete Only Select
executeUpdate(query here)
111 What is the purpose of next() method? to retain the next element in a to retain the next table to retain the next record in a
series series
112 Native-protocol pure Java Driver converts JDBC calls, network protocol ODBC class, network protocol ODBC class, user calls
into the directly.
113 Choose the correct syntax for getConnection() public static Connection public static Connection public static Connection
method. getConnection(String url, String getConnection(String name, getConnection(String url, String
password) throws SQLException String password) throws name, String password) throws
SQLException SQLException
114 SQL stands for . Structured Query Language Sequential Query Language Structured Question Language

115 is a table of data which represents a data from table. MetaData ResultSetMetaData ResultSet

116 Public class DriverManager extends Object String Connection


.
117 Which of the following method is supported by public boolean execute(String public ResultSet executeQuery public int executeUpdate
Statement interface? query) (String query) (String query)
118 The JDBC‐ODBC bridge supports how many 1 0 Does not support connection
concurrent open statements per connection?
119 Select the correct method to create CallableStatement prepareCall CallableStatement prepareCall CallableStatement prepareCall
CallableStatement. (String sql) (String sql, int resultset_type, (String sql, int resultset_type,
int resultset_concurrency) int resultset_concurrency, int
resultset_holdability)
120 Microsoft Access data in file format. .DAT .MDB .MSSQL
121 Which of the following method is used to send SQL Statement CallableStatement PreparedStatement
statements?
122 DELETE statement of an SQL is executed by execute() executeQuery() executeUpdate()
.
123 The interface to the database is handled by . ODBC JDBC JDBC & ODBC
124 DatabaseMetadata are retrieved through getDatabaseMetadata() getMetaData() getDBMetaData()
.
125 Which method is used to retrieve the ResultSet executeQuery() getResultSet() getResultSetResult()
created?
126 Which of the following is used generally for reading DabaseData DabaseData ResultSet
the content of the database?
127 The syntax to create a table named “Course”, should create new table course create table course table course create
begin with .
128 Which of the following contains both date and time? java.io.date java.sql.date java.util.date
129 Which of the following is advantage of using JDBC Slow performance Using more memory Using less memory
connection pool?
130 Which of the following is advantage of using Slow performance Encourages SQL injection Prevents SQL injection
PreparedStatement in Java?
131 Which one of the following contains date java.sql.TimeStamp java.sql.Time java.io.Time
information?
132 What does setAutoCommit(false) do? commits transaction after each explicitly commits transaction does not commit transaction
query automatically after each query
133 Which of the following is used to call stored Statement PreparedStatement CallableStatment
procedure?
134 Which of the following is used to limit the number of setMaxRows(int i) setMinRows(int I) getMaxrows(int i)
rows returned?
135 Which of the following is method of JDBC batch setBatch() deleteBatch() removeBatch()
process?
136 Which of the following is used to rollback a JDBC rollback() rollforward() deleteTransaction()
transaction?
137 Which of the following is not a JDBC connection TRANSACTION_NONE TRANSACTION_READ_COM TRANSACTION_REPEATABL
isolation levels? MITTED E_READ
138 Choose the correct syntax for getConnection( ) public static Connection public static Connection public static Connection
method. getConnection(String url, String getConnection(String name, getConnection(String url, String
password) throws SQLException String password) throws name, String password) throws
SQLException SQLException
139 The syntax to create a table named ìCourseî, should create new table course create table course table course create
begin with .
DriverManager, Driver, DriverManager, Driver, DriverManager, Statement, and
140 What are the major components of the JDBC? Connection, Statement, and Connection, and Statement ResultSet
ResultSet
141 Select the packages in which JDBC classes are jdbc and javax.jdbc rdb and javax.rdb jdbc and java.jdbc.sql
defined?
142 Thin driver is also known as? Type 3 Driver Type-2 Driver Type-4 Driver
What is the correct sequence to create a database
connection?
i. Import JDBC packages.
ii. Open a connection to the database.
iii. Load and register the JDBC driver.
143 i, ii, iii, v, iv, vii, viii, vi i, iii, ii, v, iv, vii, vi, viii ii, i, iii, iv, viii, vii, v, vi
iv. Execute the statement object and return a query
resultset.
v. Create a statement object to perform a query.
vi. Close the resultset and statement objects.
vii. Process the resultset. viii. Close the connection.
144 Which of the following method is used to perform executeResult() executeQuery() executeUpdate()
DML statements in JDBC?
145 How many transaction isolation levels provide the 3 4 7
JDBC through the Connection interface?
146 Which of the following method is static and getConnection() prepareCall() executeUpdate()
synchronized in JDBC API?
147 Which methods are required to load a database getConnection() registerDriver() forName()
driver in JDBC?
148 Parameterized queries can be executed by? ParameterizedStatement PreparedStatement CallableStatement and
Parameterized Statement
149 Which of the following is not a valid statement in statement PreparedStatement QueryStatement
JDBC?
150 What does setAutoCommit(false) do? It will not commit transactions It allows manual control of It rolls back transactions
automatically after each query. transaction commits. automatically
151 A good way to debug JDBC-related problems is to JDBC tracing Exception handling Both a and b
enable???..
152 Which statement is used to roll back a transaction in ROLLBACK COMMIT BEGIN TRANSACTION
JDBC?
153 What is the purpose of the java.sql.DriverManager To manage database To create a connection to the To represent a SQL statement
class in JDBC? transactions database
Which type of ResultSet allows changes made in the ResultSet. TYPE_FORWARD_ONLY ResultSet. ResultSet.
154 ResultSet to be reflected in the database? TYPE_SCROLL_INSENSITIV E TYPE_SCROLL_SENSITIVE

155 Which method is used to retrieve the SQL warning getWarning() fetchWarning( ) retrieveWarning()
associated with a JDBC Connection?
Which method is used to retrieve the auto-
156 generated keys after an INSERT operation, but only getGeneratedKeys() fetchGeneratedKeys() retrieveGeneratedKeys()
for specific columns?
In JDBC, which interface provides methods to work
157 with large binary data, such as images or files, stored java.sql.Clob java.sql.Blob java.sql.BinData
in a database?
158 In JDBC, what is the purpose of the To retrieve database metadata To represent a result set To execute SQL queries
ResultSetMetaData interface?
159 What does JDBC stand for? Java Database Control Java Database Connectivity Java Data Binding Connector
160 Which package in Java contains the JDBC classes? java.sql java.jdbc java.db

161 In JDBC, which interface is responsible for making a Driver Connection Statement
connection to the database?
162 Which of the following is used to execute SQL queries DriverManager Connection ResultSet
in JDBC?
163 What is the purpose of the ResultSet interface in To connect to the database To execute SQL queries To store query results
JDBC?
164 Which of the following is not a type of JDBC driver? Type 1 Type 2 Type 4
165 Which driver type is known as the “Thin driver” in Type 1 Type 2 Type 3
JDBC?
166 What is the purpose of the PreparedStatement To connect to the database To store query results To precompile SQL statements
interface in JDBC?
167 Which method is used to establish a connection to createConnection() openConnection() getConnection()
the database in JDBC?
168 Which of the following is not a valid SQL data type in VARCHAR INT DOUBLE
JDBC?
169 What is the purpose of the Statement interface in To connect to the database To execute SQL queries To precompile SQL statements
JDBC?
170 In JDBC, which exception is thrown when there is a SQLException SQLSyntaxException SQLQueryException
problem with the SQL syntax?
171 Which method is used to execute a query in JDBC executeQuery() executeUpdate() execute()
and retrieve the results in a ResultSet?
172 What is the purpose of the Connection interface in To execute SQL queries To store query results To manage the connection to
JDBC? the database
173 In JDBC, what is the role of the DriverManager class? To establish a connection to the To execute SQL queries To manage the result set
database
174 Which of the following is not a JDBC driver? MySQL Connector/J PostgreSQL JDBC Driver Microsoft SQL Server JDBC
Driver
175 Which of the following is used to create a JDBC DriverManager.getConnection() Connection.getConnection() Statement.getConnection()
connection to a database?
176 Which of the following is used to execute an SQL Statement.executeQuery() Connection.executeQuery() PreparedStatement.
query in JDBC? executeQuery()
177 Which of the following is used to close a JDBC Connection.close() Statement.close() PreparedStatement.close()
connection?
178 Which of the following is used to handle exceptions try-catch block throws clause finally block
in JDBC?
179 Which of the following is a benefit of using a It prevents SQL injection It improves performance Both A and B
PreparedStatement in JDBC?
A sequence of database A way to rollback database
180 Which of the following is a JDBC transaction? operations that are treated as a changes if an error occurs Both A and B
single unit
A point in a transaction where A way to commit a subset of the
181 Which of the following is a JDBC savepoint? you can rollback to if an error changes made in a transaction Both A and B
occurs
A way to execute multiple SQL A way to improve the
182 Which of the following is a JDBC batch update? statements at once performance of bulk database Both A and B
operations
The package contains classes that help in
183 connecting to a database, sending SQL statements to connection.sql b.sql pkg.sql
the database and processing the query request.
184 Which of the following is not a type of JDBC driver? 100% pure Java Driver JDBC–net pure Java Driver JDBC–Native API driver

185 In JDBC imports all Java classes that are javax.sql java.mysql java.sql
concerned with Database connectivity.
186 Database programming using Java throws which of SQLException ClassNotFoundException None of these
the following exceptions?
In the below statement, which type of query can be
187 used with executeUpdate() method? statement. Insert, Update, Delete Insert, Select, Delete Only Select
executeUpdate(query here)
188 What is the purpose of the next() method? to retain the next element in a to retain the next table. to retain the next record in a
series. series.
DriverManager, DriverManager, DriverManager,
189 What are the major components of the JDBC? DriverConnection, Statement and DriverConnection, and Resultset DriverConnection, Statement
Resultset
190 How many transaction isolation levels are provided in 3 4 7
JDBC through the connection interface?
191 Identify the isolation level that prevents dirty reads TRANSACTION_READ_UNCO TRANSACTION_READ_COM TRANSACTION_REPEATABL
in the JDBC connection class? MMITTED MITTED E_READ
192 In order to transfer data between a database and an Methods on the ResultSet class Methods on the Methods on the
application written in Java, the JDBC API provides for retrieving SQL SELECT results PreparedStatement class for CallableStatement class for
which of these methods? as Java types. sending Java types as SQL retrieving SQL OUT parameters
statement parameters. as Java types.
The JDBC API has always supported persistent
193 storage of objects defined in Java through the TRUE FALSE
methods getObject and setObject.
Which JDBC type represents a "single precision"
194 floating point number that supports seven digits of REAL DOUBLE FLOAT
mantissa?
195 What is a servlet in Java? A type of coffee A server-side Java program A type of Java class
196 Which package provides the classes for servlets? javax.servlet java.servlet javax.server
197 Which HTTP methods can a servlet handle? GET and POST GET, POST, PUT, and DELETE GET, POST, and UPDATE

198 In which method should you override to handle GET doGet() doPost() doRequest()
requests in a servlet?
199 Which of the following is not a servlet life cycle init() service() destroy()
method?
200 What is the purpose of the init() method in a servlet? To perform cleanup tasks To handle client requests To initialize the servlet

201 Which method is responsible for destroying a servlet? finalize() destroy() close()

202 What is the default scope of a servlet? Request Session Application


203 Which object represents a client's request to the HttpServletRequest HttpServletResponse ServletContext
servlet container?
204 Which method can be used to send a response to the getRequest() sendResponse() getResponse()
client in a servlet?
205 How can you obtain the value of a request parameter request.getAttribute() request.getParameter() request.getSession()
in a servlet?
206 What is the default URL mapping for a servlet in /servlet/* /servlets/* /app/*
web.xml?
207 What is the purpose of the web.xml file in a servlet To configure servlet mappings To define servlet classes To specify HTML templates
application?
208 Which HTTP status code indicates that a resource is 200 OK 302 Found 404 Not Found
not found?
209 Which interface must a servlet implement to handle HttpSessionListener HttpSessionAttributeListener ServletContextListener
session events?
210 How can you store session data in a servlet? HttpServletRequest object ServletContext object HttpSession object
211 What is the purpose of the ServletContext in a To store session data To manage the servlet life cycle To share data among servlets
servlet application?
212 How can you set an attribute in the ServletContext in setContextAttribute() setAttribute() addAttribute()
a servlet?
213 What is the purpose of the RequestDispatcher To send an HTTP request To include the content To forward the request
interface in servlets?
214 Which of the following is NOT a valid way to create a Extending HttpServlet class Implementing Servlet interface Using the new keyword
servlet in Java?
215 What is a servlet filter used for? To process requests before To filter out invalid HTTP To filter client IP addresses
servlet methods
216 Which of the following is true about servlet filters? Filters only with servlets Filters can modify response Filters can’t change order
217 What is the purpose of the doFilter() method in a Forward request to another Send response to client Process request and response
servlet filter? servlet
218 How can you invalidate a session in a servlet? session.invalidate() session.invalidateSession() session.destroy()
219 Which of the following is NOT a valid method of Using ServletContext Using HttpServletResponse Using RequestDispatcher
communication between servlets?
220 What is the purpose of the javax.servlet.annotation. Define a servlet class Configure servlet mappings Specify request parameters
WebServlet annotation?
221 Which HTTP method is used to retrieve data from the GET POST PUT
server in a safe way?
222 Which method is called when a session is created in sessionCreated() sessionInitialized() initSession()
a servlet?
223 How can you obtain the session ID in a servlet? session.getSessionID() session.getID() session.getId()
224 What is the purpose of the ServletContext. Retrieve a session attribute Retrieve a request attribute Retrieve a servlet attribute
getAttribute() method?
225 What is the purpose of the HttpServletRequest. Set a session attribute Set a request attribute Set a servlet context attribute
setAttribute() method?
226 Which of the following is NOT a valid HTTP status 200 OK 300 Redirect 400 Bad Request
code?
227 What is the purpose of the ServletContext. Retrieve servlet init parameter Retrieve session attribute Retrieve request attribute
getInitParameter() method?
228 What is the purpose of the HttpServletResponse. Set HTTP response status code Set content length Set content type of response
setContentType() method?
229 Which of the following is NOT a valid content type for text/html application/json image/png
an HTTP response?
230 What is the purpose of the ServletContext. Retrieve context path of servlet Retrieve context path of session Retrieve context path of
getContextPath() method? request
231 What does the term "servlet container" refer to? Physical container for servlets Software managing servlets Data structure for servlets

232 Which of the following is NOT a valid HTTP response Content-Type Location Session-ID
header?
233 What is the purpose of the ServletContextListener Listen for session attribute Listen for servlet context Listen for request parameters
interface in servlets? changes attributes changes
234 How can you include the content of another resource RequestDispatcher.include() HttpServletResponse.include() RequestDispatcher.forward()
in a servlet response?
235 How can you obtain the value of a servlet's ServletConfig initParameter() HttpServletRequest ServletContext getAttribute()
initialization parameter in a servlet? getParameter()
236 What type of servlet uses doGet(), doPost()? GenericServlet HttpServlet All of the above
237 Which Cookie is valid for a single session only and President Cookie Non-president cookie All of the above
removed when user closes browser?
238 Session is part of SessionTracking and maintains TRUE FALSE None
client state at server side?
239 When is destroy() method of a filter called? End of filter lifecycle After filter executed doFilter() Beginning of filter lifecycle
240 Web server is used for loading init() method of TRUE FALSE None
servlet?
241 Servlets handle multiple requests by using threads? TRUE FALSE None
242 Which method sends the same request and response forward sendRedirect() Both a and a
objects to another servlet?
243 What does the term "servlet container" refer to? A physical container used to ship A software component that A data structure for storing
servlets manages execution of servlets servlet instances
244 Which of the following is NOT a valid HTTP response Content-Type Location Session-ID
header in a servlet?
245 What is the purpose of the ServletContextListener To listen for changes in session To listen for changes in servlet To listen for changes in request
interface in servlets? attributes context attributes parameters
How can you include the content of another resource By using the By using the By using the
246 in a servlet response? RequestDispatcher.include() HttpServletResponse.include() RequestDispatcher.forward()
method method method
How can you obtain the value of a servlet's Using the initParameter() method Using the getParameter() Using the getAttribute() method
247 initialization parameter in a servlet? of the ServletConfig object method of the of the ServletContext object
HttpServletRequest object
248 Which type of servlet engine is a server that includes Add-onServletEngine EmbeddedServletEngine StandaloneServletEngine
built-in support for servlets?
249 What type of servlet uses the methods doGet(), GenericServlet HttpServlet All of the above
doPost(), doHead(), doDelete(), doTrace()?
250 Session is part of the SessionTracking and is for TRUE FALSE None
maintaining the client state at the server side.
The destroy() method is called The destroy() method is called The destroy() method is called
251 When is the destroy() method of a filter called? only once at the end of the life after the filter has executed the only once at the beginning of
cycle of a filter doFilter() method the life cycle of a filter
252 Web server is used for loading the init() method of a TRUE FALSE None
servlet.
253 Servlets handle multiple simultaneous requests by TRUE FALSE None
using threads.
Which method is used to send the same request and
254 response objects to another servlet in forward sendRedirect() Both a and a
RequestDispatcher()?
Option D
User Data Protocol
8 groups of 4 hexa‐decimal
digits each
Connection oriented,
concurrent
SocketServer

static InetAddress[]
getAllByName(String
hostname)
all of the above
Socket

returns the port number on


which this response/request
was received.

80

UrlSourceNotFoundExceptio n

None of these
512

64
Domain Name Service
ContentHandler

None of the choices are


correct
None of the choices are
correct
openConnection()

javax.swing

8080

Local IP, Local PORT, Remote


IP, Remote PORT and Protocol

With datagram sockets there


is no need to establish any
connection and data flows
between the processes are as
packets.
getCodeBase().
getHostName()
Socket s = new Socket
(ServerName);
Socket s = new Socket
(ServerName);

"127.0.0.0"

The Connection interface

InputStream in = s.
getStream();

UDP

Native‐protocol, pure Java


driver
URL Decoder
Native‐protocol, pure Java
driver

Statement

ResultSet.
TYPE_BACKWARD_ONLY

Native‐protocol, pure Java


driver
Joint Driver for Basic
Connection

Unified Restore Locator


None of the above

None of the above

None of the above

None of the above

None of the above

Socket
java.math

Statement

Type 4

None of the above.

All of the above.

None of the above

Native‐protocol, pure Java


driver
MAC Address

WaitForConnect()

multiple
MAC address to IP address
It is a connection oriented
protocol
String getHostAddress()

All of these

URL url = new URL("http:


//example.com");
HttpURLConnection conn =
(HttpURLConnection) url.
openConnection();

Socket clientSocket = new


Socket("localhost");

ServerSocket serverSocket
= new ServerSocket
("localhost", 8888);

High-Speed Text Protocol

InetAddress

java.util

POP3

HostAddress

To encode and decode URLs

UDP
DataInputStream

It represents an error in the


socket's IP address.
URLConnection

Hypertext Transmission
Protocol
InetAddress

Telnet

InetAddressUtils

java.httpclient

Digital Network Security


8080

UDPConnection

To reroute network traffic

bind()

Telnet

172.16.0.0

NetworkServer

POP3

To create a UDP socket

InputStreamReader

To create a new InetAddress


object
To encrypt data during
transmission

java.net
ResultSet

All of these
6

Insert, update, delete only

None of the above

A Statement object is created


to execute parameterized SQL
commands

Native Protocol Pure Java


Driver

noExecute()

public int executeQuery


(String q)
JDBC API, ODBC API calls
getCount()

com.sql

java.sql

JDBC – Native pure Java Driver

Both of these

Any Query

None of the above

JDBC calls, user calls


public static Connection
getConnection(String url,
String name) throws
SQLException
Sequential Question
Language
Statement

Statement

All of above

None of these

All of the above

.OBJ
Both B & C

executeDelete()

APIs
getDatabaseMeta()

getResult()

DatabaseResult

new table course

java.util.dateTime
Better performance

More memory usage

java.io.TimeStamp

never commits transaction

CalledStatement

getMinRows(int i)

addBatch()

RemoveTransaction()

TRANSACTION_NONREPE
ATABLE_READ
public static Connection
getConnection(String url,
String name) throws
SQLException
new table course

DriverManager, Connection,
Statement, and ResultSet

sql and javax.sql

Type-1 Driver

i, iii, ii, iv, v, vi, vii, viii

execute()

executeQuery()

Both b and c

All kinds of Statements

CallableStatement

It disables all transaction


commits
Only b

SET TRANSACTION

To execute stored procedures

ResultSet. TYPE_UPDATABLE

obtainWarning()

obtainGeneratedKeys()

java.sql.LargeData

To manage database
connections
Java Database Console
java.connection

ResultSet

PreparedStatement

To create a database table

Type 6
Type 4

To execute DDL commands

establishConnection()

BOOLEAN

To store query results

SyntaxError

executeBatch()

To compile SQL

To manage the connection


pool database
ODBC Driver

PreparedStatement.
getConnection()
ResultSet.executeQuery()

ResultSet.close()

All of the above

None of the above

None of the above

None of the above

None of the above

java.sql

JDBC–Native pure Java Driver

com.sql

Both of these

Any Query

None of the above

DriverManager, Connection,
Statement and Resultset

2
TRANSACTION_SERIALIZA BLE

All mentioned above

INTEGER

A type of Java exception


java.server
GET, POST, DELETE, and
MODIFY
handleGet()

run()

To redirect requests

cleanup()

Page
HttpSession

HttpServletResponse.
getWriter()
request.getAttribute()

/servlet-name/*

To store database connection

500 Internal Server Error

ServletRequestListener

HttpServletResponse object
To store servlet configuration

context.set()

To send a response

Extending GenericServlet
class
To filter invalid session data

Filters configured in web.xml


Destroy the filter

session.remove()
Using HTTP sessions

Declare a servlet filter

DELETE

createSession()

session.getSessionId()
Retrieve a response attribute

Set a response attribute

500 Internal Server Error

Retrieve servlet context


attribute
Send a redirect response

audio/mp3

Retrieve context of servlet


container
Security mechanism for
servlets
Set-Cookie

Listen for response headers


changes
HttpServletResponse.
forward()
HttpServletResponse
getParameter()
None of the above
None of the above

All

After filter executed


All

All
None of the above

A security mechanism for


servlets
Set-Cookie

To listen for changes in


response headers
By using the
HttpServletResponse.
forward() method
Using the getParameter()
method of the
HttpServletResponse object
None of the above

None of the above

All

The destroy() method is called


after the filter has executed

All

All

None of the above

You might also like