Linked List Worksheet 1
By Mickey Arnold
starstarstarstarstarstarstarstarstarstar
Last updated 10 months ago
3 Questions
1 point
1
Question 1
1.
What is the output?
ListNode x = new ListNode("6", new ListNode ("2", new ListNode("8", null)));
out.println(x.getValue());out.println(x.getNext().getNext().getValue());out.println(x.getNext().getValue());
What is the output?
ListNode x = new ListNode("6", new ListNode ("2", new ListNode("8", null)));
out.println(x.getValue());
out.println(x.getNext().getNext().getValue());
out.println(x.getNext().getValue());
1 point
1
Question 2
2.
What is the output?
ListNode x = new ListNode("go", new ListNode ("on", new ListNode("at", new ListNode("up", , null ) ) ) );
out.println(x.getValue());out.println(x.getNext().getNext().getNext().getValue());out.println(x.getNext().getValue());out.println(x.getNext().getNext().getValue());
What is the output?
ListNode x = new ListNode("go", new ListNode ("on", new ListNode("at", new ListNode("up", , null ) ) ) );
out.println(x.getValue());
out.println(x.getNext().getNext().getNext().getValue());
out.println(x.getNext().getValue());
out.println(x.getNext().getNext().getValue());
1 point
1
Question 3
3.
Fill the blanks below to print out the entire list.
ListNode z = new ListNode("go", new ListNode ("on", new ListNode("at", new ListNode("up", new ListNode("over", null ) ) ) ) );
while( *1 ) {
<*2>
<*3>
}
What should fill in <*1>? _______
What should fill in <*2>? _______
What should fill in <*3>?_______