Data Structures and Algorithms MCQs

Data Structures and Algorithms MCQs

These Data Structures and Algorithms multiple-choice questions and their answers will help you strengthen your grip on the subject of Data Structures and Algorithms. You can prepare for an upcoming exam or job interview with these Data Structures and Algorithms MCQs.
So scroll down and start answering.

1: External sorting is a way of

A.   sorting data that is too large to fit into RAM

B.   sorting data without the usage of a recursive implementation

C.   sorting data outside a specific performance bound

2: What compares adjacent elements and exchanges them to put an array in order?

A.   Insertion sort

B.   Selection sort

C.   Quicksort

D.   Bubble sort

3: Which steps through an array sequentially until a match is found?

A.   Hashing

B.   Sequential Search

C.   Fibonacci Search

D.   Binary Search

4: Which represents data as a chain of nodes and provides dynamic growth of data?

A.   Stack

B.   Linked List

C.   Sequence

D.   Array

5: Which of the following data structures is efficient in tree construction?

A.   Queue

B.   Array

C.   Stack

D.   Linked List

6: Which is the most suitable data structure for hierarchical data models?

A.   Priority Queue

B.   Linked List

C.   Tree

D.   Array

7: The smalled element of an array's index is called its:

A.   Lower bound

B.   Upper bound

C.   Midpoint

D.   Range

8: What is the process a procedure goes through when one of the steps of the procedure involves invoking the procedure itself?

A.   Induction

B.   Recursion

C.   Sequencing

D.   Looping

9: Can a binary tree be implemented using an array?

A.   Yes

B.   No

10: What is the most suitable data structure for a situation where tasks must be scheduled for execution on a computer and the tasks include system tasks?

A.   Tree

B.   Array

C.   Linked List

D.   Priority Queue

11: Minimum number of queues needed to implement the priority queue?

A.   One.

B.   Two. One queue is used for actual storing of data and another for storing priorities.

C.   Three.

D.   Four.

12: Which starts with an empty list and adds elements one-by-one to create a sorted list?

A.   Insertion sort

B.   Selection sort

C.   Bubble sort

D.   Quicksort

A.   Sequential Search

B.   Hashing algorithm has been performed

C.   Sorted Array

D.   Unsorted Array

14: What is the difference between the stack and queue data structures?

A.   Stack requires recursive search technique; Queue does not.

B.   Stack uses selection sort; Queue uses bubble sort.

C.   Stack is LIFO; Queue is FIFO.

D.   Stack is FIFO; Queue is LIFO.

15: A(n) ______ is the data structure used more than any other data structure.

A.   Binary Tree

B.   Array

C.   Linked List

D.   B-tree

16: The most common solution to the Towers of Hanoi involves the use of which datastructure

A.   Hashtable

B.   Set

C.   Stack

D.   Queue

17: All binary trees are balanced

A.   True

B.   False

18: BFS and DFS are two types of

A.   Sorting algorithms

B.   Searching algorithms

C.   computational complexity measurements

19: Which is an ordered collection of elements in which insertions are restricted to the rear end and deletions are restricted to the front end?

A.   Stack

B.   Binary tree

C.   Queue

D.   Array

20: What is the running time of finding Nth element in array using quick sort? (For example: Find the 4th smallest element in an unsorted array.)

A.   n!

B.   2 ^ n

C.   n * log(n)

D.   n ^ 3

E.   n ^ 2

21: A stack must always be implemented using an array

A.   False

B.   True

22: Which of the following is NOT a basic function of a linked list?

A.   Deletion of a leaf

B.   Creation of a list

C.   Insertion of a node

D.   Deletion of a node

23: Which is an access mechanism that transforms the search key into a storage address, thereby providing very fast access to stored data?

A.   Pointers

B.   Recursion

C.   Binary Search

D.   Hashing

24: A perfect hash function is

A.   maps each hash value to a different valid input

B.   maps each valid input to a different hash value

C.   not possible

25: What is the data structure used to perform recursion?

