11. All of the following are a part of refactoring except: ______
A. Detection of the problem
B. Improving the design of existing code without changing its observable behavior.
C. Redesign of the user interface.
D. Improving performance of the code.
C. Redesign of the user interface.
22. Which statement is not true regarding an object in Java? ______
A. An object is instantiated from a class.
B. An object must implement the Comparable interface.
C. Static methods in a class cannot access the non-static instance parameters.
D. An object variable contains a reference to an actual object.
B. An object must implement the Comparable interface.
33. According to Robert Martin identifiers in your code should exhibit all of the following except: ______
A. They should be camelback in format, always starting lower case..
B. They should be self-explanatory.
C. They should exhibit meaningful distinctions.
D. They should be pronounceable.
A. They should be camelback in format, always starting lower case.
44. Which statement is not true about inheritance. ______
A. Parent class method method1 return type is Class A and child class of Parent class overrides the method method1 and can change the return type from Class A to Class B (B is the subclass of A)
B. A child class can use covariant return types in case of method overriding.
C. Covariant return types can be used in case of method overloading.
D. Method parameters ordering can change in overriding.
C. Covariant return types can be used in case of method overloading.
55. Which statement(s) is true about subclasses? Pick one or more letters ______
A. We can override Constructors.
B. We can override static methods.
C. We can override abstract methods.
D. We can overload abstract methods.
C. We can override abstract methods.
D. We can overload abstract methods.
66. Which of the following is an incorrect statement regarding the use of generics and parameterized types in Java? ______
A. Generics provide type safety by shifting more type checking responsibilities to the compiler.
B. Generics and parameterized types eliminate the need for downcasting when using Java Collections
C. Once a generic class is defined you do not need to worry about using raw data types
D. All of the above
C. Once a generic class is defined you do not need to worry about using raw data types
77. Which inheritance in java programming is not supported? ______
A. Multiple inheritance using classes
B. Multiple inheritance using interfaces
C. Single inheritance
D. Multilevel (tiered) inheritance
A. Multiple inheritance using classes
88. What is the following code snippet an example of: ______
<? extends Integer>
A. bounded type
B. generic type
C. upper bounded wildcard type
D. lower bounded wildcard type
C. upper bounded wildcard type
99. Which of these is not an interface in the Collections Framework? ______
A. Set
B. List
C. Group
D. Collection
C. Group
1010. Which of these data type cannot be type parameterized? ______
A. Set
B. Map
C. List
D. Array
D. Array
1111. For the below Test class which of the following way of object creation is invalid? ______
class Test<T extends Number> { }
A. Test<Integer> t1 = new Test<Integer>();
B. Test<String> t2 = new Test<String>();
C. Test<Double> t3 = new Test<Double>();
D. Test<Number> t4 = new Test<Number>();
B. Test<String> t2 = new Test<String>();
1212. If we had a scenario where we only want a method to work on an Integer type but not a Double type which of the following headers would work? (pick one or more) ________
A. public static void wildMethod( List<? super Integer> list)
B. public static void wildMethod( List<? extends Integer> list)
C. public static void wildMethod( List<? super Number> list)
D. public static void wildMethod( List<? extends Number> list)
A. public static void wildMethod( List<? super Integer> list)
B. public static void wildMethod( List<? extends Integer> list)
1313. Based on the class definition below, what can be inferred about the following class B: ______
public class B<T extends A> {...}
A. Class T extends B.
B. B is a bounded parameterized type restricted to be of type T which is of type A or a subclass of A.
C. T is a bounded parameterized type restricted to be of type A or a subclass of A.
D. Class B extends A.
C. T is a bounded parameterized type restricted to be of type A or a subclass of A.
14Given the following definitions, which assignments are legal? ______
class Box<T>{}
class SuperBox<T> extends Box<T>{}
I. Box<String> b = new SuperBox<String>();
II. Box<Object> b = new Box<String>();
III Box<Object> b = new SuperBox<String>();
A. I only
B. II only
C. I and III
D. I, II, and III
A. I only
1515. A superclass reference cannot be used to invoke a method or variable unique to the subclass. __________
True
1616. If you do not implement a default method one will always be created for you in any class. __________
False
1717. Static methods of a class can use the Type parameters of the class in which they are found. __________
False
1818. Every Collection class is generic? _____
True