Docsity

Linked List Structures: Multiple Choice Questions and Answers - Prof. Susanna Wei, Exams of Computer Science

Toggle sidebar
bg1
Chapter 15
Linked Data Structures
 Multiple ChoiceMultiple Choice
1) The first node in a linked list is commonly referred to as the ________ node.
(a) head
(b) tail
(c) predecessor
(d) successor
2) In Java, a node is a/an:
(a) String
(b) Integer
(c) Object
(d) Exception
3) A node contains:
(a) data item(s)
(b) reference(s) to another node
(c) both A and B
(d) none of the above
4) In Java, you indicate the end of a linked list be setting the link instance variable of the last node in
the linked list to __________.
(a) 0
(b) -1
(c) 1
(d) null
5) If the head instance variable of a linked list contains a reference to null, this means the list is:
(a) full
(b) empty
Copyright © 2006 Pearson Education Addison-Wesley. All rights reserved. 1
pf3
pf4

Partial preview of the text

Download Linked List Structures: Multiple Choice Questions and Answers - Prof. Susanna Wei and more Exams Computer Science in PDF only on Docsity!

Chapter 15

Linked Data Structures

 Multiple Choice

  1. The first node in a linked list is commonly referred to as the ________ node. (a) head (b) tail (c) predecessor (d) successor
  2. In Java, a node is a/an: (a) String (b) Integer (c) Object (d) Exception
  3. A node contains: (a) data item(s) (b) reference(s) to another node (c) both A and B (d) none of the above
  4. In Java, you indicate the end of a linked list be setting the link instance variable of the last node in the linked list to __________. (a) 0 (b) - (c) 1 (d) null
  5. If the head instance variable of a linked list contains a reference to null, this means the list is: (a) full (b) empty

2 Walter Savitch • Absolute Java 2/e Test Bank Chapter 15 (c) lost (d) none of the above

  1. Making the Node class a private inner class of a linked data structure is an example of: (a) polymorphism (b) encapsulation (c) inheritance (d) all of the above
  2. A common exception that occurs when using linked lists is the: (a) NodeOutOfBoundsException (b) NodeEmptyException (c) NullPointerException (d) NullNodeOccurredException
  3. A ____________ copy of an object is a copy that has no references in common with the original object. (a) bit copy (b) deep copy (c) shallow copy (d) none of the above
  4. A _____________ copy of an object is a copy that has references in common with the original object. (a) bit copy (b) deep copy (c) shallow copy (d) none of the above
  5. Java contains a mechanism that automatically reclaims memory. This mechanism is called: (a) Garbage elimination (b) Garbage collection (c) Taking out the trash (d) None of the above

 True/False

  1. A linked data structure contains nodes and links.
  2. Java does not come with a LinkedList library class.
  3. When using a linked list, you do not need to know when the end of the list has been reached.

4 Walter Savitch • Absolute Java 2/e Test Bank Chapter 15 .