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

Question 1. 1. (TCO 2) A special variable that stores a reference to the first n

ID: 3781010 • Letter: Q

Question

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; 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

Explanation / Answer

Question 1: first , or the header

Question 2 : doubly linked list

Question 3 : two references

Question 4: a next field

Question 5: linked list

Question 6: It determines if the list is empty

Question 7: It finds if the item is contained in the linked list.

Question 8: The number of elements in the list.

Question 9: The smallest element in the list.

Question 10: prints the information stored in the last node.

Question 11: System.out.println(current.getInfo());

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