click below
click below
Normal Size Small Size show me how
OOP: Module 7&8
| Question | Answer |
|---|---|
| It is the ability of objects belonging to different types to respond to methods of the same name, each one according to the right type specific behavior | Polymorphism |
| It is the ability to redefine methods for derived classes. | Polymorphism |
| Using one method identifier to refer to multiple functions in the same class, In the Java programming language, methods can be overloaded but not variables or operators. | Method Overloading |
| Creating more than one constructor in a class. | Constructor Overloading |
| Creating multiple methods having same name in one class. | Method Overloading |
| Providing a different implementation of a method in a subclass of the class that originally defined a method. | Method Overriding |
| These functions supplement each other. | Overloaded |
| These functions can exist, in any number, in the same class | Overloaded |
| ____________functions must have different argument lists. | Overloaded |
| The return type of an _____________ function may be chosen freely. | Overloaded |
| Overriding function replaces the function it overrides. | True |
| Each function in a base class can be overridden at most once in any one derived class | True |
| _______________ functions must have argument lists of identical type and order. | Overriding |
| The return type of an ____________ method must be identical to the function it overrides. | Overriding |
| This ability of our reference to change behavior according to what object it is holding is called __________. | Polymorphism |
| It allows multiple objects of different subclasses to be treated as objects of a single superclass, while automatically selecting the proper methods to apply to a particular object based on the subclass it belongs to. | Polymorphism |
| It contains one or more abstract methods and, therefore, can never be instantiated. | Abstract Class |
| It is defined so that other classes can extend them and make them concrete by implementing the abstract methods. | Abstract Class |
| All abstract classes are public by default and cannot be instantiated. Constructors and public methods cannot be declared as abstract. | True |
| An abstract class is a class that cannot be instantiated. | True |
| It often appears at the top of an object-oriented programming class hierarchy, defining the broad types of actions possible with objects of all subclasses of the class. | Abstract Class |
| Those methods in the abstract classes that do not have implementation. | Abstract Methods |
| Use abstract classes to define broad types of behaviors at the top of an object-oriented programming class hierarchy. | True |
| They define the signatures of a set of methods without the body. | Interfaces |
| They define a standard and public way of specifying the behavior of classes. They allow classes, regardless of their location in the class hierarchy, to implement common behaviors. | Interfaces |
| An abstract class that represents a collection of method definitions and constant values. | Interfaces |
| We need to use interfaces if we want unrelated classes to implement similar methods. | True |
| Thru interfaces, we can actually capture similarities among unrelated classes without artificially forcing a class relationship. | True |
| It denotes an abnormal event that occurs during the execution of the program and disrupts its normal flow. | Exception |
| When an error occurs within a method, the method creates an object called ________ and hands it off to the runtime system. | Exception Object |
| Exception object contains information about the error, including its type and the state of the program when the error occurred. | True |
| Creating an exception object and handing it to the runtime system is called ___________. | Throwing an exception |
| After a method throws an exception, the runtime system attempts to find a list of methods, called __________. | Call Stack |
| The runtime system searches the call stack for a method that contains a block of code that can handle the exception _____________. | Exception Handler |
| When an appropriate handler is found, the runtime system passes the exception to the handler. | True |
| An ________________is considered appropriate if the type of the exception object thrown matches the type that can be handled by the handler. | Exception Handler |
| The exception handler chosen is said to ____________. | Catch the exception |
| If the runtime system exhaustively searches all the methods on the call stack without finding an appropriate exception handler, as shown in the next figure, the runtime system (and, consequently, the program) terminates. | True |
| Handle the exception by enclosing the code in a _____________ block | try-catch |
| Use the __________ block to catch the exception and re-throw the exception to another subclass of the exception. | try-catch |