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
-
Free storage list
-
Garbage collection
-
Traversing
-
Searching
-
Sorting
B
Correct answer
Explanation
This technique is used to collect all the free cells and store them in free pool.
-
Inorder
-
Postorder
-
Preorder
-
Push
-
Pop
C
Correct answer
Explanation
Traversing begins with the root, then proceeds towards the end of the left subtree and then, towards the right subtree.
-
Order
-
Length
-
Depth
-
Degree
-
Path
C
Correct answer
Explanation
This property of list structure is the maximum level attributed to any element within the list or within any sublist in the list.
-
Linear search
-
Binary search
-
Hashing
-
Sorting
-
Traversing
C
Correct answer
Explanation
This technique can be used for implementing indexes.
-
Tape drive merge sort
-
Insertion sorting
-
Polyphase sorting
-
Bubble sorting
-
Selection sorting
C
Correct answer
Explanation
This type of an external sorting is the one in which the basic idea is to distribute ordered initial runs of predetermined size on the available tapes and repeatedly merge these runs in multiple phases, in which each phase has a predetermined number of merges before the target tape is selected.
-
the first-in first-out approach
-
the dot operator
-
a member name
-
an index number
D
Correct answer
Explanation
Array elements are accessed using an index number that specifies the position of the element within the array. In most languages including C++, array indices start at 0, so the first element has index 0, the second has index 1, and so on.
-
Last Out First In (LOFI)
-
Last In First Out (LIFO)
-
First In First Out (FIFO)
-
Last In Last Out (LILO)
B
Correct answer
Explanation
A stack follows the Last In First Out (LIFO) principle, where the last element added is the first one removed. This is analogous to a stack of plates where you can only add or remove from the top. Options like FIFO (queue) or LILO don't apply to stacks.
-
separated by commas
-
surrounded by brackets and separated by commas
-
separated by commas and surrounded by brackets
-
surrounded by brackets
-
LRU algorithm
-
Random replacement algorithm
-
First in first out replacement algorithm
-
Linear search algorithm
-
Binary search algorithm
C
Correct answer
Explanation
This type of algorithm in memory management removes the block that has been in the cache for the longest time.
-
Breadth first search
-
Bidirectional search
-
Best first search
-
Uniform cost search
-
Depth first search
C
Correct answer
Explanation
Best first search is an informed search technique.
-
Fourth
-
Fifth
-
Third
-
None of the above
B
Correct answer
Explanation
Array elements are zero-indexed in C/C++ and most programming languages. Element myarray[4] is actually the fifth element because myarray[0] is the first, myarray[1] is the second, and so on. This zero-based indexing is a common source of off-by-one errors for beginners.
-
Vector
-
Hash Table
-
Stack
-
Enumeration
D
Correct answer
Explanation
Enumeration is an interface in Java that allows you to generate (iterate through) a series of elements one at a time from collections like Vector or Hashtable. Unlike other data structures, Enumeration specifically provides the hasMoreElements() and nextElement() methods for sequential access.
-
Depth first search algorithm
-
Uniform cost search algorithm
-
Breadth first search algorithm
-
Iterative deepening search algorithm
-
Minimax algorithm
D
Correct answer
Explanation
This algorithm is a strategy that sidesteps the issue of choosing the best depth limit by trying all possible depth limits.
-
Set
-
Multi set
-
Stack
-
Array
-
Structure
A
Correct answer
Explanation
This data structure represents a list where the order does not matter to the application and has no duplicates.