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 Map class is used to obtain an element in the map having specified key?

Answer: Option A

Explanation:

3. Which of these methods can be used to search an element in a list?

Answer: Option D

Explanation:
binaryserach() method uses binary search to find a specified value. This method must be applied to sorted arrays.

4. Which of these method of ArrayList class is used to obtain present size of an object?

Answer: Option A

Explanation:

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

Answer: Option A

Explanation:

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

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

Answer: Option B

Explanation:

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

Answer: Option A

Explanation:

9. Which of these methods is used to retrieve the elements in properties object at specific location?

Answer: Option D

Explanation:

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

Answer: Option A

Explanation:

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

Answer: Option D

Explanation:

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

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

14. Which of these class object can be used to form a dynamic array?

Answer: Option D

Explanation:
Vectors are dynamic arrays, it contains many legacy methods that are not part of collection framework, and hence these methods are not present in ArrayList. But both are used to form dynamic arrays.

15. Which of these class object has architecture similar to that of array?

Answer: Option A

Explanation:
Bitset class creates a special type of array that holds bit values. This array can increase in size as needed.