Use the following pseudocode for the next six questions. aList is type LinkedLis
ID: 3694700 • Letter: U
Question
Use the following pseudocode for the next six questions. aList is type LinkedList<Integer>
aList.add(4);
aList.add(7);
aList.add(12);
System.out.println(aList.remove( ) ); // r1
aList.add(5);
aList.add(8);
aList.add(18);
System.out.println(aList.get(0)); // r2
System.out.println(aList.remove( )); // r3
aList.add(1, 3);
System.out.println(aList.remove( ));
System.out.println(aList.remove( )); // r4
System.out.println(aList.remove( )); // r5
What value is printed in the line of code marked r1?
What value is printed in the line of code marked r2?
What value is printed in the line of code marked r3?
What value is printed in the line of code marked r4?
What value is printed in the line of code marked r5?
After the code executes, how many elements would remain in a?
Explanation / Answer
1.What value is printed in the line of code marked r1? 4
2.What value is printed in the line of code marked r2? 7
3.What value is printed in the line of code marked r3? 7
4.What value is printed in the line of code marked r4? 3
5.What value is printed in the line of code marked r5? 5
6.After the code executes, how many elements would remain in a? 8 18
Thank you!