click below
click below
Normal Size Small Size show me how
OOP [F3]
Object Oriented Programming Formative 3
| Question | Answer |
|---|---|
| Procedural Programming is a technique of solving a problem and breaking it down into smaller parts and solving each of the smaller problems. false true | true |
| A _____ is a procedure associated with a class that describes an action an object is able to perform. procedure method function routine | method |
| What is the difference between a class and an object? A class is a blueprint to make an object A blueprint is an object to make a class An object is a blueprint to make a class Blueprint class is an object make a | A class is a blueprint to make an object |
| Where does a java program start executing instructions from: source file class main method object | main method |
| Class Variables are variables stored in the class and are available to all objects of a class or objects of other classes if access is permitted false true | true |
| final Class: a class that can never be sub-classed false true | true |
| _________– used to change or access the private data in an object. Standard Methods Constructor Methods Custom Methods | Standard Methods |
| Standard Methods – implement the business rules for which the application is being developed true false | false |
| this - It represents an instance of the class in which it appears false true | true |
| Encapsulation is supported by ___________ Methods Objects Classes None of the above | Classes |
| Encapsulation is implemented by using__________ static class None of the above private public | private |
| In Encapsulation, the programmer can change one part of the code without affecting other parts true false | true |
| Encapsulation has Better control of class attributes and methods false true | true |
| If multi-level inheritance is used, First class B inherits class A, then C inherits B and so on. Till how many classes can this go on? There is no limit Only till class C Only till class Z Only till class J | There is no limit |
| Instance Variables are variables stored in the class and are available to all objects of a class or objects of other classes if access is permitted false true | false |
| ________ is a technique of solving a problem and breaking it down into smaller parts and solving each of the smaller problems. OOP Procedural Programming | Procedural Programming |
| True or False: // allows for a single line comment? True False | True |
| ________ describes the task to be performed on objects. OOP Procedural Programming | OOP |
| OOP is a technique of solving a problem and breaking it down into smaller parts and solving each of the smaller problems. true false | false |
| Which of following statement(s) can result in new object instance creation if executed successfully. String str = "VirtuQ" + " "+ Simplifying Education"; int [] arr = {1,2,3,4,5}; All String str = new String("VirtuQ"); String str = new String(); | All |
| Constructor – a method that is automatically executed when an object is created. This method is used to initialize the attributes. false true | true |
| this keyword can be used to invoke current class method (implicitly) true false | true |
| this keyword can be passed as argument in the constructor call. false true | true |
| static Variables are variables stored in the class and are available to all objects of a class or objects of other classes if access is permitted true false | true |
| Encapsulation is also called as? Data Hiding None of the choices Data Hiding Data Encapsulation | Data Hiding |
| Encapsulation is implemented by using private true false | true |
| There is no security of data with Encapsulation true false | false |
| Encapsulation has poor control of class attributes and methods false true | false |
| Which language doesn't support single level inheritance? Java All languages support it Kotlin C++ | All languages support it |
| How many classes can be inherited by a single class in java? Only 1024 Only 27 Only 1 Only 255 | Only 1 |
| Which among the following defines single level inheritance ? One base class derives another class One base class inherits from one derived class One derived class derives from another derived class One derived class inherits from one base class | One derived class inherits from one base class |
| Which of the following concept is often expressed by the phrase, 'One interface, multiple methods'? Inheritance Abstraction Encapsulation Polymorphism | Polymorphism |
| Which concept of Java is a way of converting real world objects in terms of class? Encapsulation Abstraction Polymorphism Inheritance | Abstraction |
| Constructor – declared either at the start or end of a class definition. These variables identify the data stored in the object. false true | false |
| ________ – a method that is automatically executed when an object is created. This method is used to initialize the attributes. Custom Constructor Default | Constructor |
| this keyword can be used to invoke current class method (implicitly) false true | true |
| _________– a method that is used to access or retrieve data. Mutator (Setter) Accessor (Getter) | Accessor (Getter) |
| These variables identify the data stored in the object. Attributes methods charac | Attributes |
| Which feature can be implemented using encapsulation? Overloading Inheritance Abstraction Polymorphism | Abstraction |
| Encapsulation has Better control of class attributes and methods true false | true |
| Using encapsulation data security is ___________ Purely ensured Not ensured Very low Ensured to some extent | Ensured to some extent |
| There is no security of data with Encapsulation false true | false |
| Which constructor will be called first from the classes involved in single inheritance from object of derived class? Base class constructor Runtime error Derived class constructor Both class constructors at a time | Base class constructor |
| How many types of inheritance can be used at a time in a single program? Any three types Any 4 types Any type, any number of times Any two types | Any type, any number of times |
| The private members of the base class are visible in derived class but are not accessible directly. True False | True |
| Which access type data gets derived as private member in derived class? Public Private Protected Protected and Private | Private |
| As a blueprint is a design for a house, a class is a design for a: statement object variable constant | object |
| Encapsulation means "open to all" and indicates that the internal workings of an object are entirely visible to the outside world. False Sometimes True | False |
| OOP is a technique of solving a problem and breaking it down into smaller parts and solving each of the smaller problems. true false | true |
| static Variables are variables stored in the class and are available to all objects of a class or objects of other classes if access is permitted true false | true |
| final Method: a method that cannot be overridden false true | true |
| _________– used to change or access the private data in an object. Constructor Methods Standard Methods Custom Methods | Standard Methods |
| Access (Getter) – a method that is used to access or retrieve data. false true | true |
| The encapsulation is achieved by combining which ones into a class? Methods and Attribute Methods and Object Object and Attribute None of the above | Methods and Attribute |
| Encapsulation has Better control of class attributes and methods false true | true |
| Which among the following best describes encapsulation? It is a way of combining various data members and member functions that operate on those data members into a single unit It is a way of combining various data members into a single unit | It is a way of combining various data members and member functions that operate on those data members into a single unit |
| In Inheritance, the programmer can change one part of the code without affecting other parts false true | false |
| What type of inheritance does Java have? Class Inheritance Single Inheritance Multiple Inheritance Double Inheritance | Single Inheritance |
| Which among the following best describes multiple inheritance? More than one class being parent of single child More than one class being parent of other child classes Two classes being parent of any other classes | More than one class being parent of single child |
| How can you make the private members inheritable? It can be done both by making the visibility mode public or protected By making their visibility mode as protected only By making their visibility mode as public only | By making their visibility mode as protected only |
| Which amongst the following is true for hybrid inheritance? Constructor calls are usual Constructor calls are priority based Constructor of only derived class is called Constructor calls are in reverse | Constructor calls are usual |
| If a base class is inherited in protected access mode then which among the following is true? Public and Protected members of base class becomes protected members of derived class | Public and Protected members of base class becomes protected members of derived class |
| An object is an instance of a: class method application parameter | class |
| The wrapping up of data and functions into a single unit is called object encapsulation overloading class | encapsulation |
| What is it called where child object gets killed if parent object is killed? Aggregation Composition Association Encapsulation | Composition |
| What is it called if an object has its own lifecycle and there is no owner? Encapsulation Association Composition Aggregation | Association |
| static Variable used in defining a class variable true false | true |
| a variable that is accessible from all classes. public variable protected variable private variable | public variable |
| Construct – a method that is automatically executed when an object is created. This method is used to initialize the attributes. false true | True |
| final Class: a class that can never be sub-classed true false | true |
| a method that is only accessible within the class where it is declared. protected method private method public method | private method |
| How can Encapsulation be achieved? Using only private members Using inheritance Using Abstraction Using Access Specifiers | Using Access Specifiers |
| In Encapsulation, Class variables can be made read-only or write-only false true | true |
| If data members are private, what can we do to access them from the class object? Create private member functions to access those data members Create public member functions to access those data members | Create public member functions to access those data members |
| Members which are not intended to be inherited are declared as ________________ Protected members Public members Private or Protected members Private members | Private members |
| The private member's are made public to all the classes in inheritance. True False | False |
| Single level inheritance will be best for___________ Inheriting a class which can print all the calculation results Inheriting a class which performs all the calculations Inheriting all the classes for different calculations | Inheriting a class which performs all the calculations |