The index passed to is negative or greater than the size of the list
The index passed to it is negative or greater or equal to the size of the list
the index passed to it non negative
The index passed to it is negative
D. All of these
Arrays have a fixed size and cannot grow to accommodate more elements
An array keeps track of its length while an ArrayList does not track comparable information
An ArrayList uses a LinkedList to hold its elements, an array does not.
IllegalStateException
NullPointerException
IllegalArgumentException
RuntimeException
You can use array subscript notation to work with the ArrayList
You can pass it as a parameter to any method that expects an array
It is implemented as a class that uses an internal array to hold the elements of the list
All of these
The elements at current positions k..s must be moved toward the end of the array
The element at position k is overwritten
The elements at current positions 0..k must be moved toward the beginning of the list
The elements at current positions k..s-1 must be moved toward the end of the array
Uses sequential search to locate the element
Returns 0 if the element is not found in the list
Uses binary search to locate the element
Throws an exception if the element is not found in the list
Adds an object to a list and returns the index of the newly added object
Uses binary search to locate the given object, and then returns its index
Searches a list for the occurrence of an object and returns its index
None of these
None of these
Is the length of its internal array
Is the number of elements that are currently stored in the list
Is the number of bytes of memory that the list can hold
Is the number of bytes of memory that the list can hold
is the size of its internal array
Is the number of elements that are currently stored in the list
None of these
the recursive method should still handle the base case of an empty list, because it will still occur even though the scientists never ask for the size of an empty list and the recursive method can be modified to use a list of size 1 as the base case are both correct
The recursive method can become more efficient by eliminating the test for a base case
The recursive method should still handle the base case of an empty list, because it will still occur even though the scientists never ask for the size of an empty list
the recursive method can be modified to use a list of size 1 as the base case
A stack
A queue
A linked list
An array based collection
Peek
Pop
Push
Spy
None of the above
It calls the stack empty
It throws an emptystackexception
It adds it argument to the stack
True
False
If (isEmpty()) return true; else return false;
Return first == null;
Return null;
First = null; return first;
Linked allocation
Contiguous allocation
Capacity allocation
Fixed size allocation
Elements
Memory modules
Nodes
Memory modules
Linked allocation
If you remove the head of the list, what remains is also a list
Contiguous allocation
A list can be considered a recursive data structure because
A field to store the element, and two references to keep track of two predecessor nodes, and a reference to keep track of the end of the list
Either one of a field to store the element, and two references to keep track of two successor nodes, and a reference to keep track of the start of the list or a field to store the element, and two references to keep track of two predecessor nodes, and a reference to keep track of the end of the list
a field to store the element, and two references to keep track of successor and predecessor nodes
a field to store the element, and two references to keep track of two successor nodes, and a reference to keep track of the start of the list
A list can be considered a recursive data structure because
None of these: only methods can be considered recursive.
List objects are instances of list classes
if you remove the head of the list, what remains is also a list
It is necessary to modify the class that represents nodes, by adding a reference needed to support recursion
the class that represents nodes must implement the Repeatable interface
No changes to the node class are necessary
it is necessary to modify the class that represents nodes, by adding a reference needed to support recursion and the class that represents nodes must implement the Repeatable interface are both true
assign the successor reference in the node with index k to the successor reference in the node with index k-1
Start a reference r at the head of the list, walk r forward k steps, and then set r to null
Decrement k by 1, and then use recursion
Decrement k by 1, and set the reference to the node to be removed to null
Associates keys with elements
None of the above
Assigns an index to each of its elements
Is implemented by the JList class
Ref.next = new node (e, ref.next);
Ref = new node(e, ref.next);
Add(ref);
Ref.next = new node(e);
A travesty of list processing
A traversal
A walk down the list
A list processing function
Has no successor
Has exactly two successors
Has at most two successors
Has one successor
True
False
True
False
None of the above
A kind of heap
A king of priority queue
A kind of binary search tree
True
False
Neither
True
False