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 of HashSet class is used to add elements to its object?

Answer: Option A

Explanation:

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

Answer: Option D

Explanation:

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

Answer: Option A

Explanation:

4.  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.

5. Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes?

Answer: Option A

Explanation:
Dictionary, Map & Hashtable all implement Map interface hence all of them uses keys to store value in the object.

6. Which of these method can be used to increase the capacity of ArrayList object manually?

Answer: Option D

Explanation:
When we add an element, the capacity of ArrayList object increases automatically, but we can increase it manually to specified length x by using function ensureCapacity(x);

7.  Which of these standard collection classes implements a dynamic array?

Answer: Option C

Explanation:
ArrayList class implements a dynamic array by extending AbstractList class.

8.  Which of these standard collection classes implements a linked list data structure?

Answer: Option B

Explanation:

9. Which of these are legacy classes?

Answer: Option D

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

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

Answer: Option D

Explanation:

11. Which of these methods can be used to obtain a static array from an ArrayList object?

Answer: Option A

Explanation:

12. Which of these is a method of class Date which is used to search weather object contains a date before the specified date?

Answer: Option C

Explanation:
before() returns true if the invoking Date object contains a date that is earlier than one specified by date, otherwise it returns false.

13. Which of these is the interface of legacy?

Answer: Option B

Explanation:

14. Which of these classes provide implementation of map interface?

Answer: Option B

Explanation:
AbstractMap, WeakHashMap, HashMap and TreeMap provide implementation of map interface.

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

Answer: Option B

Explanation: