Data Structures and Algorithms Unit Test for 10th grade computer science

1 answer

1. What is a data structure?

a) A way to store and organize data in a computer
b) The representation of an algorithm in code
c) A collection of computer programs
d) The physical layout of a computer system

2. Which data structure has a LIFO (Last-In, First-Out) structure?

a) Queue
b) Stack
c) Linked List
d) Binary Tree

3. Which data structure stores elements in key-value pairs?

a) Array
b) Linked List
c) Hashtable
d) Stack

4. What is the time complexity of searching an element in a binary search tree?

a) O(1)
b) O(n)
c) O(log n)
d) O(n log n)

5. Which sorting algorithm has a worst-case time complexity of O(n^2)?

a) Quick Sort
b) Merge Sort
c) Insertion Sort
d) Bubble Sort

6. What is the purpose of an algorithm?

a) To store and organize data
b) To perform a specific task or solve a problem
c) To create a graphical user interface
d) To handle network communication

7. Which data structure is best suited for implementing a stack?

a) Array
b) Linked List
c) Queue
d) Hashtable

8. Which data structure is used to represent a hierarchical relationship between objects?

a) Queue
b) Stack
c) Linked List
d) Tree

9. What is the time complexity of inserting an element at the end of a dynamic array?

a) O(1)
b) O(n)
c) O(log n)
d) O(n log n)

10. Which searching algorithm uses a divide-and-conquer approach?

a) Linear Search
b) Binary Search
c) Hashing
d) Bubble Sort

Answer Key:
1. a
2. b
3. c
4. c
5. d
6. b
7. b
8. d
9. a
10. b