1. In the Towers of Hanoi puzzle there are __________________ disks of different
ID: 3855454 • Letter: 1
Question
1. In the Towers of Hanoi puzzle there are __________________ disks of different diameters.
a) 2
b) 3
c) 4
d)5
e) The Towers of Hanoi puzzle can include any number of disks of different diameters.
2. __________________ recursion results from the lack of a base case.
a) Indirect
b) Direct
c) Infinite
d) Spiral
e) none of the above
3. Suppose we would like to declare a generic type Group that only allows types that implement the Comparable interface. Which of the following declarations correctly declares such a class?
a) class Group<Comparable>
b) class Group<T(Comparable)>
c) class Group <T instanceof Comparable>
d) class Group<T extends Comparable <T>>
e) class Group<T>
4. A(n) ___________________ is an object that serves as a repository for other objects.
a) set
b) collection
c) class
d) interface
e) none of the above
5. A nonlinear collection is one in which the elements are stored in a straight line.
a) True
b) False
6. If you want to store non-duplicated objects in the order in which they are inserted, you should use ____________.
c) HashSet
d) LinkedHashSet
e) TreeSet
f) ArrayList
g) LinkedList
Explanation / Answer
1) e) The Towers of Hanoi puzzle can include any number of disks of different diameters.
2) c) Infinite - this type of recusion can only be caused because of lack of base case i.e., recursion is performed coniunously without ending
3) d) class Group<T extends Comparable <T>>
4) b) collection - these are the objects which can be stored to groups of other types of objects.
5) b) False - linear collection only store the elements in straight line.
6) d) LinkedHashSet - Treeset,Linked hashset and Hashset all three are store non duplicate objects but LinkedHash set only store the elements in the order they have inseted.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.