Skip to content
Sharp

Collections · interview question

Which method should be used to add an element to the head of a Deque?

Multiple choiceEasychapter-4-curatedpremiumcollectionsqueue-and-deque-basics
Choose one answer
Answer and explanation

Correct answer

C. AddFirst()

Why

addFirst() is used to add an element to the head of a Deque, allowing for operations at both ends of the collection.

Test yourself on Collections

A free test with instant, explained results. No account needed.

Start free test
All Collections questions →