Data Structures :: Linked Lists

NA
SHSTTON
97
Solv. Corr.
147
Solv. In. Corr.
244
Attempted
2 M:11 S
Avg. Time

1 / 22

Choose the correct option.

What Member function places a new node at the end of the linked list?


AaddNode

Bappend Node

CDisplayNode

DStructNode

ENone of these

 View Answer |  Discuss in Forum |  Workspace | Asked In BOA (Bank of America) |

Answer: Option A

Explanation:

The appendNode() member function places a new node at the end of the linked list. The appendNode() requires an integer representing the current data of the node.

Workspace

NA
SHSTTON
107
Solv. Corr.
119
Solv. In. Corr.
226
Attempted
0 M:0 S
Avg. Time

2 / 22

Choose the correct option.

How would you make the middle node of a doubly linked list to the top of the list?
Let assume "X" is the middle node


AX->next->prev = x->prev x->prev->next = x->next x->next = head head->prev=x

Bx->next = head head->prev=x

CX->next->prev=x->next x->prev->next = x->prev x->next = head head->prev=x

DNone of these

 View Answer |  Discuss in Forum |  Workspace | Asked In BOA (Bank of America) |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
102
Solv. Corr.
108
Solv. In. Corr.
210
Attempted
0 M:17 S
Avg. Time

3 / 22

Choose the correct option.

To create a linked list, we can allocate space and make something point to it, by

writing:

struct-narne *pointer-variable;

Which of the following statement will correctly allocate the space


Apointer-variable= malloc(sizeof(*struct-narne));

Bpointer-variable = malloc(sizeof(struct struct-name));

Cpointer-variable = a!loc(sizeof(struct struct-name));

Dpointer-variable = alloc(sizeof(*struct-name));

 View Answer |  Discuss in Forum |  Workspace | Asked In BOA (Bank of America) |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
33
Solv. Corr.
117
Solv. In. Corr.
150
Attempted
0 M:0 S
Avg. Time

4 / 22

Choose the correct option.

Assume single linked list pseudo code as follows?

struct Node {
data
next
}
record List {
Node firstNode
}

function1(List list) {
obsoleteNode = list.firstNode; list.firstNode = list.firstNode.next; free obsoleteNode;
}

function2(node node) {
obsoleteNode = node.next; node.next= node.next.next; free obsoleteNode;
}

function3(Node node,Node newNode) {
newNode.next = node.next;node.next= newNode
}

function4(List list, Node newNode) {
newNode.next = list.firstNode; list.firstNode = newNode;
}


Afunction1 removes the first node

Bfunction2 removes node past this one

Cfunction3 inserts newNode after node

Dfunction4 inserts newNode after current first node

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
84
Solv. Corr.
107
Solv. In. Corr.
191
Attempted
0 M:7 S
Avg. Time

5 / 22

Choose the correct option.

Which of the following can a Dynamic Link Library contain?


AOnly Code

BCode and Data Only

CCode and Resources only

DCode, Data and Resources

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
72
Solv. Corr.
139
Solv. In. Corr.
211
Attempted
0 M:9 S
Avg. Time

6 / 22

Choose the correct option.

Consider a linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer?


AO(1)

BO(log2 n)

CO(n)

DO(nlog2 n)

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
92
Solv. Corr.
99
Solv. In. Corr.
191
Attempted
0 M:21 S
Avg. Time

7 / 22

Choose the correct option.

In a circular linked list


Acomponents are all linked together in some sequential manner.

Bthere is no beginning and no end.

Ccomponents are arranged hierarchically.

Dforward and backward traversal within the list is permitted.

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
134
Solv. Corr.
53
Solv. In. Corr.
187
Attempted
0 M:3 S
Avg. Time

8 / 22

Choose the correct option.

In a linked list with n nodes, the time taken to insert an element after an element pointed by some pointer is


AO(1)

BO(log n)

CO(n)

DO(n1og n)

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
57
Solv. Corr.
127
Solv. In. Corr.
184
Attempted
0 M:37 S
Avg. Time

9 / 22

Choose the correct option.

Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?


ADeleting a node whose location in given

BSearching of an unsorted list for a given item

CInverting a node after the node with given location

DTraversing a list to process each node

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
72
Solv. Corr.
105
Solv. In. Corr.
177
Attempted
0 M:2 S
Avg. Time

10 / 22

Choose the correct option.

The time required to delete a node x from a doubly linked list having n nodes is


AO(n)

BO(log n)

CO(1)

DO(n log n)

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace