0% found this document useful (0 votes)
21 views9 pages

Unit Test 2 AJP Question Bank

Uploaded by

rms744746
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)
21 views9 pages

Unit Test 2 AJP Question Bank

Uploaded by

rms744746
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/ 9

1 The package contains classes that help in connecting to a database, sending SQL

statements to the database and process the query request.


(a) connection.sql
(b) db.sql
(c) pkg.sql
(d) java.sql
Answer: a

Q. 2 Which of the following is not a type of JDBC driver?


(a) 100% pure Java Driver
(b) JDBC – net pure Java Driver
(c) JDBC – Native API driver
(d) JDBC – Native pure Java Driver
Answer: d

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. 4 Database programming using Java throws which of the following exception?


(a) SQLException
(b) ClassNotFoundException
(c) None of these
(d) Both of these
Answer: d
Q. 5 In the below statement, which type of query can be used with executeUpdate( ) method.
statement.executeUpdate(query here)
(a) Insert, Update, Delete
(b) Insert, Select, Delete
(c) Only Select
(d) Any Query
Answer: a

Q. 6 What is purpose of next( ) method?


(a) to retain the next element in a series.
(b) to retain next table.
(c) to retain next record in a series.
d) None of the above
Answer: c

Q. 7 Native – protocol pure Java Driver converts into the directly.


(a) JDBC calls, network protocol
(b) ODBC class, network protocol
(c) ODBC class, user calls
(d) JDBC calls, user calls
Answer: d

Q. 8 Choose the correct syntax for getConnection( ) method.


(a) public static Connection getConnection(String url, String password) throws SQLException
(b) public static Connection getConnection(String name, String password) throws SQLException
(c) public static Connection getConnection(String url, String name, String password) throws SQLException
(d) public static Connection getConnection(String url, String name) throws SQLException
Answer: c

Q. 9 SQL stands for .


(a) Structured Query Language
(b) Sequential Query Language
(c) Structured Question Language
(d) Sequential Question Language
Answer: a

Q. 10 is a table of data which represents a data from table.


(a) MetaData
(b) ResultSetMetaData
(c) ResultSet
(d) Statement
Answer: c

Q. 11 Public class DriverManager extends


(a) Object
(b) String
(c) Connection
(d) Statement
Answer: a
Q. 12 Which of the following method is supported by Statement interface?
(a) public boolean execute(String query)
(b) public ResultSet executeQuery(String query)
(c) public int executeUpdate(String query)
(d) All of above
Answer: d

Q. 13 In following statement rs is an object of interface of JDBC API.


System.out.println(rs.getString(3));
(a) RowSet
(b) Statement
(c) Connection
(d) ResultSet
Answer: d

Q. 14 Which is main component of JDBC API?


(a) DriverManager
(b) Driver
(c) Connection
(d) All of these
Answer: d

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. 16 ODBC minimum SQL grammer contains


(a) Stored procedure
(b) Data, Time and TimeStamp only
(c) create or drop View
(d) Insert, update, delete only
Answer: d

Q. 17 Which class/interface is used for an SQL statement that is executed frequently?


(a) Statement
(b) CallableStatement
(c) PreparedStatement
(d) None of the above
Answer: c

Q. 18 What does the following code do : smt = con.createStatement( )


(a) A PreparedStatement object is created to send SQL commands to database.
(b) A Statement object is created to send SQL commands to database.
(c) A CallableStatement is created to send SQL commands to database.
(d) A Statement object is created to execute parameterized SQL commands.
Answer: b
Q. 19 Which kind of driver converts JDBC calls into calls on the Client API for Oracle, Sybase, Informix, BM
DB2, or other DBMS
(a) JDBC ODBC bridge + ODBC Driver
(b) Native API partly – Java Driver
(c) JDBC – Net pure Java Driver
(d) Native Protocol Pure Java Driver
Answer: b

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. 25 Life cycle of a servlet is managed by


(a) Servlet Context
(b) Servlet Container
(c) Supporting protocol
(d) All of the above
Answer: b
Q. 26 Microsoft Access data in file format.
(a) .DAT
(b) .MDB
(c) .MSSQL
(d) .OBJ
Answer: b

Q. 27 Which of the following method is used for send SQL statements?


(a) Statement
(b) CallableStatement
(c) PreparedStatement
(d) Both B & C
Answer: d
Q. 28 DELETE statement of an SQL is executed by .
(a) execute( )
(b) executeQuery( )
(c) executeUpdate( )
(d) executeDelete( )
Answer: c

Q. 29 The interface to the database is handle by .


(a) ODBC
(b) JDBC
(c) JDBC & ODBC
(d) APIs
Answer: b

Q. 30 DatabaseMetadata are retrieved through


(a) getDatabaseMetadata( )
(b) getMetaData( )
(c) getDBMetaData( )
(d) getDatabaseMeta( )
Answer: a

Q. 31 Which method is used to retrieve the ResultSet created?


(a) executeQuery( )
(b) getResultSet( )
(c) getResultSetResult( )
(d) getResult( )
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.

Q. 35. Consider the following program.


What should be the correction done in the program to get correct output?
import java.sql.*; class Ddemo1
{
{
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.

Q36. JSP embeds in .


(a) Servlet, HTML
(b) HTML, Java
(c) HTML, Servlet
(d) Java, HTML
Answer: d

Q. 37. Which of the following is the default HttpRequest method?


(a) doGet( )
(b) doPost( )
(c) doTrace( )
(d) doPut( )
Answer: a

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

Q39. The include( ) method in RequestDispatcher .


(a) sends a request to another resource like servlet, JSP or html.
(b) includes resources of file like servlet, JSP or html.
(c) appends the request and response objects to the current servlet.
(d) None of these Servlets
Answer: c

Q40. 10 State true or false for following statements.


(i) JavaBeans slow‐down software development process.
(ii) Java Servlets do not have built‐in multithreaded feature.
(a) false, false
(b) false, true
(c) true, false
(d) true, true
Answer: a

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

Q.45 A JSP page consists of which tags?


(a) HTML tags
(b) JSP tags
(c) Both A & B
(d) None of the above
Answer: c
Q46. UDP stands for
(a) User Data Port
(b) User Datagram Protocol
(c) Used Data Provider
(d) User Data Protocol
Answer: b
Q47. Name the class which is used to create a port where the server will listen.
(a) Server
(b) Socket
(c) ServerSocket
(d) SocketServer
Answer: b

Q48 Communication using TCP protocol is and .


(a) Connection less, Iterative
(b) Collection less, concurrent
(c) Connection oriented, Iterative
(d) Connection oriented, concurrent
Answer: d

Q49 Which of these is a not a factory method of InetAddress class?


(a) static InetAddress getLocalHost( )
(b) static InetAddress getByName(String hostname)
(c) static InetAddress getAllName(String hostname)
(d) static InetAddress[ ] getAllByName(String hostname)
Answer: c

Q50. Which from the below use “Middle tier”.


(a) 3 tier
(b) 4 tier
(c) n – tier
(d) all of the above
Answer: d

You might also like