Ajp MCQ For Retest
Ajp MCQ For Retest
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
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
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
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()
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
80
UrlSourceNotFoundExceptio n
None of these
512
64
Domain Name Service
ContentHandler
javax.swing
8080
"127.0.0.0"
InputStream in = s.
getStream();
UDP
Statement
ResultSet.
TYPE_BACKWARD_ONLY
Socket
java.math
Statement
Type 4
WaitForConnect()
multiple
MAC address to IP address
It is a connection oriented
protocol
String getHostAddress()
All of these
ServerSocket serverSocket
= new ServerSocket
("localhost", 8888);
InetAddress
java.util
POP3
HostAddress
UDP
DataInputStream
Hypertext Transmission
Protocol
InetAddress
Telnet
InetAddressUtils
java.httpclient
UDPConnection
bind()
Telnet
172.16.0.0
NetworkServer
POP3
InputStreamReader
java.net
ResultSet
All of these
6
noExecute()
com.sql
java.sql
Both of these
Any Query
Statement
All of above
None of these
.OBJ
Both B & C
executeDelete()
APIs
getDatabaseMeta()
getResult()
DatabaseResult
java.util.dateTime
Better performance
java.io.TimeStamp
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
Type-1 Driver
execute()
executeQuery()
Both b and c
CallableStatement
SET TRANSACTION
ResultSet. TYPE_UPDATABLE
obtainWarning()
obtainGeneratedKeys()
java.sql.LargeData
To manage database
connections
Java Database Console
java.connection
ResultSet
PreparedStatement
Type 6
Type 4
establishConnection()
BOOLEAN
SyntaxError
executeBatch()
To compile SQL
PreparedStatement.
getConnection()
ResultSet.executeQuery()
ResultSet.close()
java.sql
com.sql
Both of these
Any Query
DriverManager, Connection,
Statement and Resultset
2
TRANSACTION_SERIALIZA BLE
INTEGER
run()
To redirect requests
cleanup()
Page
HttpSession
HttpServletResponse.
getWriter()
request.getAttribute()
/servlet-name/*
ServletRequestListener
HttpServletResponse object
To store servlet configuration
context.set()
To send a response
Extending GenericServlet
class
To filter invalid session data
session.remove()
Using HTTP sessions
DELETE
createSession()
session.getSessionId()
Retrieve a response attribute
audio/mp3
All
All
None of the above
All
All
All