🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Queue, Deque and PriorityQueue: all 10 questions

Quiz: Queue, Deque and PriorityQueue · Question 3 of 10

Why is ArrayDeque preferred over the Stack class?

Why is ArrayDeque preferred over the Stack class?

  1. A.Stack cannot store objects
  2. B.ArrayDeque allows null elements
  3. C.Stack has no pop method
  4. D.Stack is synchronized and based on the old Vector class, so it is slower
Answer & explanation

Correct answer: Stack is synchronized and based on the old Vector class, so it is slower

The Java documentation recommends Deque implementations such as ArrayDeque for stack use.

Can you get the rest right without peeking?

Take the timed Quiz: Queue, Deque and PriorityQueue quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →