Java Deque MCQs with answers Page - 1

You will find multiple-choice questions (MCQs) related to #Java Deque here. Go through these questions to prepare effectively for your upcoming exams and interviews.

To view the correct answer for any question, simply click the "Show Answer" button.

Have a question to share? Click on "Add Question" to contribute!

A

Admin • 802.91K Points
Coach

Q. What does Deque stand for in Java?

  • (A) Double Queue
  • (B) Data Queue
  • (C) Double-Ended Queue
  • (D) Default Queue

A

Admin • 802.91K Points
Coach

Q. Which class implements the Deque interface in Java?

  • (A) ArrayList
  • (B) ArrayDeque
  • (C) LinkedList
  • (D) Both b and c

A

Admin • 802.91K Points
Coach

Q. Which method adds an element at the front of the Deque?

  • (A) add()
  • (B) offerFirst()
  • (C) push()
  • (D) insert()

A

Admin • 802.91K Points
Coach

Q. Which method removes and returns the last element of a Deque?

  • (A) pop()
  • (B) pollLast()
  • (C) removeFirst()
  • (D) peekLast()

A

Admin • 802.91K Points
Coach

Q. What exception is thrown if removeLast() is called on an empty Deque?

  • (A) NullPointerException
  • (B) IllegalStateException
  • (C) NoSuchElementException
  • (D) IllegalArgumentException

A

Admin • 802.91K Points
Coach

Q. Which method retrieves, but does not remove, the first element of a Deque?

  • (A) pollFirst()
  • (B) element()
  • (C) peekFirst()
  • (D) getFirst()

A

Admin • 802.91K Points
Coach

Q. Which method is used to add an element at the end of a Deque?

  • (A) offerLast()
  • (B) addEnd()
  • (C) append()
  • (D) push()

A

Admin • 802.91K Points
Coach

Q. What will `push()` do in a Deque?

  • (A) Remove element
  • (B) Insert at the head
  • (C) Insert at the tail
  • (D) Throw exception

A

Admin • 802.91K Points
Coach

Q. Which method retrieves but does not remove the last element of a Deque?

  • (A) peekLast()
  • (B) pollLast()
  • (C) getLast()
  • (D) element()

A

Admin • 802.91K Points
Coach

Q. Which method removes the first element in a Deque and throws exception if empty?

  • (A) pollFirst()
  • (B) removeFirst()
  • (C) deleteFirst()
  • (D) pop()
What's Tag

As you may know, questions are organized under broad categories. Each category can include various types of questions. For example, the "History" category might contain questions about the Revolt of 1857, Shivaji Maharaj, Ancient History, Buddhism, and more.

To further refine this organization, we've introduced tags, which act as sub-categories to group questions more specifically.

Verified users can add tags to any question. If you have any suggestions regarding this system, we'd love to hear from you. Contact Us

Learn More