Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please do all the multiple choice question without any explanation, just give me

ID: 3583021 • Letter: P

Question

Please do all the multiple choice question without any explanation, just give me the right choice

1- Each of the following are characteristics of an abstract class, EXCEPT:

a) They typically provide partial implementations of a class (that is, some methods are implemented and some methods are not)

b) They often set private variables to default values (to alleviate this work in subclasses that can use the default values).

c ) They cannot be actually programmed (They can be represented in UML diagrams, but they cannot be written in Java programming code)           

d) They often have abstract methods that are similar to interface methods in that there is no method implementation defined in the abstract class and subclasses must provide the implementation.

2- Each of the following is true about multiple inheritance in Java, EXCEPT

a) Currently, Java does not allow you to write something like this:

public class MySubClass extends MySuperClass1, MySuperClass2

b) Java SE 8 allows interfaces to have default implementations; and since classes can implement multiple interfaces, you have something similar to multiple inheritance in Java SE 8

c) Your textbook and several websites will indicate that Java supports single inheritance, rather than multiple inheritance

d) There is no way for a class to obtain method implementations from multiple sources (whether superclasses or interfaces)

3- Each of the following is true about polymorphism, EXCEPT

a) Polymorphism allows a single class to have multiple implementations of the same method with the same method signature

b) Polymorphism allows developers to assign objects to variables with compatible types/classes    

c) Polymorphism allows interfaces and superclasses to be used as method parameters types           

d) Polymorphism allows interfaces and superclasses to be used as method return types

4- Each of the following are legal assignments, EXCEPT:

a) //assume MyClass extends MySuperClass and both have default constructors

MyClass obj = (MyClass)(new MySuperClass());        

b) //assume MyClass implements MyInterface and has default constructor

MyInterface obj = new MyClass();

c) //assume MyClass implements MyInterface and has default constructor

MyClass obj = new MyInterface();

d) // assume MyClass extends MySuperClass and both have default constructors

MySuperClass obj = new MyClass(); (which would otherwise be private)

5) When you use a polymorphic reference, the specific implementation of a method is determined at runtime. This is called...

a) final (formal) resolution              

b) method instantiation

c) late (dynamic) binding

d) early (static) binding

6- A class that has a method (typically static) that returns an object of a specific class using a polymorphic reference is called:       

a) final class

b) polymorphic class          

c) abstract class

d) factory class.

7- Each of the following are true of generics, EXCEPT:

a) You can define generics by adding one or more type parameters (e.g., <T>) to the class/type definition              

b) If type parameter is defined in a superclass, it must be resolved to a specific type in any subclass

c) Generics are really only useful if you include the type parameter somewhere in the methods of your class      

d) Generics can sometimes help you avoid making casts or using the Object class type in your code

8- Each of the following are commonalities among Bubble Sort, Insertion Sort, and Selection Sort, EXCEPT:        

a) All three algorithms have sorted sections that never change.

b) All three algorithms can do in-place sorting involving just one array and a temp variable for swapping or shifting of items           

c) All three algorithms can sort arrays of values (for example, Comparable[])     

d) All three algorithms can be implemented with an outer loop (that loops over n-1 items) and an inner loop (that loops over a subset of the array)

Please do all the multiple choice question without any explanation, just give me the right choice

a) They typically provide partial implementations of a class (that is, some methods are implemented and some methods are not)

b) They often set private variables to default values (to alleviate this work in subclasses that can use the default values).

c ) They cannot be actually programmed (They can be represented in UML diagrams, but they cannot be written in Java programming code)           

d) They often have abstract methods that are similar to interface methods in that there is no method implementation defined in the abstract class and subclasses must provide the implementation.

2- Each of the following is true about multiple inheritance in Java, EXCEPT

a) Currently, Java does not allow you to write something like this:

public class MySubClass extends MySuperClass1, MySuperClass2

b) Java SE 8 allows interfaces to have default implementations; and since classes can implement multiple interfaces, you have something similar to multiple inheritance in Java SE 8

c) Your textbook and several websites will indicate that Java supports single inheritance, rather than multiple inheritance

d) There is no way for a class to obtain method implementations from multiple sources (whether superclasses or interfaces)

3- Each of the following is true about polymorphism, EXCEPT

a) Polymorphism allows a single class to have multiple implementations of the same method with the same method signature

b) Polymorphism allows developers to assign objects to variables with compatible types/classes    

c) Polymorphism allows interfaces and superclasses to be used as method parameters types           

d) Polymorphism allows interfaces and superclasses to be used as method return types

4- Each of the following are legal assignments, EXCEPT:

a) //assume MyClass extends MySuperClass and both have default constructors

MyClass obj = (MyClass)(new MySuperClass());        

b) //assume MyClass implements MyInterface and has default constructor

MyInterface obj = new MyClass();

c) //assume MyClass implements MyInterface and has default constructor

MyClass obj = new MyInterface();

d) // assume MyClass extends MySuperClass and both have default constructors

MySuperClass obj = new MyClass(); (which would otherwise be private)

5) When you use a polymorphic reference, the specific implementation of a method is determined at runtime. This is called...

a) final (formal) resolution              

b) method instantiation

c) late (dynamic) binding

d) early (static) binding

6- A class that has a method (typically static) that returns an object of a specific class using a polymorphic reference is called:       

a) final class

b) polymorphic class          

c) abstract class

d) factory class.

7- Each of the following are true of generics, EXCEPT:

a) You can define generics by adding one or more type parameters (e.g., <T>) to the class/type definition              

b) If type parameter is defined in a superclass, it must be resolved to a specific type in any subclass

c) Generics are really only useful if you include the type parameter somewhere in the methods of your class      

d) Generics can sometimes help you avoid making casts or using the Object class type in your code

8- Each of the following are commonalities among Bubble Sort, Insertion Sort, and Selection Sort, EXCEPT:        

a) All three algorithms have sorted sections that never change.

b) All three algorithms can do in-place sorting involving just one array and a temp variable for swapping or shifting of items           

c) All three algorithms can sort arrays of values (for example, Comparable[])     

d) All three algorithms can be implemented with an outer loop (that loops over n-1 items) and an inner loop (that loops over a subset of the array)

Please do all the multiple choice question without any explanation, just give me the right choice

Explanation / Answer

Answer1:

c ) They cannot be actually programmed (They can be represented in UML diagrams, but they cannot be written in Java programming code)

Answer2:

Java SE 8 allows interfaces to have default implementations; and since classes can implement multiple interfaces, you have something similar to multiple inheritance in Java SE 8

Answer3:

(a) Polymorphism allows a single class to have multiple implementations of the same method with the same method signature

Answer4:

d) MySuperClass obj = new MyClass();

Answer5:

c) late (dynamic) binding

Answer6:

d) factory class.

Answer7:

c) Generics are really only useful if you include the type parameter somewhere in the methods of your class

Answer8:

d) All three algorithms can be implemented with an outer loop (that loops over n-1 items) and an inner loop (that loops over a subset of the array)