Linked List Data Structure Quiz

20 Questions | Total Attempts: 8770

SettingsSettingsSettings
Linked List Data Structure Quiz - Quiz

Have you studied linked lists in data structure? Take this linked list quiz to check your knowledge of this section of data structure. A linked list is basically a linear collection of data elements whose order is not provided by their physical placement in memory. Instead, each element is pointing to the next. If you remember all this, you can easily ace the quiz and get a perfect score. Share the quiz with your friends or anyone dealing with data structures if you find it interesting.


Questions and Answers
  • 1. 
    What are the basic components of a linked list?
    • A. 

      Head and tail are the only important components

    • B. 

      Data members for the information to be stored and a link to the next item

    • C. 

      Generic class because without this linked list is not possible

    • D. 

      None of the above

  • 2. 
    What is a node used for in a linked list?
    • A. 

      To store the information and the link to the next item

    • B. 

      To check for the end of the list

    • C. 

      Not used in a linked list

    • D. 

      All of the above

  • 3. 
    A linked list is different from an array because
    • A. 

      A linked list can handle more types of information than an array.

    • B. 

      An array cannot be sorted, but a linked list can be

    • C. 

      An array is fixed in size, but a linked list is dynamically sizable.

    • D. 

      None of the above

  • 4. 
    In addition to the info and link components, the linked list must also contain what other components?
    • A. 

      Sorting information about the list

    • B. 

      Head and tail pointers to the first and last nodes

    • C. 

      The current node that was last accessed

    • D. 

      All of the above

  • 5. 
    What is the proper code for accessing the information of the second item in a linked list?
    • A. 

      Head.info

    • B. 

      Head.link.info

    • C. 

      Head.link.link.info

    • D. 

      None of the above

  • 6. 
    Giving the fixed size of an array is not important. Which class is more efficient at storing and retrieving information?
    • A. 

      A linked list because of the nodes

    • B. 

      An array because of the reduced code and efficient storage allocation

    • C. 

      Neither is more efficient than the other

    • D. 

      None of the above

  • 7. 
    A linked list class is defined with the following heading. public class UnorderedLinkedList<T> extends LinkedListClass<T> What is the proper syntax for creating a reference variable of the linked list to hold strings?
    • A. 

      LinkedListClass list;

    • B. 

      UnorderedLinkedList list;

    • C. 

      List = UnorderedLinkedList(String)

    • D. 

      All of the above

  • 8. 
    What does the following fragment of code do with a linked list? current = head; while (current != null) { current = current.link; }
    • A. 

      It initializes the list

    • B. 

      It counts the number of items in the list

    • C. 

      It traverses the list

    • D. 

      None of the above

  • 9. 
    Which of the following code fragments properly insert 50 into the linked list at the position after node p? A) newNode = new Node(); newNode.info = 50; p.link = newNode; newNode.link = p.link; B) newNode = new Node(50, p); C) newNopde = new Node(); newNode.info = 50; newNode.link = p.link; p.link = newNode;
    • A. 

      Code A

    • B. 

      Code B

    • C. 

      Code C

    • D. 

      Code B and C

  • 10. 
    Internally, a linked list is implemented with an array for the storage of the information?
    • A. 

      True

    • B. 

      False

  • 11. 
    A linked list must contain a maximum size component to manage the last item?
    • A. 

      True

    • B. 

      False

  • 12. 
    Which of the following code fragments properly delete the item at node p? A) p.link = null; System.gc(); B) q = p.link; p.link = q.link; q = null; System.gc(); C) q = p.link; p.link = q.link; System.gc();
    • A. 

      Code A

    • B. 

      Code B

    • C. 

      Code C

    • D. 

      Both Code A & C

  • 13. 
    What is the difference between building a linked list FORWARD and BACKWARDS?
    • A. 

      The forward list uses the unordered linked list, and backward uses the ordered linked list

    • B. 

      Nothing, only the insertion of the information at the head or tail of the linked list

    • C. 

      The head and tail are reversed definitions in the backward list.

    • D. 

      None of the above

  • 14. 
    What does ADT stand for?
    • A. 

      Automatic Data Template

    • B. 

      Anonymous Data Template

    • C. 

      Abstract Data Type

    • D. 

      None of the above

  • 15. 
    What is the purpose of using an ADT for the linked list class?
    • A. 

      To unnecessarily complicate the design.

    • B. 

      Using an abstract data type is the only method for building linked lists.

    • C. 

      To force a specific set of methods to be used for the subclasses.

    • D. 

      All of the above

  • 16. 
    What does the following code represent? public interface LinkedListADT<T> extends Cloneable
    • A. 

      A linked list class ready to be used in a program

    • B. 

      An abstract method used in a linked list class

    • C. 

      An abstract class used to further define a linked list class

    • D. 

      None of the above

  • 17. 
    The following heading appears for the node class of a linked list class. protected class LInkedListNode<T> implements Cloneable What is the proper syntax for the link component of this class?
    • A. 

      Public LinkedListNode link;

    • B. 

      Protected LinkedListNode link;

    • C. 

      Public T link;

    • D. 

      First and second choices above

  • 18. 
    The instance variables first and last (or head and tail) below to which class of a linked list?
    • A. 

      Class LinkedListNode

    • B. 

      Class LinkedListADT

    • C. 

      Class LinkedListClass

    • D. 

      None of the above

  • 19. 
    What should the default constructor of the LinkedListClass perform?
    • A. 

      Nothing since the LinkedListNode class will take care of initialization.

    • B. 

      Initialize the first and last (or head and tail) and set count to zero

    • C. 

      Initialize the array to store the information in the linked list

    • D. 

      All of the above

  • 20. 
    What is a circular linked list?
    • A. 

      The last node in the linked list points to the first

    • B. 

      The last node in the linked list points to itself.

    • C. 

      A specialized linked list for storing geometric information such as circles

    • D. 

      None of the above

Back to Top Back to top
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.