Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer these multiple choice questions. 22. - 25. Answer questions about the following code: Deque d1= new ArrayDeque >(), d2 = new ArrayDeque ();

Please answer these multiple choice questions.

image text in transcribed

image text in transcribed

22. - 25. Answer questions about the following code: Deque d1= new ArrayDeque >(), d2 = new ArrayDeque (); for (char c: "HELLO". toCharArray ()) \{ d1. push(c); \} for (char c: "GOODBYE", toCharArray ()) \{ d2 add(c); \} while (!d2, isEmpty ()) \{ System, out, print (d2, remove ()); \} Name: 22. Which of the following data structures can implement a queue? You can choose more than one. (a) ArrayList (c) List (e) ArrayDeque (b) LinkedList (d) TreeSet 23. In the code above, which object is a queue? (a) d1 (b) d2 24. After the code has completed up to line 10 , what is at the head of d2 ? (a) ' G ' (c) 'B' (b) ' O ' (d) ' E ' 25. What is the output of the code on lines 12-14? (a) EYBDOOG (c) GOODBYE (b) BEDGOOY (d) EYBDOG

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions