Data Structures & Algorithms MCQs

20 practice MCQs on this page Page 2 of 4

Tap an option to check your answer — the correct answer and full explanation appear after you choose.

ProgrammingData Structures & Algorithms PPSC FPSC NTSID: PROG-108

In a binary tree, what is a 'leaf node'?

  1. AA node with no children. ✓ Correct answer
  2. BThe topmost node of the tree.
  3. CA node with two children.
  4. DThe longest path in the tree.
ProgrammingData Structures & Algorithms PPSC FPSC NTSID: PROG-113

In binary search, what is compared first with the target value?

  1. AThe first element of the list
  2. BThe last element of the list
  3. CThe sum of all the elements
  4. DThe middle element of the list ✓ Correct answer
ProgrammingData Structures & Algorithms PPSC FPSC NTSID: PROG-118

In a stack, what happens when an item is 'popped'?

  1. AThe bottom item is removed
  2. BThe top item is removed ✓ Correct answer
  3. CA new item is added on top
  4. DThe stack is cleared
ProgrammingData Structures & Algorithms STSID: LTP-418

Among the following, which data structure uses push() operations on its data?

  1. AGraph
  2. BQueue
  3. CStack ✓ Correct answer
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-851

Which data structure uses LIFO (Last In, First Out) principle?

  1. AStack ✓ Correct answer
  2. BQueue
  3. CLinked List
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-853

Which sorting algorithm is the fastest in the average case?

  1. AQuick Sort ✓ Correct answer
  2. BMerge Sort
  3. CBubble Sort
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-854

Which data structure is used for recursion?

  1. AGraph
  2. BQueue
  3. CStack ✓ Correct answer
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-859

A connected graph with n vertices and n-1 edges is always a _____?

  1. AEulerian Graph
  2. BCycle
  3. CTree ✓ Correct answer
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-860

A graph with no cycles is called a _____?

  1. AWeighted Graph
  2. BTree ✓ Correct answer
  3. CBipartite Graph
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-904

What is the time complexity of inserting an element in a binary heap?

  1. AO(n log n)
  2. BO(1)
  3. CO(log n) ✓ Correct answer
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-905

Which algorithm is used to find the shortest path in a graph?

  1. ADecision Tree
  2. BDijkstra's Algorithm ✓ Correct answer
  3. CK-Nearest Neighbors
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-906

Which of the following data structures does not allow duplicate elements?

  1. ALinked List
  2. BStack
  3. CHash Set ✓ Correct answer
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-907

Which of the following is a self-balancing binary search tree?

  1. AAVL Tree ✓ Correct answer
  2. BBinary Heap
  3. CHash Table
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-908

Which data structure is best for implementing a priority queue?

  1. AHash Table
  2. BHeap ✓ Correct answer
  3. CStack
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-909

Which data structure provides constant-time lookup using keys?

  1. AHash Table ✓ Correct answer
  2. BArray
  3. CStack
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-910

A Queue follows which of the following principle?

  1. AFIFO ✓ Correct answer
  2. BLIFO
  3. CSJF
  4. DNone of them
ProgrammingData Structures & Algorithms STSID: LTP-1812

A data structure having data elements arranged in sequential order would be known as ______?

  1. ATree data structure
  2. BNon-linear data structure
  3. CLinear data structure ✓ Correct answer
  4. DNone of these
ProgrammingData Structures & Algorithms STSID: LTP-1907

A set of instructions/steps/rules that are followed to solve a problem is called _____?

  1. AProcedure
  2. BMethod
  3. CAlgorithm ✓ Correct answer
  4. DNone of these
ProgrammingData Structures & Algorithms STSID: LTP-1912

A data structure known as FILO (First In Last Out) would be considered as _____?

  1. AQueue
  2. BStack ✓ Correct answer
  3. CPriority queue
  4. DNone of these
ProgrammingData Structures & Algorithms BPSCID: BPP-2126

Which data structure is used in function call

  1. AStack ✓ Correct answer
  2. BQueue
  3. CLinked List
  4. DTree

Practice these MCQs interactively