Data Structures & AlgorithmsEasyWipro · Accenture pattern

Which of these is NOT a typical application of a stack?

  1. A. Managing function calls (call stack)
  2. B. Breadth-first search of a graph
  3. C. Undo in a text editor
  4. D. Checking balanced parentheses

Correct answer: B. Breadth-first search of a graph

BFS visits vertices level by level and needs a FIFO queue. Parenthesis matching, the call stack and undo all need the most recent item first, which is what a stack provides.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic