wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

TalentNext Test Day-13-Core Java Topics

Total questions: 10

Worksheet time: 4mins

Name
Class
Date
1.

Which of the following statements are correct about PreparedStatement? Select all that apply.

a)

PreparedStatement can accept different parameters at runtime in java JDBC.

b)

PreparedStatement is used for executing a precompiled SQL statement in java JDBC.

c)

PreparedStatement is used for executing a static SQL statement in java JDBC.

d)

All the above.

2.
Which one of the following classes is used to represent both date and time?
a)
java.sql.Date
b)
java.util.Date
c)
java.io.*
d)
java.lang.*
3.

Predict the output :

a)

Red

Invalid color

b)

Invalid color

c)

Compilation fails due to syntax errors

d)

Red

4.
Which one of the following methods can be used to create a Connection instance?
a)
getConnection(String url)
b)
getConnection(String url, String user, String password)
c)
getConnection(String url, Properties prop)
d)
All of the above
5.
Which of the following statements are true about arrays in Java? Select all that apply.
a)
Stores homogeneous data.
b)
Size cannot be changed during runtime.
c)
Can store only user defined objects.
d)
Array index starts at 1.
6.

Which of the following classes extends HashMap and maintains the insertion order of the elements?

a)

TreeMap

b)

LinkedHashMap

c)

SortedMap

d)

None of the above

7.
Which one of the following interfaces implementation accepts only unique elements?
a)
Set
b)
Array
c)
List
d)
Map
8.

Which one of the following classes implements Set interface and maintains the insertion order of elements?

a)

HashSet

b)

TreeSet

c)

LinkedHashSet

d)

None of the above

9.

Predict the output :

a)

ArrayIndexOutOfBoundsException

b)

null

c)

0

d)

1

10.

Which one of the following access modifiers is used while creating Junit test methods?

a)

private

b)

protected

c)

public

d)

None