Data Structures MCQs (Part-11)

What is the main advantage of using a Segment Tree?

A Efficient range queries
B Simple to implement
C Fixed size structure
D Reduces space complexity

What is the time complexity for querying a range sum in a Fenwick Tree (Binary Indexed Tree)?

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

What is a Suffix Tree used for?

A Searching substrings
B Sorting elements
C Searching for patterns
D Memory optimization

Which of the following is the primary operation supported by a Disjoint Set Union (DSU)?

A Find
B Merge
C Union
D All of the above

What is the space complexity of a Segment Tree?

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

Which of the following operations can be performed efficiently by a Disjoint Set Union (DSU) with path compression?

A Sorting
B Range Queries
C Union of sets
D Finding the longest path

Which of the following is a key feature of a Fenwick Tree?

A It stores the entire array
B It supports constant time queries
C It is used for range sum queries
D It has no space overhead

What is the main difference between a Segment Tree and a Binary Indexed Tree (Fenwick Tree)?

A Segment Tree supports both range queries and point updates
B Fenwick Tree is more efficient for range queries
C Segment Tree has O(n) space complexity
D Fenwick Tree is a tree based structure

What is the primary advantage of using path compression in a Disjoint Set Union (DSU)?

A Reduces time complexity for union operations
B Makes the tree shallow
C Increases memory usage
D Speeds up find operations

Which operation does a Suffix Tree allow to perform in O(n) time?

A Finding the longest common prefix
B Finding the longest repeated substring
C Finding all occurrences of a substring
D All of the above

Which of the following operations is not supported efficiently by a Fenwick Tree?

A Point updates
B Range queries
C Range updates
D Range sum queries

What is the worst-case time complexity of a find operation in a Disjoint Set Union (DSU) without path compression?

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

What type of data structure is used to implement a Suffix Tree?

A Trie
B Hash Map
C Binary Tree
D Array

Which of the following is a drawback of a Segment Tree?

A It requires too much space
B It cannot handle range queries
C It is slower than a Fenwick Tree
D It is not suitable for dynamic datasets

What is the time complexity of the union operation in DSU with union by rank and path compression?

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