Data Structure And Algorithms Using Java Week 4 Assignment Answers 2023

admin
By admin

NPTEL Data Structure And Algorithms Using Java Week 4 Assignment Answers 2023

NPTEL Data Structure And Algorithms Using Java Assignment Answers 2023

NPTEL Data Structure And Algorithms Using Java Week 4 Assignment Answers 2023

Q1. In the worst case, the number of comparisons needed to search an item stored in a single linked list structure of length 100 is
а. 98
b. 101
c. 99
d. 100

Answer:- d

Q2. What does the following function do given a linked list with the first node as head?

image 31
Answer:- For Answer Click Here

Q3. Consider the given Java code snippet that implements a singly linked list:

image 32
Answer:- 

4. Which of the following operations is performed more efficiently by a doubly linked list than by linear linked list?
a. Deletion after a node
b. Insertion after a node
c. Searching
d. Traversal

Answer:- Answer:- For Answer Click Here

5. What is the time complexity of deletion from the end in a circular doubly linked list?
a. O(1)
b. O(n)
c. O(log n)
d. O(log log n)

Answer:- 

6. Which of the following statements) is(are) true about Java LinkedList?
a. Java LinkedList class cannot contain duplicate elements.
b. Java LinkedList class maintains insertion order.
C. Java LinkedList class is non synchronized.
d. Java LinkedList class cannot be used as a list, stack or queue.

Answer:- Answer:- For Answer Click Here

7. For which of the following applications, Linkedlist may not be the good choice?
a. Sparse matrix manipulation
b. Random Access Requirements
C. Polynomial manipulation
d. memory management

Answer:- 

8. Which of the following statements is true about arrays and linked lists in Java?
a. Arrays are always faster than linked lists.
b. Linked lists are always faster than arrays.
c. Arrays are better for random access, while linked lists are better for sequential access.
d. Arrays and linked lists have the same performance for both random and sequential access.

Answer:- Answer:- For Answer Click Here

9. Suppose you have a linked list of integers and you want to delete the first node in the list. Which of
the following statements is true?
a. The time complexity of the deletion operation is O(1).
b. The time complexity of the deletion operation is O(n).
c. The time complexity of the deletion operation depends on the size of the integer to be deleted.
d. The time complexity of the deletion operation depends on the location of the deletion point.

Answer:- 

10. Which of the following is not a valid declaration of a collection of type List?
a. LinkedList<String> a = new LinkedList<string>();
b. LinkedList<String> b = new LinkedList <>();
c. LinkedList<int> c = new LinkedList<string>();
c = new LinkedList<Integer> d = new LinkedList<>(1, 2, 3, 4, 5);

Answer:- Answer:- For Answer Click Here
Share This Article
Leave a comment