Computer Knowledge
Data Structures and Algorithms
1,256 Questions
Data Structures and Algorithms form the core of computer science, focusing on arrays, linked lists, trees, and sorting mechanisms. These concepts are essential for solving complex computational problems efficiently. Test takers preparing for technical and administrative IT exams will find these questions highly relevant.
Array OperationsLinked List ApplicationsSorting AlgorithmsTree Data StructuresMultilevel IndexingAlgorithm Time Complexity
Data Structures and Algorithms Questions
-
Traversing
-
Searching
-
Inserting
-
Deleting
-
Merging
B
Correct answer
Explanation
Finding the location of the record with the given key value.
-
O(n)
-
O(logn)
-
O(n2)
-
O(nlogn)
-
O(1)
-
Each node has the maximum of M children and a minimum of M/2 children or any number from 2 to the maximum.
-
Each node has one fewer keys than children with the maximum of M -1 keys.
-
Keys are arranged in a defined order within the node.
-
All the leaves are on the same level, i.e. there is no empty sub tree above the level of the leaves.
-
All the leaves have been connected to form the linked list of the keys in a sequential order.
E
Correct answer
Explanation
This is the Property of B-Tree.
-
Hash-partitioned global indexes are useful.
-
Hash-partitioned local indexes are better.
-
Range-partitioned local indexes are better.
-
Range-partitioned global indexes are better.
A
Correct answer
Explanation
Hash-partitioned global indexes distribute index entries evenly across partitions, which prevents contention when many inserts happen at sequence-generated values. Range partitioning would create hot spots because sequential numbers map to adjacent ranges. Local indexes inherit the partitioning scheme of the table, so they don't solve the skew problem.
-
LIFO linear data structure
-
FIFO linear data structure
-
LIFO non-linear data structure
-
FIFO non-linear data structure
-
GIGO non-linear data structure
B
Correct answer
Explanation
A queue is a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed.. A queue is an example of a linear data structure, or more abstractly a sequential collection.
-
Linked list
-
Heap
-
Queue
-
Stack
-
B-Tree
C
Correct answer
Explanation
BFS algorithm uses a queue data structure to store intermediate results as it traverses the graph.
-
Recursive languages are undecidable.
-
Recursive languages are a recursive subset in the set of all possible words over the alphabet of the language.
-
Recursive languages are closed under set difference operation.
-
Recursive languages are closed under complementation.
-
Recursive languages are closed under union.
A
Correct answer
Explanation
A formal language is recursive if there exists a total turing machine (a turing machine that halts for every given input) that, when given a finite sequence of symbols from the alphabet of the language as input (any string containing only characters in the language's alphabet) accepts only those that are part of the language and rejects all other strings. Recursive languages are also called decidable.
-
O(n2)
-
O(n)
-
O(nlog n)
-
O(n^2log n)
-
O(log n)
B
Correct answer
Explanation
Selection sort is a sorting algorithm, specifically an in-place comparison sort. It has space complexity of O(n) in the worst case.
-
The sort-merge join
-
The nested loops join
-
This depends on some sort parameter values.
-
This depends on the number of rows in each table.
-
Selection sort
-
Bubble sort
-
Quick sort
-
None of these
C
Correct answer
Explanation
Quick sort algorithm works by partitioning the array to be sorted and each partition is in turn sorted recursively.
-
Linear data structure
-
Complex data structure
-
Non-linear data structure
-
Simple data structure
-
None of the above
A
Correct answer
Explanation
An array is a linear data structure.
-
Stack
-
Queue
-
Tree
-
Linked List
-
De-queue
A
Correct answer
Explanation
A stack is a LIFO data-structure. LIFO stands for Last In First Out. The element which enters last, is the first to get out of the stack.
-
The sort-merge join
-
The nested loops join
-
This depends on some sort parameter values
-
This depends on the number of rows in each table
B
Correct answer
Explanation
When OPTIMIZER_MODE is set to FIRST_ROWS, Oracle's cost-based optimizer prioritizes returning the first rows quickly rather than minimizing total resource usage. A nested loops join is typically preferred over sort-merge join in FIRST_ROWS mode because it can start returning rows immediately without waiting for the entire sorting operation to complete, making it more responsive for interactive queries.
-
Linear search is slow as compared to binary search.
-
Linear search requires sorted data.
-
Linear search is not efficient with large data.
-
The complexity of binary search is O(log n).
-
Only (1), (3) and (4) are true.
E
Correct answer
Explanation
Yes, these statements are true.
-
Quick sort requires additional memory as compared to merge sort.
-
The average case complexity of merge sort is the same as quick sort.
-
The worst case complexity of quick sort and merge sort are also the same.
-
All of the above
-
Only (2) and (3).
B
Correct answer
Explanation
Both have the same complexity O(N log N), where N is the number of comparisons.