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: 3583015 • Letter: P

Question

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

1-All of the following are synonyms (equivalent terms) of each other, EXCEPT

a) derived class

b) child class

c ) subclass

d) base class

2-In the context of inheritance, what can the protected modifier be used for?

a) protecting private variables and methods from being extended by superclasses

b) protecting private variables and methods from being extended by superclasses

c) providing subclasses access to protected variables and methods in superclasses (while preventing access outside of the object hierarchy)

d) providing interfaces and abstract methods with access to protected variables and protected methods (which would otherwise be private)

3- Each of the following is true about super, EXCEPT:

a) all superclasses, except Object, can call super()       

b) super is a reference in a child class to the parent class instance           

c) interfaces can call super()             

d) super() is typically called before anything else in the child class constructor.

4- In the context of inheritance, what can the protected modifier be used for?              

A)protecting private variables and methods from being extended by superclasses              

b) protecting private variables and methods from being extended by superclasses              

c) providing subclasses access to protected variables and methods in superclasses (while preventing access outside of the object hierarchy)          

d)providing interfaces and abstract methods with access to protected variables and protected methods (which would otherwise be private)

5) Each of the following is true about super, EXCEPT:              

a) all superclasses, except Object, can call super()       

b)super is a reference in a child class to the parent class instance            

c)interfaces can call super()              

d) super() is typically called before anything else in the child class constructor

6- When applied to a method, the final modifier ...           

a) Restricts the method implementation so that it cannot modify the value of any input parameters                  

b) Prevents a subclass from overriding the method's implementation     

c) Prevents a subclass from duplicating the method's implementation in another method                 

d)Prevents a subclass from overloading a method.

7- What does shadowing mean?  

a) "overriding" variables in a child class         

b) creating a shallow clone of an object (top-level data only)  

c)creating a deep clone of an object (all data, however nested)               

d) when a child class method "learns" its implementation from a parent class method by following its execution around a program

8- Each of the following are good reasons to override the toString() method inherited from Object, EXCEPT:              

a) You want to use toString to generate a JSON representation of an object         

b) You want to use toString for unit testing purposes                  

c) You want to use toString to capture the state of the object's variables in a single string                  

d) You want to include the Object's hashcode in the return value of the object

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

a) derived class

b) child class

c ) subclass

d) base class

2-In the context of inheritance, what can the protected modifier be used for?

a) protecting private variables and methods from being extended by superclasses

b) protecting private variables and methods from being extended by superclasses

c) providing subclasses access to protected variables and methods in superclasses (while preventing access outside of the object hierarchy)

d) providing interfaces and abstract methods with access to protected variables and protected methods (which would otherwise be private)

3- Each of the following is true about super, EXCEPT:

a) all superclasses, except Object, can call super()       

b) super is a reference in a child class to the parent class instance           

c) interfaces can call super()             

d) super() is typically called before anything else in the child class constructor.

4- In the context of inheritance, what can the protected modifier be used for?              

A)protecting private variables and methods from being extended by superclasses              

b) protecting private variables and methods from being extended by superclasses              

c) providing subclasses access to protected variables and methods in superclasses (while preventing access outside of the object hierarchy)          

d)providing interfaces and abstract methods with access to protected variables and protected methods (which would otherwise be private)

5) Each of the following is true about super, EXCEPT:              

a) all superclasses, except Object, can call super()       

b)super is a reference in a child class to the parent class instance            

c)interfaces can call super()              

d) super() is typically called before anything else in the child class constructor

6- When applied to a method, the final modifier ...           

a) Restricts the method implementation so that it cannot modify the value of any input parameters                  

b) Prevents a subclass from overriding the method's implementation     

c) Prevents a subclass from duplicating the method's implementation in another method                 

d)Prevents a subclass from overloading a method.

7- What does shadowing mean?  

a) "overriding" variables in a child class         

b) creating a shallow clone of an object (top-level data only)  

c)creating a deep clone of an object (all data, however nested)               

d) when a child class method "learns" its implementation from a parent class method by following its execution around a program

8- Each of the following are good reasons to override the toString() method inherited from Object, EXCEPT:              

a) You want to use toString to generate a JSON representation of an object         

b) You want to use toString for unit testing purposes                  

c) You want to use toString to capture the state of the object's variables in a single string                  

d) You want to include the Object's hashcode in the return value of the object

Explanation / Answer

Answer1:

(D) Base class

Answer2:

(C)providing subclasses access to protected variables and methods in superclasses (while preventing access outside of the object hierarchy)

Answer3:

(C)interfaces can call super()   

Answe4:

(C)providing subclasses access to protected variables and methods in superclasses (while preventing access outside of the object hierarchy)

Answer5:

(C)interfaces can call super()

Answer6:

Prevents a subclass from overriding the method's implementation   

Answer7:

b) creating a shallow clone of an object (top-level data only)  

c)creating a deep clone of an object (all data, however nested)

Answer8:

d) You want to include the Object's hashcode in the return value of the object