0% found this document useful (0 votes)
17 views8 pages

Verified Ajp

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

Verified Ajp

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

Sr No Question Option A Option B Option C Option D Answer

1 UDP stands for User Data Port User Datagram Protocol Used Data Provider User Data Protocol
B

8 groups of 4 hexadecimal
2 IPv6 uses ________. 4 groups of 8 bits each 4 group of 8 hexadecimal digits 8 groups of 4 digits each
digits each

Communication using TCP protocol is Connection oriented,


3 Connection less, Iterative Connection less, Concurrent Connection oriented, Iterative
and. Concurrent
D

Name the class used to create a port


4 Server Socket ServerSocket SocketServer
where the server will listen.

static InetAddress[]
Which of these is not a factory method static InetAddress static InetAddress static InetAddress getAllName(String
5 getAllByName(String
of InetAddress class? getLocalHost() getByName(String hostname) hostname)
hostname)
C

Which from the below use “Middle


6 3 tier 4 tier n-tier all of the above
tier”?
D
Which of these is a bundle of
7 information passed between MIME Cache Datagram Socket
machines?
C

returns the port number on


int getServerPort() method returns the port number on returns the port name on which the returns the server number on which this which this
8
____________. which this request was received request was received request was received response/request was
received
A

In this constructor ServerSocket(int


9 port, int max_queue) what is the 100 50 75 80
default value for max_queue?
B

The constructor of URL can throw an UrlSourceNotFoundExcepti


10 MalformedUrlException UrlNotFoundException UrlException
exception called ______. on
A

Which IP address is multicast IP


11 192.168.2.32 235.55.45.2 12.22.1.2 None of these
address?

How many ports of TCP/IP are


12 10 1024 2048 512
reserved for specific protocols?

How many bits are in a single IP


13 8 16 32 64
address?
C

14 Which of these is a full form of DNS? Data Network Service Data Name Service Domain Network Service Domain Name Service

Which of these class is used to


15 DatagramPacket URL InetAddress ContentHandler
encapsulate IP address and DNS?
C

Network programming in any


None of the choices are
16 language definitely needs to deal user names; port numbers IP addresses; link-layer address IP addresses; port numbers
correct
with____ and ____.

The class used in Java network


None of the choices are
17 programming for socket address is the InetAddress Socket address InetSocketAddress
correct
____ class.

C
Which method is used to establish a
18 accept() open() getLocalHost() openConnection()
connection between server and client?

Which of these package contains


19 java.io java.util java.net javax.swing
classes and interfaces for networking?

In the following URL, identify the


20 https php //mcqmate.com:80/course.php 8080
protocol identifier?
A

Local IP, Remote IP, Local Local IP, Local PORT,


Which 5 parameters uniquely identify Local IP, Local PORT, Remote Local MAC, Local PORT, Remote MAC,
21 MAC, Remote MAC and Remote IP, Remote PORT
a connection? MAC, Remote PORT and Protocol Remote PORT and Protocol
Protocol and Protocol

With stream sockets there is no With datagram sockets


need to establish any Stream sockets are said to provide Datagram sockets are said to provide a there is no need to
Which of the following statement is
22 connection and data flows a connection-less service and connection-oriented service and TCP establish any connection
TRUE?
between the processes are as UDP protocol is used protocol is used and data flows between the
continuous streams. processes are as packets.
D

Which of the following method call is


getCodeBase().getHostNa
23 valid to obtain the server's hostname getCodeBase().host() getCodeBase().getHost() getCodeBase().hostName()
me()
by invoking an applet?
B

The server listens for a connection


Socket s = new Socket s = new
24 request from a client using which of Socket s = serverSocket.accept() Socket s = serverSocket.getSocket()
Socket(ServerName, port); Socket(ServerName);
the following statement?
B

The client requests a connection to a


Socket s = new Socket s = new
25 server using which of the following Socket s = serverSocket.accept(); Socket s = serverSocket.getSocket();
Socket(ServerName, port); Socket(ServerName);
statement?
A

To connect to a server running on the


same machine with the client, which of
26 "localhost" "127.0.0.1" InetAddress.getLocalHost() "127.0.0.0"
the following cannot be used for the
hostname?

In the socket programming, for an IP


address, which can be used to find the
27 The ServerSocket class The Socket class The InetAddress class The Connection interface
host name and IP address of a
client/server?
C

To create an InputStream on a socket,


InputStream in = new InputStream in = InputStream in =
28 say s, which of the following statement InputStream in = s.obtainInputStream();
InputStream(s); s.getInputStream(); s.getStream();
is necessary?

Which of the following protocols is/are


