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
  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. Fourth

  2. Fifth

  3. Third

  4. None of the above

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

Multiple choice
  1. Vector

  2. Hash Table

  3. Stack

  4. Enumeration

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

Multiple choice
  1. Depth first search algorithm

  2. Uniform cost search algorithm

  3. Breadth first search algorithm

  4. Iterative deepening search algorithm

  5. Minimax algorithm

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