Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1. 1. (TCO 2) A special variable that stores a reference to the first node is used to provide access to a linked list.

Question 1.1. (TCO 2) A special variable that stores a reference to the first node is used to provide access to a linked list. Typically, we call it the _____ of the linked list. (Points : 3)
-first, or the header -last -tail - reference

Question 2.2. (TCO 2) A _____ can always be traversed in the backward direction. (Points : 3)
-linked list -doubly linked list -linked list with a header dummy node -linked list with a trailer node

Question 3.3. (TCO 2) The node of a doubly linked list contains _____. (Points : 3)
-one reference -two references -three references -an array

Question 4.4. (TCO 2) In each node of a circular linked list we use _____. (Points : 3)
-a next field -the null value -a previous field -a next field and a previous field

Question 5.5. (TCO 2) The following class framework corresponds to the class _____. public class ClassName { private Node first; public ClassName(){...} public boolean isEmpty(){...} public void display(){...} public void add(int i){...} public void remove(int x){...} } (Points : 3)
-node -arraybag -arraylist -linkedlist

Question 6.6. (TCO 2) Which linked list operation does the operation method below define? public boolean operation() { return (first.getNext() == null); } (Points : 3)
-It initializes the linked list. -It determines if the list is empty. -It inserts an element in the linked list. -It displays the list elements.

Question 7.7. (TCO 2) Which linked list operation does the operation method below define? public boolean operation(int item) { Node current = first.getNext(); while(current != null) { if (current.getInfo() == item) return true; current = current.getNext(); } return false; } (Points : 3)
-It displays the list elements. -It finds if the item is contained in the linked list. -It inserts the item in the linked list. -It removes the item from the linked list.

Question 8.8. (TCO 2) Suppose that the method below is one of the methods in a LinkedList class. The method returns which of the following? public int operation() { Node current = first.getNext(); int value = 0; while(current != null) { value++; current = current.getNext(); } return value; } (Points : 3)
-The sum of all list elements -The smallest element in the list -The greatest element in the list -The number of elements in the list

Question 9.9. (TCO 2) Suppose that the method below is one of the methods in a LinkedList class. Assume that the list has a dummy header node and that the list is not empty. The method returns which of the following? public int operation() { Node current = first.getNext(); int value = current.getInfo(); while (current != null) { if(current.getInfo() < value) value = current.getInfo(); current = current.getNext(); } return value; } (Points : 3)
-The sum of all list elements -The smallest element in the list -The greatest element in the list -The number of elements in the list

Question 10.10. (TCO 2) Suppose that first is the dummy header node of a linked list. The code below _____. Node current = first; while (current.getNext() != null) { current = current.getNext(); } System.out.println(current.getInfo()); (Points : 3)
-prints the information stored in the first node -prints the information stored in the second node -prints the information stored in the node before the last -prints the information stored in the last node

Question 11.11. (TCO 2) Which of the following produces an execution error if the value of current is null? (Points : 3)
-Node current = new Node(); -if (current != null) System.out.println(Not null); -System.out.println(current.getInfo()); -current = null;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

How does selection differ from recruitment ?

Answered: 1 week ago