WorksheetsPJP Apr 23
Total questions: 10
Worksheet time: 5mins
Which one of the following packages contain the JDBC classes?
java.util
java.sql
java.lang
java.awt
What type of object is returned when we invoke the getMetaData method on the Connection object?
ConnectionMetaData
DatabaseMetaData
StatementMetaData
ResultSetMetaData
In which one of the following interfaces, the query is compiled only once?
PreparedStatement
Statement
How do we get the count of the total number of records updated by executing the below query? Lets store the count in a variable "num".
PreparedStatement stmt=con.prepareStatement("update emp set name=? where id=?");
stmt.setString(1,"Sonoo");
stmt.setInt(2,101);
int num = executeUpdate();
int num = stmt.execute();
int num = stmt.executeUpdate();
int num = stmt.executeQuery();
Assumption:
class Test1 is under com.test package
class Test2 is under com.test.pack1 package
And if you are importing as,
import com.test.*;
Which all classes and packages will be imported?
Test1, pack1 and Test2
Test1 and Test2
Test1 and pack1
Test1
Which of the following methods is valid for HashMap class> Select all the correct methods.
put
add
addAll
get
Which one of the following methods is valid for TreeSet class?
get
put
first
getAfter
Predict the output of the given code:
[1,7,5,4,20]
[1,4,5,7,20]
[20,7,5,4,1]
[1,5,4,7,20]
Which one of the following objects is used to store Key Value pair?
List
Set
TreeMap
SortedSet
What is the return type of add method in Collection interface?
int
double
char
boolean
