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. Tape drive merge sort

  2. Insertion sorting

  3. Polyphase sorting

  4. Bubble sorting

  5. Selection sorting

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. the first-in first-out approach

  2. the dot operator

  3. a member name

  4. an index number

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. Last Out First In (LOFI)

  2. Last In First Out (LIFO)

  3. First In First Out (FIFO)

  4. Last In Last Out (LILO)

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. separated by commas

  2. surrounded by brackets and separated by commas

  3. separated by commas and surrounded by brackets

  4. surrounded by brackets

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

When accessing elements in a multi-dimensional array in C++ or similar languages, each index must be enclosed in its own set of square brackets. For example, a two-dimensional array is accessed as matrix[i][j], where each index is surrounded by brackets.

Multiple choice
  1. It must use a sorted array.

  2. The requirement of sorted array is expensive when a lot of insertion and deletions are needed.

  3. There must be a mechanism to access middle element directly.

  4. The binary search algorithm is not efficient when the data elements are more than 1000.

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

Binary search IS efficient (O(log n)) even for large datasets - its power grows with size. The real limitations are: A) it requires a sorted array, B) maintaining sorted order is costly with frequent insertions/deletions (requires resorting or complex data structures), and C) it needs direct middle element access (random access, not suitable for linked lists). Option D is NOT a limitation.