adplus-dvertising

Welcome to the Data Structures and Algorithms MCQs Page

Dive deep into the fascinating world of Data Structures and Algorithms with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Data Structures and Algorithms, a crucial aspect of GATE CSE Exam. In this section, you will encounter a diverse range of MCQs that cover various aspects of Data Structures and Algorithms, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within GATE CSE Exam.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Data Structures and Algorithms. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of GATE CSE Exam.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Data Structures and Algorithms. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Data Structures and Algorithms MCQs | Page 2 of 30

Q11.
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is
Discuss
Answer: (d).n
Q12.
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality will be the slowest?
Discuss
Answer: (d).union, intersection
Q13.
Consider the function f defined below.

struct item
{
int data;
struct item * next;
};

int f(struct item *p)
{
return (
(p == NULL) ||
(p->next == NULL) ||
(( P->data <= p->next->data) && f(p->next))
);
}

For a given linked list p, the function f returns 1 if and only if
Discuss
Answer: (b).the elements in the list are sorted in non-decreasing order of data value
Q14.
What are the time complexities of finding 8th element from beginning and 8th element from end in a singly linked list? Let n be the number of nodes in linked list, you may assume that n > 8.
Discuss
Answer: (a).O(1) and O(n)
Discuss
Answer: (b).Yes, possible by storing XOR of addresses of previous and next nodes
Discuss
Answer: (a).Possible if X is not last node. Use following two steps (a) Copy the data of next of X to X. (b) Delete next of X
Q17.
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?
Discuss
Answer: (c).Delete the last element of the list
Q18.
Consider the following function to traverse a linked list.

void traverse(struct Node *head)
{
while (head->next != NULL)
{
printf("%d ", head->data);
head = head->next;
}
}

Which of the following is FALSE about above function?
Discuss
Answer: (c).The function is implemented incorrectly because it changes head
Q19.
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?
Discuss
Answer: (d).O(1)
Q20.
N items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on which the operation is to be performed. An algorithm performs the following operations on the list in this order: Θ(N) delete, O(log N) insert, O(log N) find, and Θ(N) decrease-key What is the time complexity of all these operations put together
Discuss
Answer: (c).O(N^2)
Page 2 of 30

Suggested Topics

Are you eager to expand your knowledge beyond Data Structures and Algorithms? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!