NPTEL Data Structure and Algorithms using Java Week 2 Assignment Answers 2024

admin
By admin

NPTEL Data Structure and Algorithms using Java Week 2 Assignment Answers 2024

1. Which of the following classes is part of the Java Collections Framework and implements the List interface?

a. HashSet
b. LinkedList
c. TreeMap
d. PriorityQueue

Answer :- Click Here

2. Which of the following is True in the case of Java Collection Framework(JCF)?

a. JCF provides mid-performance software encoding
b. Extending and/or adapting a collection is easy and not flexible with JCF
c. The JCF is consist of : Collections and Facilities
d. The JCF doesn’t allow different types of collections to work with a high degree of interoperability.

Answer :- 

3. Which of the following interfaces is not part of the Java Collections Framework?

a. Set
b. Queue
c. Map
d. Stream

Answer :- Click Here

4. Which of the following statements is true regarding legacy classes in the Java Collections Framework?

a. All legacy classes have been deprecated and should no longer be used.
b. Legacy classes are fully compatible with the Java Collections Framework and have not been deprecated.
c. Legacy classes are part of the Java Collections Framework and implement all collection interfaces.
d. Legacy classes are new additions to the Java Collections Framework introduced in Java 8.

Answer :- 

5. Which interface extends SortedSet to handle retrieval of elements based on closest-match?

a. Set
b. SortedSet
c. NavigableSet
d. Collection

Answer :- 

6. Which of the following statements is/are incorrect for Java Collection Framework (JCF)?

a. Vector is similar to. ArrayList, which represents a dynamic array
b. Stack is a subclass of Vector that implements a standard last-in,first-out stack.
c. Unlike HashMap, Hashtable doesn’t store Key/value pairs.
d. Class Properties are used to maintain a list of values in which both key and value are String.

Answer :- 

7. In the Java Collections Framework (JCF), the Properties class extends ________?

a. HashMap
b. Hashtable
c. TreeMap
d. HashSet

Answer :- Click Here

8. In the Java Collections Framework, TreeMap extends which class and implements which interface?

a. Extends HashMap; implements sortedMap
b. Extends AbstractMap; implements NavigableMap
c. Extends Hashtable; implements TreeSet
d. Extends LinkedHashMap; implements List

Answer :- 

9. In the Queue interface of the Java Collections Framework, what do the peek() and poll() methods respectively do?

a. Both methods retrieve and remove the head of the queue.
b. Both methods retrieve but do not remove the head of the queue.
c. peek() retrieves and removes the head of the queue, while poll() retrieves but does not remove the head of the queue.
d. peek() retrieves but does not remove the head of the queue, while poll() retrieves and removes the head of the queue.

Answer :- 

10. Which of these interface handle sequences?

a. Set
b. Array
c. List
d. Collection

Answer :- Click Here
Share This Article
Leave a comment