You are on page 1of 13

Question 1

Correct
Mark 1.00 out of 1.00

Flag question

Question text
Which of the following is false about a doubly linked list?

Question 1Select one:

a.
It requires more space than a singly linked list

b.
None of the mentioned

c.
The insertion and deletion of a node take a bit longer

d.
We can navigate in both the directions
Feedback
Your answer is correct.
The correct answer is: None of the mentioned

Question 2
Correct
Mark 1.00 out of 1.00

Flag question

Question text
The advantage of arrays over linked lists is that they allow random accessing.

Question 2Answer
True
False
Feedback
The correct answer is 'True'.

Question 3
Correct
Mark 1.00 out of 1.00

Flag question

Question text
What kind of list is best to answer question like “What is the item at position k?”

Question 3Select one:

a.
Circular linked list

b.
Doubly linked list

c.
Array implementation of list

d.
Singly linked list
Feedback
Your answer is correct.
The correct answer is: Array implementation of list

Question 4
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Linked lists are not suitable to for the implementation of?

Question 4Select one:

a.
Binary search

b.
Insertion sort

c.
Polynomial manipulation

d.
selection sort
Feedback
Your answer is correct.
The correct answer is: Binary search

Question 5
Correct
Mark 1.00 out of 1.00

Flag question

Question text
What would be the time complexity to find an element in the sorted linked list?

Question 5Select one:

a.
O( n)

b.
O(n2)

c.
O(log n)

d.
O(1)
Feedback
Your answer is correct.
The correct answer is: O( n)

Question 6
Correct
Mark 1.00 out of 1.00

Flag question

Question text
What is the time complexity to count the number of elements in the linked list?

Question 6Select one:

a.
None of the mentioned

b.
O( n)

c.
O(logn)

d.
O(1)
Feedback
Your answer is correct.
The correct answer is: O( n)

Question 7
Correct
Mark 1.00 out of 1.00

Flag question

Question text
State True or False:
In circular linked-list, it is always required to define both head and tail nodes.
Question 7Select one:

False

True
Feedback
The correct answer is: False

Question 8
Correct
Mark 1.00 out of 1.00

Flag question
Question text
You are given pointers to first and last nodes of a singly linked list, which of the following
operations are dependent on the length of the linked list?

Question 8Select one:

a.
Insert a new element as a first element

b.
Delete the first element

c.
Add a new element at the end of the list

d.
Delete the last element of the list
Feedback
Your answer is correct.
The correct answer is: Delete the last element of the list

Question 9
Correct
Mark 1.00 out of 1.00

Flag question

Question text
What would be the time complexity to add a node at the end of singly linked list, if the is
only a pointer is pointing to the head of the list (there is no pointer to the last element)?

Question 9Select one:

a.
O(1)

b.
O( n )

c.
O(n^2)
d.
O(log n)
Feedback
Your answer is correct.
The correct answers are: O( n ), O(n^2)

Question 10
Correct
Mark 1.00 out of 1.00

Flag question

Question text
State True or False:
In a singly-linked list, there is no efficient way to insert a node before the last node of
the list, but we can insert a node after a given node or at the beginning of the list with
time complexity O(1).
Question 10Select one:

True

False
Feedback
The correct answer is: True

Question 11
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Suppose we are considering a singly linked list and p is some node in the list which has
successor node.
Select the most correct java code snippet
that inserts new node with value x after the node p.

Question 11Select one:


Node q = new Node(x);
q.next = null;
p.next = q;

Node q = new Node(x);


p.next = q;
q.next = p.next;

Node q = new Node(x);


q.next = p.next;
p.next = q;

p.next = new Node(x);


p=p.next;
Feedback
The correct answer is: Node q = new Node(x);
q.next = p.next;
p.next = q;

Question 12
Correct
Mark 1.00 out of 1.00

Flag question

Question text
What is the time complexity of inserting at the end in dynamic arrays?

Question 12Select one:

a.
O(logn)

b.
O(1)

c.
Either O(1) or O( n)

d.
O( n)
Feedback
Your answer is correct.
The correct answer is: Either O(1) or O( n)

Question 13
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Select the statement that is most correct.
Basically, the complexity (worst-case) of search algorithm in singly linked lists is
Question 13Select one:

O(1)

O(n^2)

O(n)

O(log n)
Feedback
The correct answer is: O ( n )

Question 14
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Suppose we are considering a doubly linked list and p is some node in the list which has
successor node.
Select the most correct java code snippet
that inserts new node with value x after the node p.
Question 14Select one:

Node p1, p2;


p1 = new Node(x);
p.next = p1; p1.prev = p;
p2 = p.next;
p1.next = p2; p2.prev = p1;

Node p1, p2;


p1 = new Node(x);
p2 = p.next;
p.next = p1; p1.prev = p;
p1.next = p2;
p2.prev = p1;

Node p1, p2;


p1 = new Node(x);
p.next = p1; p1.prev = p;
p1.next = p2; p2.prev = p1;
p2 = p.next;
Feedback
The correct answer is: Node p1, p2;
p1 = new Node(x);
p2 = p.next;
p.next = p1; p1.prev = p;
p1.next = p2;
p2.prev = p1;

Question 15
Correct
Mark 1.00 out of 1.00

Flag question

Question text
State True or False:
In a singly-linked list every element contains some data and a link to the next element, which
allows to keep the structure.
Question 15Select one:

True

False
Feedback
The correct answer is: True

Question 16
Correct
Mark 1.00 out of 1.00

Flag question

Question text
What would be the time complexity to insert an element at the second position in the linked
list?

Question 16Select one:

a.
O(n2)

b.
O( n)

c.
O(1)

d.
None of the mentioned
Feedback
Your answer is correct.
The correct answer is: O(1)

Question 17
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Select the statement that is most correct.


Basically, the complexity of inserting new element before a given element in the middle of
a singly linked lists is

Question 17Select one:

O(1)
O(n)

O(n^2)

O(log n)
Feedback
The correct answer is: O ( n )

Question 18
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Suppose we are considering a singly linked list and p is some node in the list which has
predecessor node.
Select the most correct java code snippet
that inserts new node with value x before the node p.

Question 18Select one:

Node f = head;
while(f.next != p) f = f.next;
Node q = new Node(x);
q.next = null;
f.next = q;

Node f = head;
while(f.next != p) f = f.next;
Node q = new Node(x);
q.next = p;
f.next = q;

Node f = head;
while(f != p) f = f.next;
Node q = new Node(x);
q.next = p;
f.next = q;
Node f = head;
while(f.next != p) f = f.next;
Node q = new Node(x);
q.next = f;
f.next = q;
Feedback
The correct answer is: Node f = head;
while(f.next != p) f = f.next;
Node q = new Node(x);
q.next = p;
f.next = q;

Question 19
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Which of the following application makes use of a circular linked list?

Question 19Select one:

a.
Allocating CPU to running applications

b.
Undo operation in a text editor

c.
All of the mentioned

d.
Recursive function calls
Feedback
Your answer is correct.
The correct answer is: Allocating CPU to running applications

Question 20
Correct
Mark 1.00 out of 1.00
Flag question

Question text
Skip list helps avoiding sequential search.

Question 20Answer
True
False
Feedback
The correct answer is 'True'.

Question 21
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Linked lists allow easy insertion and deletion of information because such operations have a
local impact on the list.

Question 21Answer
True
False
Feedback
The correct answer is 'True'.

You might also like