Stacks and Queues - Applications - Higher Difficulty Problems

Download Q&A
Q. If a stack is used to evaluate an expression in postfix notation, what is the time complexity of the evaluation?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. In a circular queue, what condition indicates that the queue is full?
  • A. front == rear
  • B. rear == (front + 1) % size
  • C. front == (rear + 1) % size
  • D. rear == front
Q. In a queue implemented using two stacks, what is the worst-case time complexity for the dequeue operation?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. When implementing a queue using two stacks, what is the average time complexity for enqueue operations?
  • A. O(1)
  • B. O(n)
  • C. O(log n)
  • D. O(n^2)
Q. Which data structure would you use to implement a function that checks for balanced parentheses in an expression?
  • A. Array
  • B. Stack
  • C. Queue
  • D. Linked List
Q. Which of the following applications can be efficiently solved using a stack?
  • A. Undo functionality in text editors
  • B. Breadth-first search in graphs
  • C. Finding the shortest path in a weighted graph
  • D. Sorting an array
Q. Which of the following scenarios is best suited for using a stack?
  • A. Processing tasks in the order they arrive
  • B. Reversing a string
  • C. Searching for an element in a list
  • D. Maintaining a sorted list
Showing 1 to 7 of 7 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely