0% found this document useful (0 votes)
6 views3 pages

Data - Structures - MCQs Set 1

The document contains multiple-choice questions (MCQs) related to data structures, covering concepts such as LIFO principle, linear and non-linear data structures, binary search trees, priority queues, and sorting algorithms. Key answers include that stacks use LIFO, queues are linear, heaps are best for priority queues, and merge sort has the best average-case performance. Additionally, it explains the role of hash functions in mapping keys to values.

Uploaded by

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

Data - Structures - MCQs Set 1

The document contains multiple-choice questions (MCQs) related to data structures, covering concepts such as LIFO principle, linear and non-linear data structures, binary search trees, priority queues, and sorting algorithms. Key answers include that stacks use LIFO, queues are linear, heaps are best for priority queues, and merge sort has the best average-case performance. Additionally, it explains the role of hash functions in mapping keys to values.

Uploaded by

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

Data Structures - MCQs

1. Which data structure uses LIFO (Last In First Out) principle?

(a) Queue

(b) Stack

(c) Linked List

(d) Array

Answer: (b) Stack

2. Which of the following is a linear data structure?

(a) Graph

(b) Tree

(c) Queue

(d) Hash Table

Answer: (c) Queue

3. In a binary search tree (BST), the left child of a node contains:

(a) Only smaller keys

(b) Only greater keys

(c) Any keys

(d) Duplicate keys

Answer: (a) Only smaller keys

4. Which data structure is best for implementing a priority queue?

(a) Stack

(b) Queue

(c) Heap

(d) Tree

Answer: (c) Heap


5. Which traversal method is used for depth-first traversal of a tree?

(a) Level order

(b) Breadth-first

(c) Preorder

(d) None of the above

Answer: (c) Preorder

6. What is the time complexity of accessing an element in an array using its index?

(a) O(n)

(b) O(1)

(c) O(log n)

(d) O(n²)

Answer: (b) O(1)

7. Which of the following data structures is non-linear?

(a) Stack

(b) Array

(c) Linked List

(d) Tree

Answer: (d) Tree

8. In which data structure does insertion and deletion take place at both ends?

(a) Queue

(b) Stack

(c) Deque

(d) Tree

Answer: (c) Deque

9. Which of the following sorting algorithms has the best average-case performance?
(a) Bubble sort

(b) Insertion sort

(c) Merge sort

(d) Selection sort

Answer: (c) Merge sort

10. A hash function maps:

(a) Keys to values

(b) Values to keys

(c) Data to arrays

(d) Data to graphs

Answer: (a) Keys to values

You might also like