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
-
Linkedlist
-
Hashset
-
Vector
-
Queue
-
ArrayList
B
Correct answer
Explanation
Hashset is derived from Set interface, which does not allow duplicacy.
-
Arithmetic expression representation and evaluation
-
Lexical analysis phase of compiler
-
Syntax analysis
-
Both (2) and (3)
-
(1), (2) and (3) all are true
E
Correct answer
Explanation
Yes, all the three options are the applications of tree data structure.
-
B Tree can be used in database.
-
In B+ Tree, the root may be either leaf or an internal node with two or more children.
-
In B Tree of order m, every node has at most m children.
-
Both (2) and (3).
-
(1), (2) and (3) all are true.
E
Correct answer
Explanation
This is the correct choice.
-
TreeSet class ensures that the elements will be sorted in the natural ascending order.
-
HashSet class does not maintain the order of the elements.
-
HashSet ensures that the elements have no duplicacy.
-
Both (2) and (3).
-
(1), (2) and (3) all are true.
-
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.
-
CryptoStream
-
Stream-oriented design
-
Cryptographic hashes
-
Asymmetric encryption
-
Oid
B
Correct answer
Explanation
The common language runtime uses a stream-oriented design for implementing symmetric algorithms and hash algorithms.
-
$fruit= array(Apple, Mango, Banana);
-
var fruit=new array(Apple, Mango, Banana);
-
$rate=array(Apple=>50,Mango=>20,Banana=>40);
-
$fruit=array ( array(Apple,50,60), array(Mango,20,25), array(Banana,40,45) );
-
(1), (3), and (4) are valid.
E
Correct answer
Explanation
Yes, these three are the true initializations of the array in php.