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

Multiple choice
  1. Both are LIFO lists.

  2. Both are FIFO lists.

  3. Both are linear data structures.

  4. Insertion in both the data structures take place at the same end.

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

Stacks and queues are both linear data structures, meaning their elements are arranged in a sequential order. They differ in their access patterns (LIFO vs FIFO) and insertion/deletion points.

Multiple choice
  1. Insertion in array is costlier whereas linked list is cheaper.

  2. Deletion in array is costlier whereas linked list is cheaper.

  3. Traversal in array is costlier whereas linked list is cheaper.

  4. Linked list requires more memory than array.

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

Traversal in an array is O(n) and in a linked list is also O(n). Therefore, stating that traversal in an array is costlier than in a linked list is incorrect.

Multiple choice
  1. Equal to height of the tree

  2. Constant

  3. Number of nodes in the heap

  4. None of these

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

In a binary heap, decreasing a key may require 'bubbling up' the node to maintain the heap property. This process takes time proportional to the height of the tree, which is O(log n).

Multiple choice
  1. Infix to postfix conversion

  2. Infix to prefix conversion

  3. Postfix evaluation

  4. None of these

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

Multipop is often used in the analysis of stack operations or specific algorithms like postfix evaluation where multiple operands need to be popped to perform an operation.