click below
click below
Normal Size Small Size show me how
OOP S2
Modules 5-8
| Question | Answer |
|---|---|
| MODULE 5 | OBJECT-ORIENTED PROGRAMMING |
| a technique of solving a problem and breaking it down into smaller parts and solving each of the smaller problems | procedural programming |
| a technique that describes the task to be performed on OBJECTS. These objects that have to be created and stored in the computer memory, contain data and instructions to perform tasks specific to that object | object-oriented programming |
| the process of PICKING OUT the common features of objects and procedures; this process focuses on the ESSENTIAL characteristics of an object | abstraction |
| the process of HIDING the implementation details of an object | encapsulation |
| allows an object to EXTEND its characteristics to another object | inheritance |
| ability to process objects DIFFERENTLY depending on their data type or class | polymorphism |
| a TEMPLATE or blueprint that defines an object's attributes and operations and that is created at design time | class |
| a running INSTANCE of a class that consumes memory and has a finite lifespan | object |
| exists when an object contains a reference to another object. Referred to as the “has a” relationship | association |
| referred to as the "kind of" or "is a" relationship | inheritance |
| the PARENT class from which properties are inherited by another class | superclass (base class) |
| a NEW CLASS with properties taken from a parent class | subclass (derived class) |
| a well-encapsulated CONCEPTUAL class. the objects of this class do not exist in real world | abstract class |
| a general-purpose NOTATIONAL language used for specifying and visualizing COMPLEX software, usually large object-oriented project. | unified modeling language |
| used to DESCRIBE the attributes and behaviors of objects in the system | class diagram |
| data contained in a class (eg. customer_ID, name, date) | attributes |
| actions performed on that data | operation |
| declared either at the start or end of a class definition; these variables identify the data stored in the object | attributes |
| a method that is AUTOMATICALLY executed when an object is created. this method is used to INITIALIZE the attributes | constructor |
| used to change or access the private data in an object | standard methods |
| a method that is used to set or change the data | mutator (setter) |
| a method that is used to access or retrieve data | accessor (getter) |
| implements the business rules for which the application is being developed | custom methods |
| steps in declaring classes | define class name and attributes create constructor, standard methods, and custom methods |
| keyword that contains a reference to the CURRENT object being constructed; represents an instance of the class in which it appears | this |
| variables that are stored in each OBJECT of a class; non-static member fields of a class | instance variables |
| variables stored in the CLASS and are available to all objects of a class; static members of the class | class variables |
| data used in a method; temporary and does not exist once the method has completed execution | local/method variables |
| MODULE 6 | ENCAPSULATION AND INHERITANCE |
| to make sure that sensitive data is hidden from users | encapsulation |
| how to achieve encapsulation | declare class attributes as private; provide public setter and getter methods |
| returns the variable value; sets the value | get; set |
| the technique of deriving new class definitions from an existing class definition | inheritance |
| class from which another class inherits properties; class that is on top of a hierarchy | superclass |
| class that inherits all the non-private attributes and methods, except constructors from a superclass. This class has the ability to override methods of the superclass | subclass |
| subclasses are derived from a single superclass | single inheritance |
| subclasses are derived from more than one superclass | multiple inheritance |
| contains a reference to the parent class object | super |
| where must the super call occur? | first statement in a constructor |
| can this() and super() occur in the same constructor? | no |
| classes that can no longer be subclassed | final |
| MODULE 7 | POLYMORPHISM AND ABSTRACTION |
| ability of objects belonging to different types to respond to methods of the SAME NAME; ability to redefine methods for derived classes | polymorphism |
| using one method identifier to refer to multiple functions in the same class | method overloading |
| what can be overloaded in Java? | methods; not variables or operators |
| creating more than one CONSTRUCTOR in a class | constructor overloading |
| creating multiple METHODS having the same name in one class | method overloading |
| providing a different implementation of a method in a subclass of the class | method overriding |
| which supplements each other? | overloading |
| which can exist in the same class? | overloading |
| each function in a base class can be overridden how many times? | at most once |
| they have different argument lists | overloading |
| they have argument lists of identical type and order | overriding |
| return type of an overloaded function | may be chosen freely |
| return type of an overriding method | must be identical to the function it overrides |
| contains one or more abstract methods; cannot be instantiated | abstract class |
| all abstract classes are ___ by default and cannot be instantiated | public |
| which cannot be declared as abstract? | constructors and public methods |
| special kind of block containing method signatures only; defines the signatures of a set of methods without the body | interface |
| defines a standard and public way of specifying behavior of classes | interface |
| represents a collection of method definitions and constant values; can later be implemented by classes | interface |
| MODULE 8 | EXCEPTIONS |
| an ABNORMAL EVENT that occurs during executing of the program and disrupts its normal flow | exception |
| object created by a method when an error occurs within a method | exception object |
| it contains information about the error; including its type and state of program | exception object |
| creating an exception object and handing it to the runtime system | throwing an exception |
| after a method throws an exception, the runtime system attempts to find a list of methods called... | call stack |
| runtime system searches the call stack for a method that contains a block of code that can handle the exception called... | exception handler |
| abstraction can apply to | control and data |
| multiple catch blocks ___ | can be |
| which line is an example of an inappropriate use of assertions? | assert z > 4: z++ |
| Assertion checking is typically enabled during | program development and testing. |
| What must a non-abstract child do about an abstract method in its parent class? | A child must override an abstract method inherited from its parent by defining a method with the same signature and same return type. |
| Which among the following can't be used for polymorphism? | Static member functions |
| Which among the following is not a level of abstraction? | view level |
| Using higher degree of abstraction __________ | can be safer and may reduce vulnerabilities |
| Can an object of a child type be assigned to a variable of the parent type? | Yes, an object of a child type can be assigned to a variable of the parent type. |
| RuntimeException and its sub-classes can be caught by the | catch block. |
| Program throws ___________ if assert statement fails. | java.lang.AssertionError |
| Assertions can be enabled or disabled on a | class by class basis |