Database connectivity with JDBC - online test

Database connectivity with JDBC - online test


1) JDBC is a Java API that is used to connect and execute query to the database?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




2) Which of these API represents that software programs can follow to communicate with each other?

A) Interfaces
B) Classes
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B




3) An API can be created for

A) applications
B) libraries
C) operating systems
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above




4) How many types of JDBC drivers available?

A) 3
B) 4
C) 2
D) 5
View Answer / Hide Answer

ANSWER: B) 4




5) In the following JDBC drivers which is known as partially java driver?

A) JDBC-ODBC bridge driver
B) Native-API driver
C) Network Protocol driver
D) Thin driver
View Answer / Hide Answer

ANSWER: B) Native-API driver




6) In the following JDBC drivers which are known as fully java driver?

A) Native-API driver
B) Network Protocol driver
C) Thin driver
D) Both B & C
View Answer / Hide Answer

ANSWER: D) Both B & C




7) Which driver uses ODBC driver to connect to the database?

A) JDBC-ODBC bridge driver
B) Native-API driver
C) Network Protocol driver
D) Thin driver
View Answer / Hide Answer

ANSWER: A) JDBC-ODBC bridge driver




8) Which driver converts JDBC calls directly into the vendor-specific database protocol?

A) Native-API driver
B) Network Protocol driver
C) Thin driver
D) Both B & C
View Answer / Hide Answer

ANSWER: C) Thin driver




9) Why java program cannot directly communicate with an ODBC driver?

A) ODBC written in C# language
B) ODBC written in C language
C) ODBC written in C++ language
D) None of the above
View Answer / Hide Answer

ANSWER: B) ODBC written in C language




10) How many steps are used to connect any java application with the database in java using JDBC?

A) 5
B) 4
C) 3
D) 6
View Answer / Hide Answer

ANSWER: A) 5




11) Which method of Class class is used to register the driver class, This method is used to dynamically load the driver class?

A) forName()
B) getConnection()
C) createStatement()
D) executeQuery()
View Answer / Hide Answer

ANSWER: A) forName()




12) The default username for the oracle database is system?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




13) Give the ways to set Temporary Path of JDK in Windows?

A) Open command prompt
B) copy the path of jdk/bin directory
C) write in command prompt: set path=copied_path
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above




14) Abbrevate the term DSN?

A) Digital Source Name
D) Data Source Name
C) Data Socket Name
D) Data String Name
View Answer / Hide Answer

ANSWER: D) Data Source Name




15) The default username for the mysql database is?

A) System
B) root
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) root




16) The following example to connect Java Application with access?
import java.sql.*;
class Test{
public static void main(String ar[]){
try{
String url="jdbc:odbc:mydsn";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c=DriverManager.getConnection(url);
Statement st=c.createStatement();
ResultSet rs=st.executeQuery("select * from login");

while(rs.next()){
System.out.println(rs.getString(1));
}

}catch(Exception ee){System.out.println(ee);}

}}

A) With DSN
B) With out DSN
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) With DSN




17) In DriverManager class which method is used to establish the connection with the specified url?

A) public static void registerDriver(Driver driver)
B) public static void deregisterDriver(Driver driver)
C) public static Connection getConnection(String url)
D) public static Connection getConnection(String url,String userName,String password)
View Answer / Hide Answer

ANSWER: C) public static Connection getConnection(String url)




18) In Connection interface which method Drops all changes made since the previous commit/rollback?

A) public void rollback()
B) public void commit()
C) public void close()
D) public Statement createStatement()
View Answer / Hide Answer

ANSWER: A) public void rollback()




19) Which interface provides methods to execute queries with the database?

A) Connection interface
B) Statement interface
C) ResultSet interface
D) None of the above
View Answer / Hide Answer

ANSWER: B) Statement interface




20) Which maintains a cursor pointing to a particular row of data,Initially, cursor points to before the first row?

A) Connection interface
B) Statement interface
C) ResultSet interface
D) None of the above
View Answer / Hide Answer

ANSWER: C) ResultSet interface




21) ResultSet object can be moved forward only and it is updatable?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




22) Which is used to execute parameterized query?

A) Statement interface
B) PreparedStatement interface
C) ResultSet interface
D) None of the above
View Answer / Hide Answer

ANSWER: B) PreparedStatement interface




23) The performance of the application will be faster if you use PreparedStatement interface because query is compiled only once?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




24) This is an example of prepared statement interface that ?
PreparedStatement stmt=con.prepareStatement("select * from emp");
ResultSet rs=stmt.executeQuery();
while(rs.next()){
System.out.println(rs.getInt(1)+" "+rs.getString(2));
}

A) deletes the record
B) retrieve the record
C) updates the record
D) inserts the record
View Answer / Hide Answer

ANSWER: B) retrieve the record




25) ResultSetMetaData interface is useful because it provides methods to get metadata from the ResultSet object?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




26) By using Which interface You can store images in the database in java by the help of ?

A) PreparedStatement interface
B) ResultSetMetaData interface
C) DatabaseMetData interface
D) None of the above
View Answer / Hide Answer

ANSWER: A) PreparedStatement interface




27) Abbreviate the full form of CLOB?

A) Character Large Object
B) Character Loop Object
C) Collection Large Object
D) Collection Loop Object
View Answer / Hide Answer

ANSWER: A) Character Large Object




28) Which is used to call the stored procedures and functions, CallableStatement interface?

A) CallableStatement Interface
B) PreparedStatement Interface
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) CallableStatement Interface




29) The performance of the application will be faster if you use PreparedStatement interface because query is compiled only once?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




30) The ACID properties does not describes the transaction management well ?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




31) JDBC stands for?

A) Java database connectivity
B) Java database concept
C) Java database communications
D) None of the above
View Answer / Hide Answer

ANSWER: A) Java database connectivity




32) ARRAY,CLOB,BLOB and REF type columns can be updated in?

A) JDBC 2.0
B) JDBC 1.0
C) JDBC 3.0
D) JDBC 4.0
View Answer / Hide Answer

ANSWER: C) JDBC 3.0




33) In Transaction Management of JDBC which means once a transaction has been committed, it will remain so, even in the event of errors, power loss etc.?

A) Atomicity
B) Isolation
C) Consistency
D) Durability
View Answer / Hide Answer

ANSWER: D) Durability




34) In Transaction Management in JDBC Transaction represents?

A) single unit of work
B) Multiple unit of work
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) single unit of work




35) which interfaces provide methods for batch processing in JDBC?

A) java.sql.Statement
B) java.sql.PreparedStatement
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B




36) JDBC RowSet is the wrapper of ResultSet,It holds tabular data like ResultSet but it is easy and flexible to use?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True



Post your comment

    Discussion

  • RE: Database connectivity with JDBC - online test -PALLAVI (03/05/15)
  • THANK YOU
  • RE: Database connectivity with JDBC - online test -T.vijayashanthi (02/20/15)
  • Hai