Вы находитесь на странице: 1из 7

1.

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

3. Inserting a node after a given node in a doubly linked list requires

a. One pointer changes
b. Two pointer changes
c. Four pointer changes
d. None
Ans)C

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

5. 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. 1and 3
d. All
Ans)B
6. The node can be deleted in double linked list
1) Without traversing the list,
2) By traversing the list from the head,
3) By traversing the list from the tail

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?

(a) Newnode = new DoublyLinkedListNode(x)

Newnode.element = x;
Newnode.next = Current.next;
Current.next = Newnode ;

(b) Newnode = new DoublyLInkedListNode(x) ;

Current = NewNode
Newnode.prev = Current
Newnode.next= Current.next
Newnode.rev.next = Newnode;
Newnode.next.prev = Newnode ;

(c) NewNode = new DoublyLinkedListNode(x) ;

Current = NewNode
Newnode.prev = Current;
Newnode.next = Current.next;
Newnode.next.prev = Newnode ;
Newnode.prev.next = Newnode ;

(d) Newnode = new DoublyLinkedListNode(x) ;

Newnode.prev = Current ;
Newnode.next = Current.next ;
Newnode.prev.next = Newnode ;
Newnode.next.prev = Newnode ;
Current = NewNode ;

(e) NewNode = new DoublyLinkedListNode(x) ;

Current = NewNode
Newnode.prev = Current;
Newnode.next = Current.next;
Newnode.next.prev = Newnode.next ;
Newnode.prev.next = Newnode.next ;

Ans : d

10. Consider the following doubly linked list :

A B

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.

(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?
(b) Current.next=tail
(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
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
(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

(i) Circular linked list

(ii) Doubly linked list
(iv) Iterator class
(v) Sorted linked list

Part B

(p) A class that maintains a current position and performs all

routines which depend on knowing the position in the list.
(q) A linked list that allows bidirectional traversal by storing two
references per node.
(r) A list used to maintain items in a linked list in some
arrangement.
(s) An extra node in the linked list that holds no data but serves to
satisfy the requirement that every node has a previous node.
(t) A linked list in which the last cell’s reference points to the first.
Choose the best definition from Part B for the above five terms in Part A.

(a) (i).. (t) (ii)..(q) (iii)..(r) (iv)..(p) (v)..(s)

(b) (i).. (p) (ii)..(t) (iii)..(s) (iv)..(p) (v)..(r)
(c) (i).. (t) (ii)..(q) (iii)..(s) (iv)..(p) (v)..(r)
(d) (i).. (q) (ii)..(t) (iii)..(s) (iv)..(p) (v)..(r)
(e) (i).. (t) (ii)..(s) (iii)..(p) (iv)..(p) (v)..(r)

Ans : c

Нижнее меню

Получите наши бесплатные приложения

Авторское право © 2021 Scribd Inc.