Log In Register

Units


Java.util Library - Questions and Answers

 

Practice these Java.util Library under Java Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Java.util Library for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Java.util Library of Java Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge Java Programming specifically Java.util Library.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Java.util Library under Java Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Java.util Library topic of Java Programming:

 

1. Which of these method is used to calculate number of bits required to hold the BitSet object?

Answer: Option B

Explanation:

2. Which of these method of HashSet class is used to add elements to its object?

Answer: Option A

Explanation:

3. Which of these methods is used to add elements in vector at specific location?

Answer: Option D

Explanation:
addElement() is used to add data in the vector, to obtain the data we use elementAt() and to first and last element we use firstElement() and lastElement() respectively.

4.  Which of these method is used to remove all keys/values pair from the invoking map?

Answer: Option B

Explanation:

5. Which of these methods is used to retrieve elements in BitSet object at specific location?

Answer: Option A

Explanation:

6. Which of these method is used to reduce the capacity of an ArrayList object?

Answer: Option D

Explanation:
trimTosize() is used to reduce the size of the array that underlines an ArrayList object.

7.  Which of these class can generate an array which can increase and decrease in size automatically?

Answer: Option A

Explanation:

8.  Which of these methods can be used to obtain set of all keys in a map?

Answer: Option D

Explanation:
keySet() methods is used to get a set containing all the keys used in a map. This method provides set view of the keys in the invoking map.

9. Which of these are legacy classes?

Answer: Option D

Explanation:
Stack, Hashtable, Vector, Properties and Dictionary are legacy classes.

10. Which of these method is used to make a bit zero specified by the index?

Answer: Option D

Explanation:

11. Which of these is the interface of legacy?

Answer: Option B

Explanation:

12. Which of these method Map class is used to obtain an element in the map having specified key?

Answer: Option A

Explanation:

13. Which of these is a class which uses String as a key to store the value in object?

Answer: Option D

Explanation:

14. Which of these classes implements Set interface?

Answer: Option B

Explanation:
 HashSet and TreeSet implements Set interface where as LinkedList and ArrayList implements List interface.

15. Which of these method is used to add an element to the start of a LinkedList object?

Answer: Option D

Explanation: