Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let's assume that for some unknown reason, the LinkedList class that you are implementing does not have a data field that keeps track of the
Let's assume that for some unknown reason, the LinkedList class that you are implementing does not have a data field that keeps track of the number of nodes. You wrote a member function called size() that computes and returns the number of elements stored in the list, but one line is still incomplete. You can assume that there are head and tail data fields pointing to the first and last node respectively or to null if the list is empty. int size () { Node current = head; int counter = 0; while ( ) { counter++; current = current.next; } return counter; } Mark all the statements that could be used to replace the blank. current == tail current == null current != null O current.next != null current != tail current.next != tail Consider the following array used as an internal storage for an array-based list implementation. The array's capacity is 10 and the current size is 7. | 32 | 56 | 23 | 98 | 77 | 93 | 17 | 1 | How many elements need to be moved, when we add a new value at position 2 (remember that arrays' indexing starts at 0). 0 0 1 2 3 4 5 6 7 What is the output of the following code fragment assuming that the code block A does not cause any exceptions, and code block B throws an instance of a NullPointerException? /* * code block A */ try { /* * code block B */ throw new IllegalArgumentException(); { catch(IllegalArgumentException e) System.out.print("illegal "); } catch(Exception d) { System.out.print("exception "); System.out.print("after"); illegal illegal exception O illegal after illegal exception after exception exception after after none of the above Assume that an object of class Circle occupies 64 bytes in memory. A reference variable occupies 8 bytes in memory. How many bytes are allocated in memory when the following lines of code is executed? Circle [] mycircleList new Circle [10]; for (int i = 0; i p.next.data) return false; p = p.next; } return true; } If f is called with a head reference of a linked list, it returns true if ... not all elements in the list have the same value of data the elements in the list are sorted in a non-decreasing order (from smallest to largest, but some values could be equal) the elements in the list are sorted in a non-increasing order (from largest to smallest, but some values could be equal) none of the above
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started