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
-
static
-
dynamic
-
linear
-
non-linear
B
Correct answer
Explanation
In a dynamic data structure, it is mandatory to use a concept of pointer. There is no alternative way to pointers for implementing the dynamic data structure.
-
p=&Num;
-
p=Num;
-
p=Num[0];
-
p=Num[50];
B
Correct answer
Explanation
The statement p=Num; is the correct way to store the address in a pointer variable p. Here there is no requirement of address operator(&) before the array name.
-
B-tree
-
Hash table
-
Dequeue
-
Set
-
Bitmap
B
Correct answer
Explanation
Compiler implementations usually use hash tables to look up identifiers. A hash table (also hash map) is a data structure used to implement an associative array, a structure that can map keys to values. A hash table uses a hash function to compute an index into an array of buckets or slots, from which the correct value can be found.
-
Circular buffer
-
Bitmap
-
Graph
-
Tagged union
-
Container
C
Correct answer
Explanation
Graphs and trees are linked abstract data structures composed of nodes. Each node contains a value and also one or more pointers to other nodes. Graphs can be used to represent networks, while trees are generally used for sorting and searching, having their nodes arranged in some relative order based on their values.
-
Union
-
Map
-
Set
-
Container
-
Priority queue
A
Correct answer
Explanation
A union is a value that may have any of several representations or formats, or it is a data structure that consists of a variable which may hold such a value.
-
Tree
-
Stack
-
Queue
-
String
-
Set
C
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. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed.
-
Manipulation of arithmetic expression
-
Symbol table construction
-
Syntax analysis
-
Hierarchical network
-
Recursion
E
Correct answer
Explanation
Recursion uses stack data structure.
-
Linked list
-
B-tree
-
Hash table
-
Heap
-
Queue
C
Correct answer
Explanation
Quadratic Probing is used for collision resolution in hashing.It is a technique in which the interval between probes is increased by adding the successive outputs of a quadratic polynomial to the starting value given by the original hash computation.
-
Simple linked list
-
BST
-
B+ tree
-
Hash table
-
AVL tree
C
Correct answer
Explanation
The primary value of a B+ tree is in storing data for efficient retrieval in a block-oriented storage context — in particular, filesystems. This is primarily because unlike binary search trees, B+ trees have very high fanout (number of pointers to child nodes in a node,typically on the order of 100 or more), which reduces the number of I/O operations required to find an element in the tree.
-
Bucket sort
-
Prim's minimal spanning tree
-
Bubble sort
-
Shell sort
-
Comb sort
B
Correct answer
Explanation
By using heaps as internal traversal data structures, run time will be reduced by polynomial order. Examples of such problems are Prim's minimal spanning tree algorithm and Dijkstra's shortest path problem.
-
Tree
-
Linked list
-
Stack
-
Queue
-
Set
D
Correct answer
Explanation
The Breadth First Search algorithm uses a queue data structure to store intermediate results as it traverses the graph.
-
A tree is a widely used abstract data type (ADT).
-
A tree can be defined recursively.
-
A walk in which the children are traversed before their respective parents are traversed is called a pre-order walk.
-
An external node is any node that does not have child nodes.
-
A tree is a connected acyclic graph.
C
Correct answer
Explanation
A walk in which the children are traversed before their respective parents are traversed is called a post-order walk.
-
Arrays can be used to determine control flow in programs.
-
Arrays are also used to implement other data structures.
-
Two-dimensional arrays are also called matrices.
-
The element indices of arrays cannot be computed at run time.
-
An index maps the array value to a stored object.
D
Correct answer
Explanation
Arrays are useful mostly because the element indices can be computed at run time. Among other things, this feature allows a single iterative statement to process arbitrarily many elements of an array. For that reason, the elements of an array data structure are required to have the same size and should use the same data representation.
-
Solving the puzzle called Tower of Hanoi implements stacks.
-
A stack is a restricted data structure.
-
A stack may be implemented to have a bounded capacity.
-
A stack is a specific data structure.
-
Backtracking is an important application of stacks.
D
Correct answer
Explanation
A stack is a particular kind of abstract data type or collection in which the principal (or only) operations on the collection are the addition of an entity to the collection, known as push and removal of an entity, known as pop.
-
Little Omega Notation
-
Theta Notaion
-
Recursive Algorithm
-
Probabilistics Algorithm
-
Greedy Algorithm
C
Correct answer
Explanation
It is an algorithm which calls itself with smaller inputs and obtains the outputs for the current input by applying simple operaions to the returned value of the smaller input.