Stacks and Queues - Higher Difficulty Problems

Download Q&A
Q. If a stack has a maximum size of 100 and you attempt to push 101 elements onto it, what will happen?
  • A. The 101st element will be pushed successfully.
  • B. An error will occur due to stack overflow.
  • C. The stack will automatically resize.
  • D. The stack will discard the oldest element.
Q. In a priority queue implemented with a binary heap, what is the time complexity for inserting an element?
  • A. O(1)
  • B. O(log n)
  • C. O(n)
  • D. O(n log n)
Q. What is the main disadvantage of using a linked list to implement a stack?
  • A. Higher memory usage per element
  • B. Slower access time
  • C. Complexity of implementation
  • D. No disadvantages
Q. Which of the following statements about stacks is true?
  • A. Stacks can be implemented using arrays or linked lists.
  • B. Stacks allow random access to elements.
  • C. Stacks are FIFO data structures.
  • D. Stacks can only store integers.
Showing 1 to 4 of 4 (1 Pages)
Soulshift Feedback ×

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

Not likely Very likely