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. B Tree can be used in database.

  2. In B+ Tree, the root may be either leaf or an internal node with two or more children.

  3. In B Tree of order m, every node has at most m children.

  4. Both (2) and (3).

  5. (1), (2) and (3) all are true.

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

This is the correct choice.

Multiple choice
  1. TreeSet class ensures that the elements will be sorted in the natural ascending order.

  2. HashSet class does not maintain the order of the elements.

  3. HashSet ensures that the elements have no duplicacy.

  4. Both (2) and (3).

  5. (1), (2) and (3) all are true.

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

Correct choice

Multiple choice
  1. Quick sort uses a pivot element to sort the array.

  2. Heap sort is a stable sort.

  3. Merge sort is a stable sort.

  4. Both (2) and (3)

  5. None of the above

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

This is a wrong statement as heap sort does not preserve the order of values while sorting, hence it is an unstable sort.

Multiple choice
  1. Stack

  2. Queue

  3. Tree

  4. Array

  5. None of the above

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

Yes, backtracking is an application of stack data structure. In backtracking, we use one point from source to destination to reach and choosing the path according to stack and if we get a wrong path, then we pop the last path from the stack and then return back to the last point and then again choose the right path.

Multiple choice
  1. Binary search is not efficient for large data values like 1000 records.

  2. Array should be either in ascending or descending sorted order.

  3. Mid element should be already defined in the given array.

  4. Both (1) and (2)

  5. None of the above

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

This is the statement for binary search precondition.

Multiple choice
  1. LIFO

  2. Push and pop

  3. Front and rear

  4. Both (1) and (3)

  5. None of these

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

These terms are not related to the stack data structure . Front and rear are the terms related to queue data structure, in which all the insertion are performed only at one end, called rear and all the deletion are performed at one end, called front end.

Multiple choice
  1. Array is a collection of homogeneous elements.

  2. Quick sort is based on the divide and conquer method.

  3. Array is an index based data structure.

  4. The worst case complexity of quick sort is O(n^2).

  5. None of the above

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

This is the correct choice as all the above statements are true.

Multiple choice
  1. Static data structures have a fixed size.

  2. Insertion/deletion occurs fast in static data structure.

  3. Stack is a dynamic data structure.

  4. All of the above

  5. Only (1) and (3) are true.

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

Yes, both the options are true.

Multiple choice
  1. $fruit= array(Apple, Mango, Banana);
  2. var fruit=new array(Apple, Mango, Banana);

  3. $rate=array(Apple=>50,Mango=>20,Banana=>40);
  4. $fruit=array ( array(Apple,50,60), array(Mango,20,25), array(Banana,40,45) );
  5. (1), (3), and (4) are valid.

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

Yes, these three are the true initializations of the array in php.