subject

Write the output produced when the following method is passed each of the following stacks:

public static void mystery1(Stack s) {
Queue q = new LinkedList();
while (!s. isEmpty()) {
int n = s. pop();
q. add(n);
q. add(n); }
while (!q. isEmpty()) {
s. push(q. remove());
}
System. out. println(s);
}

[2, 6, 1]
[42, -3, 4, 15, 9]
[30, 20, 10, 60, 50, 40]

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
When determining the classification of data, which one of the following is the most important consideration? a. processing systemb. valuec. storage mediad. accessibility
Answers: 2
question
Computers and Technology, 24.06.2019 01:00
How can the temperature of a room be raised by 5degreesf?
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
If you combine two cells into one, what action are you performing? a.  adding a new row or column      b.  splitting the cells      c.  removing a new row or column      d.  merging the cells
Answers: 2
question
Computers and Technology, 24.06.2019 18:00
Which of the following is an example of synchronous communication? a) e-mail b) voicemail c) telephone conversation d) text message.
Answers: 1
You know the right answer?
Write the output produced when the following method is passed each of the following stacks:
Questions
question
Mathematics, 06.05.2020 16:59
question
Mathematics, 06.05.2020 16:59
question
Mathematics, 06.05.2020 16:59
question
Mathematics, 06.05.2020 16:59
Questions on the website: 13722361