Professional Documents
Culture Documents
Next pointer of last node in a double linked list contains the address of___________
a. Last node
b. Previous node
c. First Node
d. NULL
Ans)D
2. Having address of the node to be deleted in double linked list, the node can be
deleted
1) Without traversing the list
2) Only after traversing the list from the head
3) Only traversing the list from the tail
a. 1 and 2
b. 2 and 3
c. 1 and 3
d. All
Ans)B
4. Having address of the node to be deleted in double linked list, the node can be
deleted
a. Without traversing the list
b. Only after traversing the list from the head
c. Only traversing the list from the tail
d. None if these
Ans)A
a. 1 and 2
b. 2 and 3
c. 1 and 3
d. All
Ans: b
7. If a pointer to that node, alone is given, the node can be deleted in
a. Singly linked lists
b. Doubly Linked lists
c. Circular Linked lists
d. All
Ans : b
8. Which of the following statement(s) is/are related to doubly linked list?
(a) The number of nodes in a list may vary dynamically when elements are inserted and
removed
(b) Cannot traverse backward and forward directly.
(c) Each cell consists of two references and only one data element.
(d) It may either linear or circular.
(e) It may or may not have a header node
Ans : a, d, e
9. Consider the following doubly linked list. There are two references next, prev in both
directions.
Current
a b
x
Newnode
Which of the following correctly describes the steps in inserting element x immediately
after the element a in the above doubly linked list?
Ans : d
A B
Head Tail
If the list is circular, and empty, which of the following statement(s) is/are valid?
Note: each node has two references such as next and previous.
(a) Head.next=null
(b) Tail.previous=Head
(c) Head.next=Tail
(d) Tail=Head
(e) Tail.next=null
Ans : b,c
11. Consider the following doubly linked list and its data structure.
Class Listnode
{
Object element;
Listnode next;
Listnode prev;
}
What would be the correct statement(s), when the doubly linked list is empty?
(a) Head.next=tail
(b) Current.next=tail
(c) Current.prev=Head
(d) Tail.prev=Head
(e) Current=nill
Ans : a, d
12) Consider the following doubly linked list and its data structure.
Class Listnode
{
Object element;
Listnode next;
Listnode prev;
}
Which of the following correctly describe(s) the steps to delete element b from the above
doubly linked
list?
(a) Current.next.next.prev=Current.prev
Current.next = Current.next.next
(b) Current.next = Current.prev.next
Current.next.next.prev=Current.prev
(c)Current.next=Current.next.next
Current.next.next.prev=Current.next.prev
(d) Current.next=tail
Head.next=Current.next.prev
(e) Current = Current.next.next
Current.next.next.prev=Current.prev
Ans : c
13) Consider the following doubly linked list and its data structure.
Class Listnode
{
Object element;
Listnode next;
Listnode prev;
}
Which of the following correctly describe(s) the steps in inserting elements x
immediately after the
element a in the above doubly linked list?
(a)current.next=x
x..prev=current
x.next=b
b.prev=x
(b) current.next=x
x..prev=current.prev
x.next=b
b.prev=x
(c) a.next=x
x..prev=current
x.next=b
b.prev=x
(d) Newnode.next= Current.next
Newnode.prev=Current
Newnode.prev.next=Newnode
Newnode.next.prev=Newnode
(e) Newnode.next= Current.next
Newnode.prev=Current.next.prev
Current.next=Newnode
Current.next.prev=Newnode
Ans : d, e
14) A set of basic list terms is given in Part A and some definitions are given in Part B as
follows.
Part A
Part B
Ans : c