Array Access
What is the time complexity for accessing an element in an array by its index?
- A: O(n)
- B: O(log n)
- C: O(1)
- D: O(n log n)
- E: O(n squared)
Linked List Insertion
What is the time complexity to insert a node at the beginning of a singly linked list, given the head pointer?
- A: O(n)
- B: O(log n)
- C: O(1)
- D: O(n log n)
- E: O(n square)
Hash Table Collision
Which of the following is a common technique for resolving collisions in a hash table?
- A: Binary Search
- B: Linear Probing
- C: Quick Sort
- D: Depth-First Search
- E: Merg Sort
Binary Search Requirement
What condition must be met for binary search to function correctly?
- A: The data must be sorted
- B: The data must be unsorted
- C: The data must contain no duplicates
- D: The data must be in reverse order
- E: The data can be any order
Quick Sort Worst Case
In what scenario does Quick Sort exhibit its worst-case time complexity?
- A: Already sorted data
- B: Randomly ordered data
- C: Small input size
- D: Almost sorted data
- E: Descending order data
String Reversal
Which data structure is most suitable for efficiently reversing a string?
- A: Queue
- B: Linked List
- C: Stack
- D: Tree
- E: Hash table
Stack Operations
Which principle does a stack follow?
- A: First In, First Out (FIFO)
- B: Last In, First Out (LIFO)
- C: Random Access
- D: Middle In, Middle Out
- E: None of the Above
Queue Applications
Which of the following is a typical application of a queue?
- A: Expression Parsing
- B: Function Call Management
- C: Task Scheduling
- D: Recursion Control
- E: Memory Allocation
Recursion Base Case
What is a critical component of a recursive function?
- A: Loop Invariant
- B: Base Case
- C: Global Variable
- D: Inline Function
- E: Default Parameter
Backtracking Goal
What is the primary purpose of backtracking algorithms?
- A: Find the optimal solution
- B: Find all possible solutions
- C: Sort data efficiently
- D: Search a specific element
- E: Reverse a string
Tree Traversal
Which tree traversal method visits the left subtree, then the root, then the right subtree?
- A: Pre-order
- B: Post-order
- C: In-order
- D: Breadth-first
- E: Depth-First
Heap Type
Which type of tree is commonly used to implement a priority queue?
- A: Binary Search Tree
- B: AVL Tree
- C: Red-Black Tree
- D: Heap
- E: Segment Tree
Graph Representation
Which data structure is used to represent a graph?
- A: Array
- B: Linked List
- C: Matrix
- D: Stack
- E: All of the above
Dynamic Programming Savings
What is the main advantage of using dynamic programming?
- A: Reduces code size
- B: Avoids redundant calculations
- C: Increases memory usage
- D: Simplifies debugging
- E: Improves readability
Bitwise Operation
Which bitwise operator performs a logical AND operation on individual bits?
- A: |
- B: u0026
- C: ^
- D: ~
- E: u003Eu003E
Trie Purpose
For what purpose is a trie data structure primarily used?
- A: Storing numerical data
- B: Efficient string retrieval
- C: Graph representation
- D: Sorting algorithms
- E: Dynamic memory allocation
Array Deletion Time Complexity
What is the average time complexity of deleting an element from the middle of an unsorted array?
- A: O(1)
- B: O(log n)
- C: O(n)
- D: O(n log n)
- E: O(n^2)
Linked List Cycle Detection
Which algorithm is commonly used to detect cycles in a linked list?
- A: Binary Search
- B: Floyd's Cycle-Finding Algorithm
- C: Depth-First Search
- D: Breadth-First Search
- E: Merge Sort
Hash Function Property
What is a desirable property of a good hash function?
- A: Always produces the same hash value for different inputs
- B: Distributes keys evenly across the hash table
- C: Causes frequent collisions
- D: Is very complex and computationally expensive
- E: Only works with integer keys
Searching Rotated Sorted Array
Which search algorithm is most efficient for searching in a rotated sorted array?
- A: Linear Search
- B: Binary Search
- C: Depth-First Search
- D: Breadth-First Search
- E: Interpolation Search
Merge Sort Time Complexity
What is the time complexity of Merge Sort in the best, average, and worst cases?
- A: O(n), O(n log n), O(n^2)
- B: O(log n), O(n log n), O(n log n)
- C: O(n log n), O(n log n), O(n log n)
- D: O(1), O(log n), O(n)
- E: O(n), O(n), O(n)
String Palindrome Check
What is a palindrome?
- A: A string that is always sorted alphabetically
- B: A string that reads the same forwards and backward
- C: A string containing only numbers
- D: A string with no vowels
- E: A string that contains all unique characters
Stack Application - Balanced Parentheses
What is a stack commonly used for in terms of strings and parentheses?
- A: Calculating string length
- B: Checking for balanced parentheses
- C: Reversing a string
- D: Sorting strings alphabetically
- E: Counting the number of vowels
Graph Shortest Path
Which algorithm is commonly used to find the shortest path in a weighted graph?
- A: Depth-First Search
- B: Breadth-First Search
- C: Dijkstra's Algorithm
- D: Bubble Sort
- E: Linear Search
Dynamic Programming Overlapping Subproblems
What characteristic of problems makes them suitable for solving with dynamic programming?
- A: Having no overlapping subproblems
- B: Having independent subproblems
- C: Having overlapping subproblems
- D: Requiring a lot of memory
- E: Being very complex and unsolvable by other means