Computer Knowledge
Data Structures and Algorithms
1,518 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
-
one two three four
-
four three two one
-
four one three two
-
one two three four one
C
Correct answer
Explanation
TreeSet assures no duplicate entries; also, when it is accessed it will return elements in natural order, which typically means alphabetical.
-
Quick sort uses a pivot element to sort the array.
-
Heap sort is a stable sort.
-
Merge sort is a stable sort.
-
Both (2) and (3)
-
None of the above
B
Correct answer
Explanation
This is a wrong statement as heap sort does not preserve the order of values while sorting, hence it is an unstable sort.
-
Stack
-
Queue
-
Tree
-
Array
-
None of the above
A
Correct answer
Explanation
Yes, backtracking is an application of stack data structure. In backtracking, we use one point from source to destination to reach and choosing the path according to stack and if we get a wrong path, then we pop the last path from the stack and then return back to the last point and then again choose the right path.
-
A queue is a FIFO type.
-
Queue can be implemented by linked list.
-
Queue can be implemented by array.
-
Both (1) and (2).
-
(1), (2) and (3) all are true.
E
Correct answer
Explanation
Yes, this is the correct choice.
-
Binary search is not efficient for large data values like 1000 records.
-
Array should be either in ascending or descending sorted order.
-
Mid element should be already defined in the given array.
-
Both (1) and (2)
-
None of the above
B
Correct answer
Explanation
This is the statement for binary search precondition.
-
Tower of Hanoi
-
CPU scheduling
-
Quick sort
-
All of the above
-
None of the above
B
Correct answer
Explanation
Yes, CPU maintains the multiple processes by making a queue of them and allocate the resources to each process in this manner.
-
Arrays
-
Queues
-
Binary search trees
-
Stacks
-
Both (3) and (4)
C
Correct answer
Explanation
In binary search tree, the elements are not in a linear list , they have hierarchical structure so it is a non-linear data structure.
-
LIFO
-
Push and pop
-
Front and rear
-
Both (1) and (3)
-
None of these
C
Correct answer
Explanation
These terms are not related to the stack data structure . Front and rear are the terms related to queue data structure, in which all the insertion are performed only at one end, called rear and all the deletion are performed at one end, called front end.
-
Array is a collection of homogeneous elements.
-
Quick sort is based on the divide and conquer method.
-
Array is an index based data structure.
-
The worst case complexity of quick sort is O(n^2).
-
None of the above
E
Correct answer
Explanation
This is the correct choice as all the above statements are true.
-
Static data structures have a fixed size.
-
Insertion/deletion occurs fast in static data structure.
-
Stack is a dynamic data structure.
-
All of the above
-
Only (1) and (3) are true.
E
Correct answer
Explanation
Yes, both the options are true.
-
Tree
-
Graph
-
Array
-
Both (1) and (2)
-
None of the above
B
Correct answer
Explanation
It is an example of network data model as in graph, there is a relationship among the vertex and sides.
-
Reverse a word
-
Backtracking
-
Undo task in text
-
Conversion of decimal to binary
-
None of the above
E
Correct answer
Explanation
Yes, all of the above are the applications of the stack data structure.
-
Specialisation determines the top-down approach in the database.
-
Generalisation defines the bottom-up approach in the database.
-
In the network model if the database, there may be multiple paths possible to communicate the entities.
-
All of the above
-
Only (1) and (3)
D
Correct answer
Explanation
Yes, all of the above are the true statements in the database concept.
-
A queue is defined as an ordered list.
-
A queue can be implemented by the array.
-
The element is deleted from the from end of the queue.
-
A queue is a FIFO (First In First Out Data Structure).
-
None of the above
E
Correct answer
Explanation
Yes, all of the above are the true statements.
-
Array
-
Queue
-
Stack
-
Tree
-
Graph
C
Correct answer
Explanation
A stack is a last in first out type of data structure. Here, the insertion and deletion of elements can be done only from one end.