A.   Array

B.   Binary Tree

C.   B-tree

D.   Stack

26: What is the data structures used to perform recursion?

A.   Heap

B.   Linked List

C.   Stack

D.   Queue

27: Collision resolution is not required if a hash function is perfect

A.   True

B.   False

28: In which of the following areas is data structures NOT applied extensively?

A.   Compiler design

B.   Simulation

C.   Website design

D.   Graphics

29: Which is a collection of distinct unordered elements with a common type and no duplicates?

A.   Set

B.   Stack

C.   Sequence

D.   Structure

30: What is the time complexity to compute the average of a N×M matrix?

A.   O(N^2)

B.   It depends on how both N and M vary.

C.   O(N*M)

D.   O(N+M)

31: Bubble sort's worst case performance is

A.   O(log n)

B.   O(n^3)

C.   O(n^2)

D.   O(1)

E.   O(n)

32: Which of the following problems has the fastest algorithms?

A.   Find the 2nd largest value in an array

B.   Find the 2nd smallest value in an array

C.   Find the maximum value in an array.

D.   Find the median value in an array

33: A balanced binary search tree search average output is

A.   O(n^2)

B.   O(n * log n)

C.   O(log n)

D.   O(n)

E.   O(1)

34: In tree there may be more than one path from root to leaf node

A.   False

B.   True

35: What is the minimum number of queues needed to implement a priority queue?

A.   Ten

B.   Once

C.   Three

D.   Two

36: What is the time complexity to insert an item into a B-Tree?

A.   O(1)

B.   O(N^2)

C.   O(log N)

D.   O(N)

E.   O(N * log N)

37: Which data structure provides the fastest lookup time

A.   HashMap

B.   Fibonacci heap

C.   Sorted list

D.   B-tree

E.   Doubly-linked list

38: The path length from root to farthest leaf node is the ______ of the tree.

A.   Set

B.   Height

C.   Size

D.   Depth

39: What is the correct order for a in-order binary tree traversal?

A.   Right Child - Parent - Left Child

B.   Left Child - Parent - Right Child

C.   Parent - Left Child - Right Child

D.   Left Child - Right Child - Parent

40: Worst case insert for a dynamic array is

A.   O(n^2)

B.   O(1)

C.   O(log n)

D.   O(n)

41: Heapsort's worst case performance is

A.   O(n^2)

B.   O(n * log n)

C.   O(n)

D.   O(1)

E.   O(n^2 * log n)

42: Which is a way of organizing data that considers not only the items stored, but also their relationship to each other?

A.   Database table

B.   Algorithm

C.   Database

D.   Data Structure

43: A technique for direct search is _______.

A.   Linear search

B.   Tree search

C.   Hashing

D.   Binary search

44: Which is the best possible complexity to sort an array?

A.   O(NlogN)

B.   O(N*N)

C.   O(1)

D.   O(logN)

E.   O(N)

45: Which of the following is NOT a property of a B-Tree?

A.   Root is leaf, or has between 2 & M children.

B.   Data stored only on the leaves.

C.   Data is stored only on the branches.

D.   All leaf nodes are at the same level.

46: Which sort will you use if you want to optimize sorting time?

A.   Insertion sort

B.   Quick sort

C.   Bubble sort

D.   Merge sort

47: Can Dijkstra's be used to find the longest-path in a graph?

A.   No, they can't

B.   Yes, with a slight modification to the algorithm.

C.   Yes, by multiplying each edge in the graph by -1, and finding the shortest-path.

48: If a node having two children is deleted from a binary tree, it is replaced by its:

A.   Preorder predecessor

B.   Inorder successor

C.   Suborder successor

D.   Inorder predecessor

49: The path length from a node to the deepest leaf under it is the _________.

A.   Size

B.   Height

C.   Depth

D.   Set

50: Worst case for a binary search tree is

A.   O(n^2)

B.   O(n)

C.   O(2n)

D.   O(log n)

E.   O(n * log n)