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, 22.06.2019 08:00
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
When you mouse over and click to add a search term this(these) boolean operator(s) is(are) not implied. (select all that apply)?
Answers: 1
question
Computers and Technology, 23.06.2019 21:50
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
question
Computers and Technology, 24.06.2019 14:00
In the microsoft® access® and microsoft excel® programs, the ribbon contains tabs that are divided into with like tools in them. parts groups containers bunches
Answers: 1
You know the right answer?
Write the output produced when the following method is passed each of the following stacks:
Questions
Questions on the website: 13722361