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

Multiple choice technology
  1. Memory usage

  2. Sorting

  3. Treatment of rows with unmatched keys

  4. All the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Lookup, Join, and Merge stages differ in three key aspects: (1) Memory usage - Lookup loads entire reference dataset into memory while Join/Merge process streaming data, (2) Sorting requirements - Join and Merge require sorted inputs but Lookup doesn't, and (3) Unmatched key handling - Lookup drops unmatched rows, Join drops them, but Merge can preserve them depending on settings. All three represent valid differences.

Multiple choice technology
  1. Memory usage

  2. Sorting

  3. Treatment of rows with unmatched keys

  4. All the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Lookup, Join, and Merge stages differ in multiple ways: Lookup loads reference data entirely into memory (high memory usage), Join requires sorted input on both links, and they handle unmatched rows differently (Lookup drops, Merge keeps, Join can drop or keep). All three are valid distinguishing characteristics.

Multiple choice technology testing
  1. 2

  2. 1

  3. 3

  4. No index is required for referencing an element in a 2D array. Index is applicable only for 1D arrays.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

A 2-dimensional array requires exactly 2 indices to reference an element: one for the row and one for the column (e.g., array(1,2)). Option B is incorrect because one index only works for 1D arrays. Option C is incorrect as 2D arrays don't use 3 indices. Option D is incorrect because all arrays require indices for element access.

Multiple choice
  1. A recursive function is a special function that calls itself.

  2. A recursive function allows us to break down a complex problem in small parts.

  3. It must have an exit condition.

  4. The first function call should be the first one to complete.

  5. Recursion method is applied in many algorithms such as quick sort or binary sort.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

One of the properties of recursive functions is that a given function call must wait for the following function calls to complete its run before it itself can finish. The innermost function call must be completed before we can finish the next inner function call. We must make sure that the first function call (the outermost one) will be the last one to complete.

Multiple choice
  1. LinkedList

  2. Binary Tree

  3. Stack

  4. Queue

  5. Array

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

A queue is a data structure which stores the data in First In First Out Mode. A queue consists of two sides - front and rear. The nodes are added from the rear side and removed from the front side just like people join a queue from the end and pull out   from the beginning in a real life queue. The node that was added the first is also the first one to be removed.

Multiple choice
  1. O(n log n)

  2. O(n)

  3. O(log n)

  4. O(1)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Here we can follow simple procedure, we can rum heap sort for 7 iterations. In each iteration the top most element is smallest, we note & then replace it with the last element, then we run min heapify algorithm, which brings next smallest element on top. This procedure take 0 (log n) time. We need to run it for 7 times. So tight bound O(7 log n) = O(log n)

Multiple choice
  1. O(n log n)

  2. O(n)

  3. O(log n)

  4. O(1)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Here we can follow simple procedure, we can rum heap sort for 7 iterations. In each iteration the top most element is smallest, we note & then replace it with the last element, then we run min heapify algorithm, which brings next smallest element on top. This procedure take 0 (log n) time. We need to run it for 7 times. So tight bound O(7 log n) = O(log n)

Multiple choice
  1. remain O (n2)

  2. become O (n (log n)2)

  3. become O (n log n)

  4. become O (n)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Binary search is efficient when the sorted sequence is there, but the worst case scenario for insertion sort would not be sorted sequence so even using binary search instead of linear search the complexity of comparisons will remain O (n2)

Multiple choice
  1. A heap can be used but not a balanced binary search tree

  2. A balanced binary search tree can be used but not a heap

  3. Both balanced binary search tree and heap can be used

  4. Neither balanced binary search tree nor heap can be used

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Both the tasks can be performed by both the data structures but heap is a data structure where to perform these function every element has to be checked so  O (n) complexity. But the balance binary search tree is efficient data structure since at every decision it selects one of its sub tree to no. of elements to be checked are reduced by a factor of / 1 2 every time. $\dfrac{n}{2!} = x$ x = log n

Multiple choice
  1. n(X + Y)

  2. 3Y + 2X

  3. n(X + Y) - X

  4. Y + 2X

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation