Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume the declaration of array weekName. String weekName[ ] = {\"Sun\", \"Mon\"

ID: 3776178 • Letter: A

Question

Assume the declaration of array weekName.
String weekName[ ] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
Assume that the a glassqueue q1 contains the elements of weekName and a array stack stk1 contains the elements of the same array weekName.

GlassQueue<String> q1=new GlassQueue<String>();
ArrayStack<String> stk1=new ArrayStack<String>();
String weekName[ ] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
String strB = (String)stk1.top();
String strA = (String)q1.peekFront();
while(strA != strB){
stk1.pop();
q1.dequeue();
strB=(String)stk1.top();
strA=(String)q1.peekFront();
}
System.out.println("strA= " + strA);

After executing the loop, strA contains the following day :

Explanation / Answer

The Above Question Answer is Sunday.Because in the Datastructure have PUSH() and POP() Operations.In this question you are asking output by using System.out.println.So POP() method read the list TOP to Bottom.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote