0% found this document useful (0 votes)
25 views7 pages

Sample Multiple Choice Exam

Uploaded by

5gdwh4tkpd
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)
25 views7 pages

Sample Multiple Choice Exam

Uploaded by

5gdwh4tkpd
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/ 7

Multiple Choice Exam

Section 1: Data Organization in a Computer

1. How is data organized in primary memory (RAM)?

A. Files

B. Variables and Arrays

C. Tables

D. Databases

2. Which of the following data structures is NOT typically stored in secondary memory?

A. Linked Lists

B. Files

C. Databases

D. Tables

Section 2: Data Structures

3. Which data structure uses nodes containing data and references to the next node?

A. Array

B. Stack

C. Linked List

D. Queue

4. Which data structure operates on a Last In, First Out (LIFO) principle?

A. Queue

B. Stack

C. Binary Tree

D. Graph
5. In a binary search tree (BST), where are nodes with keys greater than the root's key
located?

A. In the left subtree

B. In the right subtree

C. At the root

D. In the middle subtree

6. Which data structure is used for Breadth-First Search (BFS) in graph traversal?

A. Stack

B. Linked List

C. Queue

D. Binary Tree

7. In a binary search tree, the left subtree of a node contains only nodes with keys ____.

A. greater than the node’s key

B. less than the node’s key

C. equal to the node’s key

D. greater than or equal to the node’s key

8. Which data structure is used to implement recursive algorithms efficiently?

A. Queue

B. Stack

C. Array

D. Graph

Section 3: Algorithm Complexity and Efficiency

9. What is the time complexity of searching for an element in a balanced binary search tree
(BST)?
A. O (1)

B. O (n)

C. O (log n)

D. O (n^2)

10. What is the time complexity of binary search on a sorted array?

A. O(n)

B. O(log n)

C. O(n log n)

D. O(n^2)

11. Which sorting algorithm has the worst-case time complexity of O(n^2) but is often
faster than other algorithms like merge sort or quick sort for small datasets?

A. Bubble Sort

B. Insertion Sort

C. Merge Sort

D. Heap Sort

12. Which of the following statements is true about the binary search algorithm?

A. It works on both sorted and unsorted arrays.

B. Its worst-case time complexity is O(n).

C. It can only be applied to arrays of integers.

D. It requires the array to be sorted.

13. Which sorting algorithm has an average-case time complexity of O(n log n)?

A. Bubble Sort

B. Quick Sort

C. Insertion Sort
D. Selection Sort

14. Which of the following sorting algorithms is stable and has a worst-case time
complexity of O (n log n)?

A. Quick Sort

B. Merge Sort

C. Heap Sort

D. Bubble Sort

Section 4: Real-Life Algorithm Applications

15. Which algorithm is best suited for finding the shortest path in a weighted graph?

A. Breadth-First Search (BFS)

B. Depth-First Search (DFS)

C. Dijkstra’s Algorithm

D. Kruskal’s Algorithm

16. What is the primary use of the Economic Order Quantity (EOQ) formula in inventory
management?

A. Minimizing the total cost of inventory

B. Maximizing the total sales

C. Balancing supply and demand

D. Reducing the lead time for orders

17. In text searching, which algorithm is known for its efficiency in finding a substring
within a larger string by preprocessing the pattern?

A. Linear Search

B. Boyer-Moore Algorithm

C. Knuth-Morris-Pratt (KMP) Algorithm

D. Rabin-Karp Algorithm
18. Which algorithm is known for its efficiency in finding a substring within a larger string
by preprocessing the pattern?

A. Linear Search

B. Boyer-Moore Algorithm

C. Knuth-Morris-Pratt (KMP) Algorithm

D. Rabin-Karp Algorithm

19. What data structure is primarily used in the Huffman coding algorithm for data
compression?

A. Binary Tree

B. Linked List

C. Stack

D. Priority Queue

Section 5: Empirical Analysis

20. Which factor is NOT typically considered in an empirical analysis of algorithms?

A. Actual running time

B. Space complexity

C. Memory usage

D. Input size

21. If an algorithm has a high variance in performance on different datasets of the same
size, what does this indicate?

A. The algorithm has consistent performance.

B. The algorithm is efficient.

C. The algorithm's performance is sensitive to the data's specific characteristics.

D. The algorithm has a low complexity.


22. To empirically measure the execution time of a sorting algorithm, which Python library
can be used to record the start and end times of the sorting process?

A. math

B. random

C. time

D. heapq

Section 6: Comprehensive Problem Solving

23. When designing an algorithm to schedule tasks on multiple machines to minimize total
completion time, which scheduling strategy can be used?

A. First-Come-First-Served

B. Shortest Job Next

C. Earliest Deadline First

D. Round Robin

24. Which algorithm would be most appropriate for matching a large number of DNA
sequences against a reference genome?

A. Linear Search

B. Knuth-Morris-Pratt (KMP) Algorithm

C. Dijkstra’s Algorithm

D. Merge Sort

25. In a real-life navigation system, what is the primary purpose of using Dijkstra's
Algorithm?

A. To calculate the fastest driving route between two locations.

B. To estimate the fuel consumption for a trip.

C. To predict traffic conditions.

D. To find all possible routes between two locations.


26. What is the primary advantage of using a greedy algorithm like the one used for task
scheduling?

A. It always finds the globally optimal solution.

B. It is simple and easy to implement.

C. It has the lowest possible time complexity.

D. It requires the least amount of memory.

27. If you need to compress a file effectively to reduce storage space, which algorithm
should you consider implementing?

A. Dijkstra’s Algorithm

B. Quick Sort

C. Huffman Coding

D. Binary Search

You might also like