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.

          a.       fonts                      c.       class names

          b.       methods                  d.       arrays

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

          a.       data field                 c.       data type

          b.       argument                 d.       class

(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.

          a.       faster                    c.       more robust

          b.       more secure             d.       less error prone

(6)     The class used as a basis for inheritance is the ____ class.

          a.       child                       c.       base

          b.       extends                   d.       derived

(7)     You use the keyword ____ to achieve inheritance in Java.

          a.       inherit                    c.       super

          b.       extends                   d.       public

(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.

          a.       negate                    c.       override

          b.       overrule                  d.       hide

(9)     If a programming language does not support ____ , the language is not considered object - oriented.

          a.       syntax                    c.       loops

          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.

          a.       Subtype                  c.       Supertype

          b.       Name                    d.       Override

(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.

          a.       objects                            c.       methods

          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;

0 0
Add a comment Improve this question Transcribed image text
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) public class Red extends Color

18) super(name, score);

19) jrStudent instanceof Student

20) Car sedan = new Car();

Add a comment
Answer #2

1. Option a. Inheritance is the principle that allows you to apply your knowledge of a general category to more specific objects.

2. Option b. methods

The methods and data fields are automatically inherited when you create a class by making it inherit from another class.

3. Option c. data type

A class diagram contains the data type following each attribute or method.

4. Option b. UML diagram

In UML diagram, the arrows are used to show inheritance relationships extend from the descendant class and point to the one from which it descends.

5. Option d. less error prone

The ability to use inheritance in Java makes programs easier to write, less error prone, and more quickly understood.

6. Option c. base class

The class used as a basis for inheritance is the base class.

7. Option b. extend

The keyword extends is used to achieve the inheritance in java.

8. Option c. override

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

9. Option d. polymorphism

If a programming language does not support polymorphism, the language is not considered object - oriented.

10. Option c. Subtype

Subtype polymorphism is the ability of one method name to work appropriately for different subclass objects of the same parent class.

11. Option a. constructor   

Java automatically supplies you with a default constructor, when creating a class without the constructor.

12. Option b. data fields

The subclass constructor only needs to initialize the data fields that are specific to the subclass.

13. Option c. information hiding

In information hiding, data can be altered only by the methods you choose and only in ways that you can control.

14. Option a. protected

The protected keyword provides you with an intermediate level of security between public and private access.

15. Option a. private

The private members of the parent class are not accessible within a child class’s methods.

16. Option c. final

The final is used for the modifier with methods when you do not want the method to be overridden.

17. Option a. public class Red extends Color

Here Color is the base class and Red the child class.

18. Option a. superclass(name, score);

19. Option b. jrStudent instanceof Student

20. Option c. Car sedan = new Car();

Add a comment
Know the answer?
Add Answer to:
(1)     ____ is the principle that allows you to apply your knowledge of a general category...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can someone please help with this in JAVA? Write one application program by using the following...

    Can someone please help with this in JAVA? Write one application program by using the following requirements: 1) Exception handling 2) Inheritance a) At least one superclass or abstract superclass: this class needs to have data members, accessor, mutator, and toString methods b) At least one subclass: this class also needs to have data members, accessor, mutator, and toString methods c) At least one interface: this interface needs to have at least two abstract methods d) At least one method...

  • In Java Which of the following statements declares Salaried as a subclass of payType? Public class...

    In Java Which of the following statements declares Salaried as a subclass of payType? Public class Salaried implements PayType Public class Salaried derivedFrom(payType) Public class PayType derives Salaried Public class Salaried extends PayType If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method. False True When a subclass overloads a superclass method………. Only the subclass method may be called with a subclass object Only the superclass method...

  • I need help for part B and C 1) Create a new project in NetBeans called...

    I need help for part B and C 1) Create a new project in NetBeans called Lab6Inheritance. Add a new Java class to the project called Person. 2) The UML class diagram for Person is as follows: Person - name: String - id: int + Person( String name, int id) + getName(): String + getido: int + display(): void 3) Add fields to Person class. 4) Add the constructor and the getters to person class. 5) Add the display() method,...

  • What is the code for this in Java? Assignment Inheritance Learning Objectives Declare a subclass that...

    What is the code for this in Java? Assignment Inheritance Learning Objectives Declare a subclass that derives from a superclas:s ■ Demon "Declare a variable of the superclass type and assign it an instance of the subclass type strate polymorphic behavior Access the public members of the superclass type Notice how the overridden versions of the subclass type are called Notice how the subclass specific members are inaccessible "Create an array of superclass type and use a foreach loop to...

  • 44 A method signature defines which of the following? (choose all that apply) return type name...

    44 A method signature defines which of the following? (choose all that apply) return type name call parameters body 45 An abstract class can be implemented using the implements keyword. True False 46 An abstract class can be extended using the extends keyword. True False 47 Abstract classes are represented in UML by: italics underline plus/minus bold 48 An abstract class is a superclass for a subclass. True False 49 These symbols are used to denote an interface in a...

  • In JAVA, please In this module, you will combine your knowledge of class objects, inheritance and...

    In JAVA, please In this module, you will combine your knowledge of class objects, inheritance and linked lists. You will need to first create an object class encapsulating a Trivia Game which INHERITS from Game. Game is the parent class with the following attributes: 1. description - which is a string 2. write the constructor, accessor, mutator and toString methods. Trivia is the subclass of Game with the additional attributes: 1. trivia game id - integer 2. ultimate prize money...

  • 1. Employees and overriding a class method The Java program (check below) utilizes a superclass named...

    1. Employees and overriding a class method The Java program (check below) utilizes a superclass named EmployeePerson (check below) and two derived classes, EmployeeManager (check below) and EmployeeStaff (check below), each of which extends the EmployeePerson class. The main program creates objects of type EmployeeManager and EmployeeStaff and prints those objects. Run the program, which prints manager data only using the EmployeePerson class' printInfo method. Modify the EmployeeStaff class to override the EmployeePerson class' printInfo method and print all the...

  • PRG/421 Week One Analyze Assignment – Analyzing a Java™Program Containing Abstract and Derived Classes 1.    What is...

    PRG/421 Week One Analyze Assignment – Analyzing a Java™Program Containing Abstract and Derived Classes 1.    What is the output of the program as it is written? (Program begins on p. 2) 2. Why would a programmer choose to define a method in an abstract class (such as the Animal constructor method or the getName()method in the code example) vs. defining a method as abstract (such as the makeSound()method in the example)? /********************************************************************** *           Program:          PRG/421 Week 1 Analyze Assignment *           Purpose:         Analyze the coding for...

  • 1.     When a sub class object is created, when is the call to the super class...

    1.     When a sub class object is created, when is the call to the super class constructor made? How does a programmer call the super class constructor from the sub class? What do all classes indirectly extend? What methods does every class inherit from the Object class? 2.     When writing methods in a sub class, how can those methods call the methods from the parent class? 3.     Which class is more specific, a super class or a sub class? 4.    ...

  • JAVA - Abstraction and Encapsulation are one pillar of OOP (Object Oriented Programming). Another is inheritance...

    JAVA - Abstraction and Encapsulation are one pillar of OOP (Object Oriented Programming). Another is inheritance and polymorphism. In this assignment we will use inheritance and polymorphism to solve a problem. Part (a) of the figure below shows a symbolic representation of an electric circuit called an amplifier. The input to the amplifier is the voltage vi and the output is the voltage vo. The output of an amplifier is proportional to the input. The constant of proportionality is called...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT