Compuscholar CS foundations

Chapter 12 exam questions with multiple choice answers

1 answer

1. Which of the following is NOT an example of a data structure?

A) Array
B) Queue
C) Function
D) Linked List

2. What is the time complexity for searching an element in a binary search tree?

A) O(log n)
B) O(n)
C) O(n log n)
D) O(1)

3. Which of the following is a sorting algorithm with a worst-case time complexity of O(n^2)?

A) Merge Sort
B) Quick Sort
C) Bubble Sort
D) Radix Sort

4. What is the main advantage of using a hash table data structure?

A) Constant time complexity for insertion and deletion
B) Guaranteed order of elements
C) Automatically sorted elements
D) Faster than a linked list for insertion

5. In a stack data structure, which operation removes and returns the top element?

A) Push
B) Pop
C) Peek
D) Top

Answers:
1. C) Function
2. A) O(log n)
3. C) Bubble Sort
4. A) Constant time complexity for insertion and deletion
5. B) Pop