Unit Test 2 AJP Question Bank
Unit Test 2 AJP Question Bank
Q. 3 In JDBC imports all Java classes that are concern with Database connectivity.
(a) javax.sql
(b) java.mysql
(c) java.sql
(d) com.sql
Answer: c
Q. 15 How many steps are used to connect any java application with the database using JDBC ?
(a) 5
(b) 4
(c) 3
(d) 6
Answer: a
Q. 20 Which method executes an SQL statement that may return multiple results?
(a) executeUpdate( )
(b) executeQuery( )
(c) execute( )
(d) noExecute( )
Answer: b
Q. 21 Identify correct syntax of executeQuery( ) of Statement interface.
(a) public static ResultSet executeQuery( )
(b) public ResultSet executeQuery(String q)
(c) public void executeQuery(String q)
(d) public int executeQuery(String q)
Answer: b
Q. 22 Native API converts into the used by DBMS.
(a) JDBC API, Network Protocol
(b) JDBC API, Native API calls
(c) JDBC API, use calls
(d) JDBC API, ODBC API calls
Answer: b
Q. 23 Which of the following function is used to find the column count of the particular ResultSet.
(a) getMetadata( )
(b) metadata( )
(c) getColumnCount( )
(d) getCount( )
Answer: c
Q. 24 The JDBC‐ODBC bridge supports how many concurrent open statements per connection ?
(a) 1
(b) 0
(c) Does not support connection
(d) None of these
Answer: a
Q. 32 Which of the following is used generally for reading the content of the database?
(a) DabaseData
(b) DabaseData
(c) ResultSet
(d) DatabaseResult
Answer: c
Q. 34 Consider the following program.
What should be the correction done in the program to get correct output?
import java.sql.*; class Ddemo1
{
public static void main(String args[]) throws Exception
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c=DriverManager.getConnection("jdbc:odbc:ODSN"," "," "); Statement s=c.createStatement();
ResultSet rs=s.executeQuery("select *from StudTable");
System .out.println("Name" + " \t " + "Roll_No" + " \t " + "Avg"); while(rs.next())
{
System.out.println(rs.getString(1)+" \t "+rs.getInt(2)+" \t \t"+rs.getDouble(3)); s.close();
c.close();
}
}
A. Missing semicolon
B. Missing {
C. Missing }
D. Missing statement.
Q38. Name the http method used to send resources to the server.
(a) FTP method
(b) PUT method
(c) WRITE method
(d) COPY method
Answer: b
Q41. is a small piece of information that is passed back & forth in HTTP request & response.
(a) Servlet
(b) Applet
(c) Cookie
(d) Session
Answer: c
Q42. 12 Which life cycle method is used to process a client’s request?
(a) start( )
(b) init( )
(c) service( )
(d) destroy( )
Answer: c
Q43. 13 A user types the URL http://www.msbte.com/result.php. Which request gets generated?
(a) GET method
(b) POST method
(c) HEAD method
(d) PUT method
Answer: b
Q.44. Apache Tomcat is .
(a) Servlet
(b) Java Program
(c) API
(d) Web server capable of running Java programs
Answer: d