0% found this document useful (0 votes)
35 views4 pages

DS MCQ

The document contains 13 multiple choice questions about data structures and algorithms related to linked lists. Specifically, it covers topics like circular linked lists, time complexities of operations on different types of linked lists like singly linked lists, doubly linked lists and circular doubly linked lists. It also includes questions about operations like concatenation, searching, deletion and rearrangement of elements in linked lists.

Uploaded by

barunduari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views4 pages

DS MCQ

The document contains 13 multiple choice questions about data structures and algorithms related to linked lists. Specifically, it covers topics like circular linked lists, time complexities of operations on different types of linked lists like singly linked lists, doubly linked lists and circular doubly linked lists. It also includes questions about operations like concatenation, searching, deletion and rearrangement of elements in linked lists.

Uploaded by

barunduari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

JECA

MCQ on DS

1. In a circular linked list organization, insertion of a record involves modification of

A. One pointer

B. Two pointers

C. Three pointers

D. No pointer

2. Linked lists are not suitable for data structures for which one of the following problems?

(A) Insertion sort

(B) Binary search

(C) Radix sort

(D) Polynomial manipulation

3. The concatenation of two lists is to be performed in O(1) time. Which of the following
implementations of a list should be used?

(A) singly linked list

(B) doubly linked list

(C) circular doubly linked list

(D) array implementation of list

4. In the worst case, the number of comparisons needed to search a singly linked list of length n for a
given element is

A. log2n

B. n/2

C. log2n – 1

D. n
5. Let P be a singly linked list. Let Q be the pointer to an intermediate node x in the list. What is the worst
case time complexity of the best-known algorithm to delete the node x from the list?

(A) O(n)

(B) O(log2 n)

(C) O(log n)

(D) O(1)

6. Suppose each set is represented as a linked list with elements in arbitrary order. Which of the
operations among union, intersection, membership, and cardinality will be the slowest?

(A) Union only

(B) intersection, membership

(C) membership, cardinality

(D) union, intersection

7. Circularly linked list is used to represent a Queue. A single variable p is used to access the Queue. To
which node should p point such that both the operations enQueue and deQueue can be performed in
constant time?

(A) Rear node

(B) Front node

(C) Not possible with a single pointer

(D) Node next to front

8. Which of the following permutations can be obtained in the output (in the same order) using a stack
that the input is the sequence 1,2,3,4,5 in that order?

(A) 3,4,5,1,2

(B) 3,4,5,2,1

(C) 1,5,2,3,4

(D) 5,4,3,1,2

9. In DLL the no. of pointers affected for an insertion will be

(A) 4 (B) 0 (C) 1 (D) depends on nodes of DLL.


10. The following C function takes a singly linked list of integers as a parameter and rearranges the
elements of the list. The list is represented as pointer to structure. The function is called with the list
containing integers 1, 2, 3, 4, 5, 6, 7 in the given order. What will be the contents of the list after the
function completes?

struct node {int value; struct node *next;};

void rearrange(struct node *list) {

struct node *p, *q;

int temp;

if(!list || !list → next) return;

p = list; q = list → next;

while(q) {

temp = p → value;

p → value = q → value;

q → value = temp;

p = q → next;

q = p? p → next : 0;

(A) 1, 2, 3, 4, 5, 6, 7

(B) 2, 1, 4, 3, 6, 5, 7

(C) 1, 3, 2, 5, 4, 7, 6

(D) 2, 3, 4, 5, 6, 7, 1

11. Given linked list L with head pointing to the first node of L, shown bellow:

10->20->30->40->50.

What is the output when the following sequence of operation applied on the given linked list?

i) p= head->next->next->next;
ii) head->next=p;
iii) print(“%d”,head->next->next->data);
(A) 40 (B) 50 (C) 30 (D) 20
12. Which of the following operation is performed more efficient by DLL than by SLL?

(A) Deleting a node whose location is given.

(B) Searching of an unsorted list for a given item.

(C) Inserting a node after the node with given location.

(D) Traversing a list.

13. Consider an implementation of unsorted SLL with head and tail pointer. Which of the following
operation can not be implemented in O(1) time.?

(A) Insertion at front

(B) Insertion at end

(C) Deletion from front

(D) deletion from end

You might also like