Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS2007 - Data Structures II Review. 2 When you declare a variable that refers to an object of a given class, you are creating a(n) ______ to the object.

Similar presentations


Presentation on theme: "CS2007 - Data Structures II Review. 2 When you declare a variable that refers to an object of a given class, you are creating a(n) ______ to the object."— Presentation transcript:

1 CS Data Structures II Review

2 2 When you declare a variable that refers to an object of a given class, you are creating a(n) ______ to the object. interface reference Method ADT

3 3 Review A reference variable whose sole purpose is to locate the first node in a linked list is called ______. top front head first

4 4 Review A reference variable declared as a data field within a class has the default value ______. 0 null empty

5 5 Review If you attempt to use a reference variable before it is instantiated, a(n) ______ will be thrown. IndexOutOfBoundsException InstantiationException IllegalAccessException NullPointerException

6 6 Review According to the principle of information hiding, the data fields of a class must be declared as ______. public protected private abstract

7 7 Review The last node of a linear linked list ______. has the value null has a next reference whose value is null has a next reference which references the first node of the list cannot store any data

8 8 Review A reference variable whose sole purpose is to locate the first node in a linked list is called ______. top front head first

9 9 Review An array-based implementation of an ADT list ______. requires less memory to store an item than a reference-based implementation is not a good choice for a small list has a variable size has items which explicitly reference the next items

10 10 Review In all circular linked lists, ______. every node references a predecessor every node references a successor the next reference of the last node has the value null each node references both its predecessor and its successor

11 11 Review If the array: 6, 2, 7, 13, 5, 4 is added to a stack, in the order given, which number will be the first number to be removed from the stack?

12 12 Review The ______ method of the ADT stack adds an item to the top of the stack. createStack push pop peek

13 13 Review If a stack is used by an algorithm to check for balanced braces, which of the following is true once the end of the string is reached? the stack is empty the stack has one “{” the stack has one “}” the stack has one “{” and one “}”

14 14 Review The pop operation throws a StackException when it tries to ______. add an item to an empty stack add an item to an array-based implementation of a stack that is already full delete an item from an array-based implementation of a stack that is already full delete an item from an empty stack

15 15 Review The push operation throws a StackException when it tries to ______. add an item to an empty stack add an item to an array-based implementation of a stack that is already full delete an item from an array-based implementation of a stack that is already full delete an item from an empty stack

16 16 Review In the StackInterface class, the pop method returns an item that is an instance of ______. Integer Double String Object

17 17 Review StackInterface provides the specifications for ______. only the array-based implementation of a stack only the reference-based implementation of a stack only an implementation of a stack that uses the ADT list all the implementations of a stack

18 18 Review Which of the following ADTs is like a line of people? list stack queue tree

19 19 Review Operations on a queue can be carried out at ______. its front only its back only both its front and back any position in the queue

20 20 Review The ______ operation retrieves the item that was added earliest to a queue, but does not remove that item. enqueue dequeue dequeueAll peek

21 21 Review A reference-based implementation of a queue that uses a linear linked list would need at least ______ external references. one two three four

22 22 Review Which of the following methods of QueueInterface does NOT throw a QueueException? enqueue dequeue dequeueAll peek

23 23 Review If a queue is implemented as the ADT list, which of the following queue operations can be implemented as list.get(1)? enqueue() dequeue() isEmpty() peek()

24 24 Review The ADT ______ allows you to insert into, delete from, and inspect the item at any position of the ADT. stack queue List array

25 25 Review The enqueue operation of the ADT queue is similar to the ______ operation of the ADT stack. isEmpty peek push pop

26 26 Review Which of the following is an operation of the ADT list? pop dequeue peek remove


Download ppt "CS2007 - Data Structures II Review. 2 When you declare a variable that refers to an object of a given class, you are creating a(n) ______ to the object."

Similar presentations


Ads by Google