Q18. Private members of a superclass can be accessed by a subclass. a. true b. false
Q19. If in the heading of a catch block you declare an exception using the class Exception, then that catch block can catch all types of exceptions because the class Exception is the superclass of all exception classes. a. true b. false
Q20. A checked exception is any exception checked for by the programmer. a. true b. false
Q21. The method clone in the class Vector returns a copy of the vector. a. true b. false
Q22. There is a method in the class Vector that removes all elements of the vector. a. true b. false
Q23. The class Vector is contained in the package java.swing. a. true b. false
Q24. Which package is the class Vector located? a. java.io b. java.lang c. java.util d. java.text
Q25. Which of the following methods copies the elements of a vector into an array? a. clone b. copyInto c. toArray d. fromVector
Q26. The method ____ removes the elements from the list, leaving it empty. a. deleteElements b. removeAt c. clearList d. deleteList
Q27. A Vector object can shrink during program execution. a. true b. false
Q28. The elements of an object of the class UnorderedArrayList are always sorted. a. true b. false
Q29. Which method would you most likely use to find the element in the last location of the vector? a. lastElement b. elementAt c. indexOf d. lastIndexOf
Q30. Which limitation of arrays does a vector overcome? a. arrays cannot increase in size, vectors can b. arrays cannot be passed as parameters to methods, vectors can c. arrays cannot be searched, vectors can d. there is a method that returns the length of a vector, there is no way to find the length of an array
exception is subclass of ____ class
Q31. A linked list in which the last node points to the first node is called a circular linked list. a. true b. false
Q32. Header and trailer nodes can complicate insertion and deletion algorithms. a. true b. false
Q33. Which answer most accurately completes the following sentence: A linked list is made up of ____. a. classes b. nodes c. addresses d. memory variables
Q34. Linked lists built forward or backward are identical in every way. a. true b. false
Q35. while(current!=null) current=head.link; The above statement traverses a linked list. a. true b. false
Q36. In the class LinkedListClass, the search method is declared as ____. a. public b. private c. abstract d. protected Q37. In an ordered list, we need to modify only the algorithms (as implemented for a regular linked list) for the ____, insert, and delete operations. a. copy b. compare c. traverse d. search
Q38. Which of the following should be used to traverse a list? a. the head of the list b. the tail of the list c. a reference variable not in the list d. any node in the list
Q39. Searching, inserting, and deleting require traversal of the linked list. a. true b. false
Q40. Searching through a linked list or inserting an item in a linked list requires a ____ of the list. a. review b. deletion c. copy d. traversal
Q41. private int func3(int m, int n) { if (m < n) return 0; else return 1 + func3(m-n, n); } Refer to the code above. What is the value of func3(-5, 1)? a. -5 b. 0 c. 1 d. 5
exception is subclass of ____ class
Q42. The overhead associated with iterative methods is greater in terms of both memory space and computer time, when compared to the overhead associated with executing recursive methods. a. true b. false
Q43. private int func2(int m, int n) { if (n == 0) return 0; else return m + func2(m, n-1); } Which of the following statements about the code above is always true? a. func2(m,n) = func2(n, m) for m >= 0 b. func2(m,n) = m * n for n >=0 c. func2(m,n) = m + n for n >=0 d. func2(m, n) = n * m for n >=0
Q44. A method is called directly recursive if it calls another recursive method. a. true b. false
Q45. Recursion starts with the base case. a. true b. false
Q46. public static int exampleRecursion (int n) { if (n==0) return 0; else return exampleRecursion(n-1) + n*n*n; } Refer to the code above. What is the output of exampleRecursion(0)? a. 0 b. 3 c. 9 d. 27
Q47. In the base case, the solution is obtained through a call to a smaller version of the original method. a. true b. false
Q48. In reality, if you execute an infinite recursive method on a computer it will execute forever. a. true b. false
Q49. Every recursion definition must have zero or more base cases. a. true b. false
Q50. private int func1(int m, int n) { if (m==n || n==1) return 1; else return func1(m-1,n-1) + n*func1(m-1,n); } What precondition must exist in order to prevent the code above from infinite recursion? a. m > = 0 and n >= 0 b. m >= 0 and n >= 1 c. m >= 1 and n >= 0 d. m >= 1 and n >= 1