By convention, a class diagram contains the ____ following each attribute or method.

The following solution is suggested to handle the subject “[1]     ____ is the principle that allows you to apply your knowledge of a general category…“. Let’s keep an eye on the content below!

Question “[1]     ____ is the principle that allows you to apply your knowledge of a general category…”

[1]     ____ is the principle
that allows you to apply your knowledge of a general category to
more specific objects.

         

a.      
Inheritance

          c.       Encapsulation

         

b.      
Polymorphism

          d.       Override

[2]     When you create a
class by making it inherit from another class, you are provided
with data fields and ____ automatically.

[3]     By convention, a class
diagram contains the ____ following each attribute or method.

         

a.       data
field

          c.       data type

[4]     Conventionally, arrows
used in a ____ to show inheritance relationships extend from the
descendant class and point to the one from which it descends.

         
a.       method
diagram      
c.       virtual method call

         

b.       UML diagram

          d.       composition

[5]     The ability to use
inheritance in Java makes programs easier to write, ____ , and more
quickly understood.

         

b.       more secure

          d.       less error prone

[6]     The class used as a
basis for inheritance is the ____ class.

[7]     You use the keyword
____ to achieve inheritance in Java.

[8]     Sometimes the
superclass data fields and methods are not entirely appropriate for
the subclass objects; in these cases, you want to ____ the parent
class members.

[9]     If a programming
language does not support ____ , the language is not considered
object – oriented.

         

b.      
applets

                   d.       polymorphism

[10]   ____
polymorphism is the ability of one method name to work
appropriately for different subclass objects of the same parent
class.

[11]   When
you create a class and do not provide a[n] ____ , Java
automatically supplies you with a default one.

         

a.      
constructor   
b.      
argument      
c.       header

         d.       name

[12]  
Usually, the subclass constructor only needs to initialize the ____
that are specific to the subclass.

         

b.       data
fields

          d.       constructors

[13]   When
you employ ____ , your data can be altered only by the methods you
choose and only in ways that you can control.

         
a.       virtual method
calls   c.      
information hiding

         

b.      
polymorphism

          d.       inlining

[14]  
Using the keyword ____ provides you with an intermediate level of
security between public and private access.

         

a.      
protected     
b.       this

          c.      
super           
d.       secure

[15]   The
methods in a subclass can use all of the data fields and methods
that belong to its parent, with one exception: ____ members of the
parent class are not accessible within a child class’s methods.

         

a.       private

          b.       public

          c.      
protected     
d.       final

[16]   You
can use the ____ modifier with methods when you do not want the
method to be overridden.

         

a.      
override       
b.       access

          c.      
final             
d.       end

[17]  
Which of the following statements will create a class named Red
that is based on the class Color ?

         
a.       public class Red extends
Color         

         
b.       public Red class extends
Color

         
c.       public Color class expands
Red

         
d.       public extend Red class
Color

[18]  
Which of the following statements depicts the valid format to call
a superclass constructor from a subclass constructor?

         
a.       superclass[name,
score];    
c.       extends[name, score];

         
b.       subclass[name,
score];      
d.       super[name, score];

[19]   If
jrStudent is an object of Student, which of the following
statements will result in a value of true?

         
a.       Student = instanceof
jrStudent         

         
b.       jrStudent instanceof
Student  
         

         
c.       instanceof Student =
jrStudent

         
d.       Student instanceof
jrStudent

[20]  
Which statement correctly declares a sedan object of the Car
class?

         
a.       sedan Car = new
sedan[];         
c.       Car sedan = new Car[];

b.      
sedan Car = new
sedan[];         
d.       new sedan[] = Student;

Answer

Answer 1

1] Inheritance

2] Methods

3] Data type

9] Polymorphism

10] Subtype

11] Constructor

12] data fields

13] Information hiding

14] Protected

15] Private

16] Final

17] Red extends Color to public class

18] super[name, score];

19] jrStudent exampleof Student

20] Car sedan = new Car[];

Answer 2

1. Option a. Inheritance allows you to apply what you know about a particular category to specific objects.

2. Option b. Methods

When you create a new class, or make it inherit from another one, the methods and data fields will automatically be inherited.

3. Option c. Data type

A class diagram shows the data type that follows each method or attribute.

4. Option b. UML diagram

The arrows in UML diagram are used to show inheritance relations. They point to the descendant class from which they descend and extend to the descendant.

5. Option d. less error prone

Java’s inheritance feature makes it easier to create programs, reduces error rates, and is easier to understand.

6. Option c. Base class

The base class is the class that serves as a basis to inheritance.

7. Option b. Extend

To achieve inheritance in Java, the keyword extends can be used.

8. Option c. Override

Sometimes, the superclass methods and data fields are not appropriate for subclass objects. In these cases you will want to override parent class members.

9. Option d. polymorphism

A programming language that does not support polymorphism is not object-oriented.

10. Option c. Subtype

Subtype polymorphism refers to the ability for one method name that works correctly for multiple subclass objects of the parent class.

11. Option a. constructor

Java provides a default constructor when you create a class that does not require it.

12. Option b. data fields

Only the subclass constructor needs to initialize data fields specific to the subclass.

13. Option c. Information hiding

Information hiding is a method that allows data to be altered using only the methods you choose, and only in ways you control.

14. Option a. Protected

You can use the protected keyword to provide an intermediate level between private and public access.

15. Option a. private

A child class cannot access the private members of the parent classes.

16. Option c. Final

When you don’t want the method to be ignored, the final is used.

17. Option a. Red extends Color

Here, Color is the base and Red the child classes.

18. Option a. superclass [name, score];

19. Option b. jrStudent instanceof Students

20. Option c. Car sedan = new Car[];

Conclusion

Above is the solution for “[1]     ____ is the principle that allows you to apply your knowledge of a general category…“. We hope that you find a good answer and gain the knowledge about this topic of engineering.


What keyword is used to indicate that the class acquires the attributes and behavior of another class?

The extends keyword in Java indicates that the child class inherits or acquires all the properties of the parent class. This keyword basically establishes a relationship of an inheritance among classes.

When you create parent and child classes of your own the child classes use ____ constructors?

When you instantiate any object, you call its constructor and the Objects constructor and when you create parent and child classes of your own, the child classes use three constructors.

Is the process of acquiring fields and methods of a parent class or super class?

Inheritance is the procedure in which one class inherits the attributes and methods of another class. The class whose properties and methods are inherited is known as the Parent class. And the class that inherits the properties from the parent class is the Child class.

What keyword is used when a child derived class want to access or call function or properties of its parent base ]?

The base keyword is used to access members of the base class from within a derived class: Call a method on the base class that has been overridden by another method.

Chủ Đề