29 for splitting and sending packets to an TCP/IP FTP SMTP UDP
address across a network?
A
Which of the following type of JDBC
JDBC-ODBC Bridge plus Native-protocol, pure Java
30 driver is also called Type 1 JDBC Native-API, partly Java driver JDBC-Net, pure Java driver
ODBC driver driver
driver? A
Select the method used to create URL
31 URL Connection open Connection URL URL Decoder URL
connection. B
Which of the following type of JDBC
JDBC-ODBC Bridge plus Native-protocol, pure Java
32 driver is also called Type 2 JDBC Native-API, partly Java driver JDBC-Net, pure Java driver
ODBC driver driver
driver? B
Which of the following holds data
retrieved from a database after you
33 ResultSet JDBC driver Connection Statement
execute an SQL query using
Statement objects? A
Which of the following is not a valid ResultSet.TYPE_FORWARD_O ResultSet.TYPE_SCROLL_INSEN ResultSet.TYPE_BACKWA
34 ResultSet.TYPE_SCROLL_SENSITIVE
type of ResultSet? NLY SITIVE RD_ONLY D
Which of the following type of JDBC JDBC-ODBC Bridge plus Native-protocol, pure Java
35 Native-API, partly Java driver JDBC-Net, pure Java driver
driver uses database native protocol? ODBC driver driver D
JDBC is a standard Java API for
database-independent JDBC is a specification to tell how to Joint Driver for Basic
36 What is JDBC? JDBC is a java-based protocol.
connectivity between Java and connect to a database. Connection
databases. B
37 URL is an acronym for? Uniform Resource Locator Unified Resource Locator Uniform Restore Locator Unified Restore Locator A
URL stands for Uniform Resource
38 Locator and represents a resource on TRUE FALSE
the World Wide Web. A
Which class is used to create servers
39 that listen for either local client or ServerSockets httpServer httpResponse None of the above
remote client programs? A
Which constructor of DatagramSocket
DatagramSocket(int port,
40 class is used to create a datagram DatagramSocket(int port) DatagramSocket() None of the above
InetAddress address)
socket and bind it with a port number? A
Which methods are commonly used in public OutputStream
41 public Socket accept() public synchronized void close() None of the above B
ServerSocket class? getOutputStream()
Which classes are used for
42 DatagramSocket DatagramPacket Both A & B None of the above C
connection-less socket programming?
Which method of URL class
represents a URL and it has a
43 java.net.URL java.net.URLConnection Both A & B None of the above A
complete set of methods to
manipulate URL in Java?
The_________class is used to create
44 Server SocketServer ServerSocket Socket C
TCP server.
Which package provides core
45 java.net java.rmi java.lang java.math C
functionality?
The DatagramSocket and
DatagramPacket classes are not used
46 TRUE FALSE B
for connection-less socket
programming.
Which of the following manages a list
47 DriverManager JDBC driver Connection Statement A
of database drivers in JDBC?
Which of the following type of JDBC
driver should be used if your Java
48 Type 1 Type 2 Type 3 Type 4 C
application is accessing multiple types
of databases at the same time?
JDBC architecture decouples
Which of the following is correct about JDBC follows a bridge design
49 abstraction from its Both of the above None of the above C
JDBC? pattern.
implementation.
You use it to access relational
The JDBC API is an API to
Which of the following is true about databases without embedding a JDBC stands for Java DataBase
50 access different relational All of the above D
JDBC? dependency on a specific Connectivity.
databases.
database type in your code.
The client in socket programming
51 IP address of Server Port number Both A & B None of the above C
must know which information?
The URLConnection class can be
used to read and write data to the
52 TRUE FALSE A
specified resource referred by the
URL.
Datagram is basically an information,
53 but there is no guarantee of its TRUE FALSE A
content, arrival, or arrival time.
Which of the following type of JDBC
JDBC-ODBC Bridge plus Native-protocol, pure Java
54 driver is also called Type 1 JDBC Native-API, partly Java driver JDBC-Net, pure Java driver A
ODBC driver driver
driver?
What does the java.net.InetAddress
55 Socket IP Address Protocol MAC Address B
class represent?
The flush() method of PrintStream
56 class flushes any uncleared buffers in TRUE FALSE A
memory.
Which method of ServerSocket will
wait for a client to initiate
57 wait() connect() waitForClient() accept() D
communication and then
communicate with the client?
A server socket can connect to
58 1 2 10 multiple D
________ clients.
Resolver in DNS system maps
59 Domain name to IP address IP address to domain name Domain name to MAC address MAC address to IP address A
__________.
TCP does not support Multicasting
It supports full duplex It is a connection-oriented
60 and Broadcasting because It provides error control. It provides flow control D
communication. protocol
______________.
static InetAddress static InetAddress
Which is the proper method to retrieve static InetAddress getAllByName(String
61 getLocalHost() throws getByName(String hostname) String getHostAddress() A
the host name of local machine? hostname) throws UnknownHostException
UnknownHostException throws UnknownHostException
Which constructor of DatagramPacket DatagramPacket(byte data[], int DatagramPacket(byte data[], int DatagramPacket(byte data[], int offset, int DatagramPacket(byte
62 A
class are used for receiving purpose? size) size, InetAddress ip, int port) size, InetAddress ip, int port) data[], int size)
Socket socket = new
Socket socket = new
Socket("example.com", 80); Socket socket = new URL url = new
Socket("example.com", 80);
Which of the following Java code OutputStream out = Socket("example.com", 80); BufferedWriter URL("http://example.com");
PrintWriter out = new
63 snippets correctly sends an HTTP socket.getOutputStream(); writer = new BufferedWriter(new HttpURLConnection conn = D
PrintWriter(socket.getOutputStr
GET request to a server? PrintWriter writer = new OutputStreamWriter(socket.getOutputStrea (HttpURLConnection)
eam()); out.println("GET /
PrintWriter(out); writer.println("GET m())); writer.write("GET / HTTP/1.1"); url.openConnection();
HTTP/1.1");
/ HTTP/1.1");
You want to create a Java program to
establish a client-server connection.
Which code snippet correctly creates Socket clientSocket = new ServerSocket serverSocket = new DatagramSocket datagramSocket = new Socket clientSocket = new
64 A
a client socket and connects to a Socket("localhost", 8080); ServerSocket(8080); DatagramSocket(8080); Socket("localhost");
server running on "localhost" at port
8080?
You are developing a Java program to
ServerSocket serverSocket
establish a server-client connection.
ServerSocket serverSocket = Socket serverSocket = new = new
65 Which code snippet correctly creates Socket serverSocket = new Socket(8888); A
new ServerSocket(8888); Socket("localhost", 8888); ServerSocket("localhost",
a server socket that listens on port
8888);
8888?
What does the acronym "HTTP" stand
66 for in the context of web Hyperlink Transfer Protocol Hypertext Transfer Protocol Hyper Transfer Text Protocol High-Speed Text Protocol B
communication?
In Java, which class is commonly
67 used to establish a server socket for Socket ServerSocket DatagramSocket InetAddress B
network communication?
Which Java package provides classes
68 for working with sockets and java.net java.io java.lang java.util A
networking?
Which protocol is typically used for
69 HTTP FTP SMTP POP3 C
sending email in Java applications?
Which Java class is used to represent
70 IPAddress InetAddress IPHost HostAddress B
an IP address?
What is the purpose of the To establish a secure SSL To encode and decode
71 To represent a URL connection To handle HTTP requests and responses A
URLConnection class in Java? connection URLs
In Java, which protocol is used for
72 HTTP FTP TCP UDP B
transferring files over the network?

Which Java class is used to read and


73 write binary data over a network BufferedReader BufferedWriter ObjectInputStream DataInputStream D
stream?

What is the role of the


It indicates a successful It occurs when a socket is closed It signals a timeout when waiting for data on It represents an error in the
74 SocketTimeoutException in Java C
network connection. gracefully. a socket. socket's IP address.
networking?
Which Java class allows you to create
75 URLBuilder URLManager URLEncoder URL D
and manage URL objects?
What does HTTP stand for in the Hypertext Transmission
76 Hyper Transfer Text Protocol Hypertext Transfer Protocol Hyperlink Text Transfer Protocol B
context of networking? Protocol
Which Java class is used for creating
77 Socket ServerSocket DatagramSocket InetAddress A
network sockets?
Which protocol is commonly used for
78 FTP SMTP HTTP Telnet B
sending email in Java applications?
In Java, which class is used to
79 IP IPAddress InetAddress InetAddressUtils C
represent an IP address?
Which Java library is commonly used
80 java.net javax.servlet java.http java.httpclient A
for making HTTP requests?
81 What does DNS stand for? Dynamic Network System Domain Name System Data Network Service Digital Network Security B
Which port is commonly used for
82 21 80 443 8080 B
HTTP communication?
Which Java class is used for handling
83 UDP (User Datagram Protocol) DatagramSocket UDPSocket DatagramConnection UDPConnection A
communication?
What is the primary purpose of a To block all incoming and outgoing To protect the network from unauthorized
84 To increase network speed To reroute network traffic C
firewall in a network? traffic access and threats
Which Java method is used to
85 establish a connection to a remote connect() open() accept() bind() A
server using TCP/IP?
Which protocol is used for secure
86 SSL HTTP FTP Telnet A
communication over the internet?
Which of the following is not a valid IP
87 192.168.1.1 300.200.100.50 10.0.0.1 172.16.0.0 B
address format?
Which Java class is used for creating
88 SocketServer ServerSocket TCPServer NetworkServer B
a server socket?
In Java, which protocol is commonly
89 FTP SMTP HTTP POP3 B
used for sending and receiving email?
What is the purpose of the
90 To connect to a database To establish a secure connection To work with HTTP connections To create a UDP socket C
HttpURLConnection class in Java?
Which Java class is used for reading
91 ServerSocket Socket DatagramSocket InputStreamReader B
and writing data to a network socket?
In Java networking, what is the
To get the IP address of a To create a new
92 purpose of the To retrieve the host's hostname To set the local host's IP address A
domain name InetAddress object
InetAddress.getByName() method?
What is the role of the java.net.URL To encrypt data during
93 To read and write files locally To manage database connections To represent a Uniform Resource Locator C
class in networking? transmission
Which Java package is commonly
94 java.sql java.io java.util java.net D
used for socket programming?
In the following statement, rs is an
object of ___________ interface of
95 RowSet Statement Connection ResultSet D
JDBC API:
System.out.println(rs.getString(3));
What is the main component of the
96 DriverManager Driver Connection All of these D
JDBC API?
How many steps are used to connect
97 any Java application with the 5 4 3 6 B
database using JDBC?
ODBC minimum SQL grammar
98 Stored procedure Date, Time, and Timestamp only Create or Drop View Insert, update, delete only D
contains____.
Which class/interface is used for an
99 SQL statement that is executed Statement CallableStatement PreparedStatement None of the above C
frequently?
A Statement object is
A PreparedStatement object is A Statement object is created to
What does the following code do: smt A CallableStatement is created to send created to execute
100 created to send SQL send SQL commands to the B
= con.createStatement();? SQL commands to the database parameterized SQL
commands to the database database
commands
Which kind of driver converts JDBC
calls into calls on the Client API for JDBC-ODBC Bridge + ODBC Native Protocol Pure Java
101 Native API partly – Java Driver JDBC-Net pure Java Driver B
Oracle, Sybase, Informix, IBM DB2, or Driver Driver
other DBMS?
Which method executes an SQL
102 statement that may return multiple executeUpdate() executeQuery() execute() noExecute() B
results?
Identify correct syntax of
public static ResultSet public ResultSet public int
103 executeQuery() of Statement public void executeQuery(String q) B
executeQuery() executeQuery(String q) executeQuery(String q)
interface.
Native API converts __ into the __
104 JDBC API, Network Protocol JDBC API, Native API calls JDBC API, use calls JDBC API, ODBC API calls B
used by DBMS.

Which function is used to find the


105 column count of the particular getMetadata() metadata() getColumnCount() getCount() C
ResultSet?

In JDBC ______________ imports all


106 Java classes that are concerned with javax.sql java.mysql java.sql com.sql C
Database connectivity.
The __________ package contains
classes that help in connecting to a
107 database, sending SQL statements to connection.sql db.sql pkg.sql java.sql D
the database, and processing the
query request.
Which of the following is not a type of JDBC–Native pure Java
108 100% pure Java Driver JDBC-net pure Java Driver JDBC–Native API driver D
JDBC driver? Driver
Database programming using Java
109 throws which of the following SQLException ClassNotFoundException None of these Both of these D
exceptions?
In the below statement, which type of
110 query can be used with Insert, Update, Delete Insert, Select, Delete Only Select Any Query A
executeUpdate() method?
To retain the next element in a
111 What is the purpose of next() method? To retain the next table To retain the next record in a series None of the above C
series
Native-protocol pure Java Driver
112 converts _______ into the _________ JDBC calls, network protocol ODBC class, network protocol ODBC class, user calls JDBC calls, user calls A
directly.
public static Connection public static Connection
public static Connection public static Connection
Choose the correct syntax for getConnection(String url, String getConnection(String url,
113 getConnection(String name, String getConnection(String url, String name, C
getConnection() method. password) throws String name) throws
password) throws SQLException String password) throws SQLException
SQLException SQLException
Sequential Question
114 SQL stands for __________. Structured Query Language Sequential Query Language Structured Question Language A
Language
_____________ is a table of data
115 MetaData ResultSetMetaData ResultSet Statement C
which represents a data from table.
Public class DriverManager extends
116 Object String Connection Statement A
______________.
Which of the following method is public boolean execute(String public ResultSet
117 public int executeUpdate(String query) All of above D
supported by Statement interface? query) executeQuery(String query)
The JDBC‐ODBC bridge supports
118 how many concurrent open 1 0 Does not support connection None of these A
statements per connection?
CallableStatement
CallableStatement prepareCall(String sql,
Select the correct method to create CallableStatement prepareCall(String sql, int
119 int resultset_type, int resultset_concurrency, All of the above D
CallableStatement. prepareCall(String sql) resultset_type, int
int resultset_holdability)
resultset_concurrency)
Microsoft Access data in _______ file
120 .DAT .MDB .MSSQL .OBJ B
format.
Which of the following method is used
121 Statement CallableStatement PreparedStatement Both B & C D
to send SQL statements?
DELETE statement of an SQL is
122 execute() executeQuery() executeUpdate() executeDelete() C
executed by ________.

The interface to the database is


123 ODBC JDBC JDBC & ODBC APIs B
handled by _____.

DatabaseMetadata are retrieved


124 getDatabaseMetadata() getMetaData() getDBMetaData() getDatabaseMeta() B
through _____________.
Which method is used to retrieve the
125 executeQuery() getResultSet() getResultSetResult() getResult() A
ResultSet created?
Which of the following is used
126 generally for reading the content of DatabaseData DabaseData ResultSet DatabaseResult C
the database?
The syntax to create a table named
127 “Course”, should begin with create new table course create table course table course create new table course B
__________.
Which of the following contains both
128 java.io.date java.sql.date java.util.date java.util.dateTime C
date and time?
Which of the following is an advantage
129 Slow performance Using more memory Using less memory Better performance D
of using JDBC connection pool?
Which of the following is an advantage
130 Slow performance Encourages SQL injection Prevents SQL injection More memory usage C
of using PreparedStatement in Java?
Which one of the following contains
131 java.sql.TimeStamp java.sql.Time java.io.Time java.io.TimeStamp A
date information?
Commits transaction after each Does not commit transaction automatically
132 What does setAutoCommit(false) do? Explicitly commits transaction Never commits transaction C
query after each query
Which of the following is used to call a
133 Statement PreparedStatement CallableStatement CalledStatement C
stored procedure?
Which of the following is used to limit
134 setMaxRows(int i) setMinRows(int i) getMaxRows(int i) getMinRows(int i) A
the number of rows returned?
Which of the following is a method of
135 setBatch() deleteBatch() removeBatch() addBatch() D
JDBC batch process?
Which of the following is used to
136 rollback() rollforward() deleteTransaction() removeTransaction() A
rollback a JDBC transaction?
Which of the following is not a JDBC TRANSACTION_READ_COMMIT TRANSACTION_NONREP
137 TRANSACTION_NONE TRANSACTION_REPEATABLE_READ D
connection isolation level? TED EATABLE_READ
public static Connection public static Connection
public static Connection public static Connection
Choose the correct syntax for getConnection(String url, String getConnection(String url,
138 getConnection(String name, String getConnection(String url, String name, C
getConnection() method. password) throws String name) throws
password) throws SQLException String password) throws SQLException
SQLException SQLException
The syntax to create a table named
139 “Course” should begin with create new table course create table course table course create new table course B
__________.
DriverManager, DriverManager,
What are the major components of the DriverManager, DriverConnection, DriverManager, DriverConnection,
140 DriverConnection, Statement, Connection, Statement,
JDBC? and ResultSet Statement
and ResultSet and ResultSet D
Select the packages in which JDBC
141 jdbc and javax.jdbc rdb and javax.rdb jdbc and java.jdbc.sql sql and javax.sql
classes are defined? D
142 Thin driver is also known as? Type 3 Driver Type 2 Driver Type 4 Driver Type 1 Driver C
What is the correct sequence to
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 i, iii, ii, iv, v, vi, vii, viii
create a database connection? B
Which of the following method is used
144 executeResult() executeQuery() executeUpdate() execute()
to perform DML statements in JDBC? C
How many transaction isolation levels
145 provide the JDBC through the 3 4 7 2
Connection interface? B
Which of the following method is static
146 getConnection() prepareCall() executeUpdate() executeQuery()
and synchronized in JDBC API? A
Which methods are required to load a
147 getConnection() registerDriver() forName() Both B and C
database driver in JDBC? D
Parameterized queries can be CallableStatement and Parameterized
148 ParameterizedStatement PreparedStatement All kinds of Statements
executed by? Statement B
Which of the following is not a valid
149 Statement PreparedStatement QueryStatement CallableStatement
statement in JDBC? C
It will not commit transactions It allows manual control of It disables all transaction
150 What does setAutoCommit(false) do? It rolls back transactions automatically
automatically after each query. transaction commits. commits A
A good way to debug JDBC-related
151 JDBC tracing Exception handling Both a and b Only b
problems is to enable???.. C
Which statement is used to roll back a
152 ROLLBACK COMMIT BEGIN TRANSACTION SET TRANSACTION
transaction in JDBC? A
What is the purpose of the
To manage database To create a connection to the To execute stored
153 java.sql.DriverManager class in To represent a SQL statement
transactions database procedures
JDBC? B
Which type of ResultSet allows
ResultSet.TYPE_FORWARD_O ResultSet.TYPE_SCROLL_INSEN ResultSet.TYPE_UPDATA
154 changes made in the ResultSet to be ResultSet.TYPE_SCROLL_SENSITIVE
NLY SITIVE BLE
reflected in the database? D
Which method is used to retrieve the
155 SQL warning associated with a JDBC getWarning() fetchWarning() retrieveWarning() obtainWarning()
Connection? A
Which method is used to retrieve the
auto-generated keys after an INSERT
156 getGeneratedKeys() fetchGeneratedKeys() retrieveGeneratedKeys() obtainGeneratedKeys() A
operation, but only for specific
columns?
In JDBC, which interface provides
methods to work with large binary
157 java.sql.Clob java.sql.Blob java.sql.BinData java.sql.LargeData B
data, such as images or files, stored in
a database?
In JDBC, what is the purpose of the To manage database
158 To retrieve database metadata To represent a result set To execute SQL queries A
ResultSetMetaData interface? connections
159 What does JDBC stand for? Java Database Control Java Database Connectivity Java Data Binding Connector Java Database Console B
Which package in Java contains the
160 java.sql java.jdbc java.db java.connection A
JDBC classes?
In JDBC, which interface is
161 responsible for making a connection Driver Connection Statement ResultSet A
to the database?
Which of the following is used to
162 DriverManager Connection ResultSet PreparedStatement D
execute SQL queries in JDBC?
What is the purpose of the ResultSet
163 To connect to the database To execute SQL queries To store query results To create a database table C
interface in JDBC?
Which of the following is not a type of
164 Type 1 Type 2 Type 4 Type 6 D
JDBC driver?
Which driver type is known as the
165 Type 1 Type 2 Type 3 Type 4 D
“Thin driver” in JDBC?
What is the purpose of the
166 PreparedStatement interface in To connect to the database To store query results To precompile SQL statements To execute DDL commands C
JDBC?
Which method is used to establish a
167 createConnection() openConnection() getConnection() establishConnection() C
connection to the database in JDBC?
Which of the following is not a valid
168 VARCHAR INT DOUBLE BOOLEAN D
SQL data type in JDBC?
What is the purpose of the Statement
169 To connect to the database To execute SQL queries To precompile SQL statements To store query results B
interface in JDBC?
In JDBC, which exception is thrown
170 when there is a problem with the SQL SQLException SQLSyntaxException SQLQueryException SyntaxError A
syntax?
Which method is used to execute a
171 query in JDBC and retrieve the results executeQuery() executeUpdate() execute() executeBatch() A
in a ResultSet?
What is the purpose of the Connection
172 To execute SQL queries To store query results To manage the connection to the database To compile SQL C
interface in JDBC?
In JDBC, what is the role of the To establish a connection to the To manage the connection
173 To execute SQL queries To manage the result set A
DriverManager class? database pool database
Which of the following is not a JDBC
174 MySQL Connector/J PostgreSQL JDBC Driver Microsoft SQL Server JDBC Driver ODBC Driver D
driver?
Which of the following is used to
PreparedStatement.getCon
175 create a JDBC connection to a DriverManager.getConnection() Connection.getConnection() Statement.getConnection() A
nection()
database?
Which of the following is used to
176 Statement.executeQuery() Connection.executeQuery() PreparedStatement.executeQuery() ResultSet.executeQuery() A
execute an SQL query in JDBC?
Which of the following is used to close
177 Connection.close() Statement.close() PreparedStatement.close() ResultSet.close() A
a JDBC connection?
Which of the following is used to
178 try-catch block throws clause finally block All of the above D
handle exceptions in JDBC?
Which of the following is a benefit of
179 It prevents SQL injection It improves performance Both A and B None of the above C
using a PreparedStatement in JDBC?
A sequence of database
Which of the following is a JDBC A way to rollback database
180 operations that are treated as a Both A and B None of the above C
transaction? changes if an error occurs
single unit
A point in a transaction where
Which of the following is a JDBC A way to commit a subset of the
181 you can rollback to if an error Both A and B None of the above A
savepoint? changes made in a transaction
occurs
Which of the following is a JDBC A way to execute multiple SQL A way to improve the performance
182 Both A and B None of the above C
batch update? statements at once of bulk database operations
The _____ package contains classes
that help in connecting to a database,
183 sending SQL statements to the connection.sql b.sql pkg.sql java.sql D
database, and processing the query
request.
Which of the following is not a type of JDBC–Native pure Java
184 100% pure Java Driver JDBC–net pure Java Driver JDBC–Native API driver D
JDBC driver? Driver
In JDBC _____ imports all Java
185 classes that are concerned with javax.sql java.mysql java.sql com.sql C
Database connectivity.
Database programming using Java
186 throws which of the following SQLException ClassNotFoundException None of these Both of these D
exceptions?
In the below statement, which type of
187 query can be used with Insert, Update, Delete Insert, Select, Delete Only Select Any Query A
executeUpdate() method?
What is the purpose of the next() To retain the next element in a
188 To retain the next table To retain the next record in a series None of the above C
method? series
DriverManager, DriverManager,
What are the major components of the DriverManager, DriverConnection, DriverManager, DriverConnection,
189 DriverConnection, Statement Connection, Statement and D
JDBC? and Resultset Statement
and Resultset Resultset
How many transaction isolation levels
190 are provided in JDBC through the 3 4 7 2 B
connection interface?
Identify the isolation level that
TRANSACTION_READ_UNCO TRANSACTION_READ_COMMIT TRANSACTION_SERIALIZ
191 prevents dirty reads in the JDBC TRANSACTION_REPEATABLE_READ B
MMITTED TED ABLE
connection class?
In order to transfer data between a Methods on the
Methods on the ResultSet class Methods on the CallableStatement class for
database and an application written in PreparedStatement class for
192 for retrieving SQL SELECT retrieving SQL OUT parameters as Java All mentioned above D
Java, the JDBC API provides which of sending Java types as SQL
results as Java types. types.
these methods? statement parameters.
The JDBC API has always supported
persistent storage of objects defined
193 TRUE FALSE A
in Java through the methods
getObject and setObject.
Which JDBC type represents a "single
194 precision" floating point number that REAL DOUBLE FLOAT INTEGER A
supports seven digits of mantissa?
195 What is a servlet in Java? A type of coffee A server-side Java program A type of Java class A type of Java exception B
Which package provides the classes
196 javax.servlet java.servlet javax.server java.server A
for servlets?
Which HTTP methods can a servlet GET, POST, DELETE, and
197 GET and POST GET, POST, PUT, and DELETE GET, POST, and UPDATE B
handle? MODIFY
In which method should you override
198 doGet() doPost() doRequest() handleGet() A
to handle GET requests in a servlet?
Which of the following is not a servlet
199 init() service() destroy() run() D
life cycle method?
What is the purpose of the init()
200 To perform cleanup tasks To handle client requests To initialize the servlet To redirect requests C
method in a servlet?
Which method is responsible for
201 finalize() destroy() close() cleanup() B
destroying a servlet?
202 What is the default scope of a servlet? Request Session Application Page A
Which object represents a client's
203 HttpServletRequest HttpServletResponse ServletContext HttpSession A
request to the servlet container?
Which method can be used to send a HttpServletResponse.getW
204 getRequest() sendResponse() getResponse() D
response to the client in a servlet? riter()
How can you obtain the value of a
205 request.getAttribute() request.getParameter() request.getSession() request.getAttribute() B
request parameter in a servlet?
What is the default URL mapping for a
206 /servlet/* /servlets/* /app/* /servlet-name/* A
servlet in web.xml?
What is the purpose of the web.xml To store database
207 To configure servlet mappings To define servlet classes To specify HTML templates A
file in a servlet application? connection
Which HTTP status code indicates
208 200 OK 302 Found 404 Not Found 500 Internal Server Error C
that a resource is not found?
Which interface must a servlet
209 HttpSessionListener HttpSessionAttributeListener ServletContextListener ServletRequestListener A
implement to handle session events?
How can you store session data in a HttpServletResponse
210 HttpServletRequest object ServletContext object HttpSession object C
servlet? object
What is the purpose of the
To store servlet
211 ServletContext in a servlet To store session data To manage the servlet life cycle To share data among servlets C
configuration
application?
How can you set an attribute in the
212 setContextAttribute() setAttribute() addAttribute() context.set() B
ServletContext in a servlet?
What is the purpose of the
213 RequestDispatcher interface in To send an HTTP request To include the content To forward the request To send a response C
servlets?
Which of the following is NOT a valid Extending GenericServlet
214 Extending HttpServlet class Implementing Servlet interface Using the new keyword C
way to create a servlet in Java? class
To process requests before
215 What is a servlet filter used for? To filter out invalid HTTP methods To filter client IP addresses To filter invalid session data A
servlet
Which of the following is true about Filters configured in
216 Filters only with servlets Filters can modify response Filters can’t change order B
servlet filters? web.xml
What is the purpose of the doFilter() Forward request to another
217 Send response to client Process request and response Destroy the filter C
method in a servlet filter? servlet
How can you invalidate a session in a
218 session.invalidate() session.invalidateSession() session.destroy() session.remove() A
servlet?
Which of the following is NOT a valid
219 method of communication between Using ServletContext Using HttpServletResponse Using RequestDispatcher Using HTTP sessions B
servlets?
What is the purpose of the
220 javax.servlet.annotation.WebServlet Define a servlet class Configure servlet mappings Specify request parameters Declare a servlet filter B
annotation?
Which HTTP method is used to
221 retrieve data from the server in a safe GET POST PUT DELETE A
way?
Which method is called when a
222 sessionCreated() sessionInitialized() initSession() createSession() A
session is created in a servlet?
How can you obtain the session ID in
223 session.getSessionID() session.getID() session.getId() session.getSessionId() C
a servlet?
What is the purpose of the Retrieve a response
224 Retrieve a session attribute Retrieve a request attribute Retrieve a servlet attribute C
ServletContext.getAttribute() method? attribute
What is the purpose of the
225 HttpServletRequest.setAttribute() Set a session attribute Set a request attribute Set a servlet context attribute Set a response attribute B
method?
Which of the following is NOT a valid
226 200 OK 300 Redirect 400 Bad Request 500 Internal Server Error B
HTTP status code?
What is the purpose of the
Retrieve servlet context
227 ServletContext.getInitParameter() Retrieve servlet init parameter Retrieve session attribute Retrieve request attribute A
attribute
method?
What is the purpose of the
228 HttpServletResponse.setContentType( Set HTTP response status code Set content length Set content type of response Send a redirect response C
) method?
Which of the following is NOT a valid
229 text/html application/json image/png audio/mp3 D
content type for an HTTP response?
What is the purpose of the
Retrieve context of servlet
230 ServletContext.getContextPath() Retrieve context path of servlet Retrieve context path of session Retrieve context path of request A
container
method?
What does the term "servlet container" Security mechanism for
231 Physical container for servlets Software managing servlets Data structure for servlets B
refer to? servlets
Which of the following is NOT a valid
232 Content-Type Location Session-ID Set-Cookie C
HTTP response header?
What is the purpose of the
Listen for session attribute Listen for response
233 ServletContextListener interface in Listen for servlet context attributes Listen for request parameters changes B
changes headers changes
servlets?
How can you include the content of
HttpServletResponse.forwa
234 another resource in a servlet RequestDispatcher.include() HttpServletResponse.include() RequestDispatcher.forward() A
rd()
response?
How can you obtain the value of a
HttpServletRequest HttpServletResponse
235 servlet's initialization parameter in a ServletConfig initParameter() ServletContext getAttribute() A
getParameter() getParameter()
servlet?
What type of servlet uses doGet(),
236 GenericServlet HttpServlet All of the above None of the above B
doPost()?
Which Cookie is valid for a single
237 session only and removed when user President Cookie Non-president cookie All of the above None of the above B
closes browser?
Session is part of SessionTracking
238 and maintains client state at server TRUE FALSE None All A
side?
When is destroy() method of a filter
239 End of filter lifecycle After filter executed doFilter() Beginning of filter lifecycle After filter executed A
called?
Web server is used for loading init()
240 TRUE FALSE None All A
method of servlet?
Servlets handle multiple requests by
241 TRUE FALSE None All A
using threads?
Which method sends the same
242 request and response objects to forward sendRedirect() Both a and a None of the above A
another servlet?
What does the term "servlet container" A physical container used to A software component that A data structure for storing servlet A security mechanism for
243 B
refer to? ship servlets manages execution of servlets instances servlets
Which of the following is NOT a valid
244 Content-Type Location Session-ID Set-Cookie C
HTTP response header in a servlet?
What is the purpose of the
To listen for changes in session To listen for changes in servlet To listen for changes in
245 ServletContextListener interface in To listen for changes in request parameters B
attributes context attributes response headers
servlets?
How can you include the content of
HttpServletResponse.forwa
246 another resource in a servlet RequestDispatcher.include() HttpServletResponse.include() RequestDispatcher.forward() A
rd()
response?
Using the getParameter()
How can you obtain the value of a Using the initParameter()
Using the getParameter() method Using the getAttribute() method of the method of the
247 servlet's initialization parameter in a method of the ServletConfig A
of the HttpServletRequest object ServletContext object HttpServletResponse
servlet? object
object
Which type of servlet engine is a
248 server that includes built-in support for Add-onServletEngine EmbeddedServletEngine StandaloneServletEngine None of the above C
servlets?
What type of servlet uses the methods
249 doGet(), doPost(), doHead(), GenericServlet HttpServlet All of the above None of the above B
doDelete(), doTrace()?
Session is part of the SessionTracking
250 and is for maintaining the client state TRUE FALSE None All A
at the server side.
The destroy() method is called The destroy() method is called The destroy() method is
When is the destroy() method of a The destroy() method is called only once at
251 only once at the end of the life after the filter has executed the called after the filter has A
filter called? the beginning of the life cycle of a filter
cycle of a filter doFilter() method executed
Web server is used for loading the
252 TRUE FALSE None All A
init() method of a servlet.
Servlets handle multiple simultaneous
253 TRUE FALSE None All A
requests by using threads.
Which method is used to send the
same request and response objects to
254 forward sendRedirect() Both a and a None of the above A
another servlet in
RequestDispatcher()?

You might also like