Kerala Plus Two Computer Science Chapter Wise Questions and Answers Chapter 2 Concepts of Object-Oriented Programming
Plus Two Computer Science Concepts of Object-Oriented Programming One Mark Questions and Answers
Question 1.
Protecting data from access by unauthorized function is Data
(a) Polymorphism
(b) encapsulation
(c) data abstraction
(d) Inheritance
Answer:
(b) encapsulation
Question 2.
The act of partitioning a program into individual components is called,
(a) Polymorphism
(b) encapsulation
(c) data abstraction
(d) modularity
Answer:
(d) modularity
Question 3.
Which of the following is not an OOP concept?
(a) Overloading
(b) procedural programming
(c) data abstraction
(d) Inheritance
Answer:
(b) Procedural programming
Question 4.
The ability for a message or data to be processed in more than one form is called 6303 message or data.
(a) Polymorphism
(b) encapsulation
(c) data abstraction
(d) Inheritance
Answer:
(a) Polymorphism
Question 5.
C++ is a ……. language.
(a) Qbject based
(b) non-procedural
(c) Object-oriented
(d) procedural
Answer:
(c) Object-oriented
Question 6.
Which of the following is not a characteristic of OOP?
(a) It emphasises more on procedure rather than data.
(b) It models real world
(c) It wraps up related data items and associated functions in the unit.
(d) None of the above
Answer:
(a) It emphasises more on procedure rather than data.
Question 7.
Which among the following is true about OOPs.
(a) It supports data abstraction
(b) It supports polymorphism
(c) It supports structured programming.
(d) It supports all the above
Answer:
(d) It supports all the above
Question 8.
Identify the correct statements from the following.
(a) Procedural programming approach aims more at procedures.
(b) The object-oriented approach views a problem in terms of objects involved.
(c) Real life cannot be modeled in OOP.
(d) Procedures takes a secondary status in object-oriented approach.
Answer:
(a), (b), (d)
Question 9.
“One form many behaviours” represents
(a) modularity
(b) Abstraction
(c) polymorphism
(d) Inheritance
Answer:
(c) polymorphism
Question 10.
What do you understand by programming paradigm?
Answer:
Paradigm means organizing principle of a program. It is an approach to programming.
Question 11.
What are the characteristics of procedural paradigm? Procedural programming.
Answer:
In procedural paradigm, the emphasis is on doing things. Data is the reason for a program’s existence. Yet data is given second class status while programming.
Question 12.
Which of the following is not a programming paradigm?
Answer:
(a) Object oriented
(b) Procedure oriented
(c) Both a and b
(d) Standard
Answer:
(d) Standard. This is not a programming paradigm
Question 13.
In programming, modules are composed of
(a) data types
(b) functions
(c) statements
(d) programs
Answer:
(b) functions
Question 14.
The following function prototypes implement an OOP concept. Identify the concept and explain it.
Answer:
Polymorphism
Plus Two Computer Science Concepts of Object-Oriented Programming Two Mark Questions and Answers
Question 1.
State whether the following statements are true or false.
- In procedural oriented programming, data is the reason for a program’s existence.
- The real word concept gets simplified using concept of abstraction.
Answer:
1. False. In procedural programming, the emphasis is on doing actions or operations. Here data is not secure.
2. True. The real world concept gets simplified using concept of abstraction. In object-oriented programming the problems are viewed in terms of objects involved. Thus modeling real-world becomes easy in object oriented programming. Objects essential features alone are represented. This property is known as data abstraction.
Question 2.
How does inheritance support ‘reusability’?
Answer:
Inheritance allows the addition of additional features to an existing class without modifying it. One can derive a new class (subclass) from an existing one and add new features to it. There is reduction in amount of typing and efforts.
Question 3.
Define the termbase class, subclass and the relationship between a base class and subclass.
Answer:
Inheritance is the capability of a class to inherit properties from another class. That class that inherits from other class is subclass and the other class is base class. For eg: when we say that the class ‘student’ inherits from the class ‘person’, then ‘person’ is a base class of ‘student’ and ‘student’ is a subclass of ‘person’.
Question 4.
How the data is hidden and safe if encapsulation is implemented?
Answer:
Encapsulation is the way of combining both data and the functions that operate on that data. Encapsulation is most often achieved through information hiding, which is the process of hiding all the secrets of an object that do not contribute to its essential characteristics. The structure of an object is hidden.
Question 5.
Differentiate object and Class.
Answer:
An object is an identifiable entity with some characteristics and behavior. It represents an entity that can store data and its associated functions. A class is a group of objects that share common properties and relationships. It represents a group of similar objects
Question 6.
Distinguish class and object with the help of examples.
Answer:
- Class – A class is a collection of objects with similar attributes.
- Object – An object is an instance of the class. Furniture class is an example for class. Chair, Table, etc. are the instances ie. objects of the class furniture
Question 7.
When we switch on the computer, booting takes place. We do not know what all things are happening inside. Identify the OOP concept that resembles this scenario. Give another situation that resembles this concept.
Answer:
Data abstraction: It refers to the act of representing essential features without including the background details. Switchboard is an example for this.
Question 8.
Which of the following members of a C++ class data type are hidden from accessing?
(a) Private and protected members
(b) Private and public members
(c) Public and protected members
(d) Private, public and protected members
Answer:
(a) Private and protected members
Question 9.
Explain how operator overloading implements polymorphism.
Answer:
Polymorphism is the ability for a message or data to be processed in more than one form. This is achieved by function overloading, operator overloading and dynamic binding.
Plus Two Computer Science Concepts of Object-Oriented Programming Three Mark Questions and Answers
Question 1.
You have seen a flask. When you put some ice-cubes in it, it will stay there for hours without melting and when you pour some hot water it will stay hot.
- Name the OOP feature that we can correlate with this situation.
- Write a short note about that feature
Answer:
1. Polymorphism
2. Polymorphism is an essential feature of object oriented programming. Polymorphism means having many forms. It is the capability of an object to behave differently in response to a message or action. That is, the same operation is performed differently depending upon the type of data it is working with. Polymorphism is implemented in C++ in two ways, compile time polymorphism and runtime polymorphism
Question 2.
Suppose your school is selected as the venue for conducting District youth festival. For the smooth functioning of the programme different committees are formed and each committee is assigned separate duties.
- Which OOP feature can be correlated to this situation?
- Write a brief note on that feature
Answer:
1. Modularity
2. When programs become larger, the program is broken into functions or modules. A module is separate unit in itself. Each unit can be compiled separately. All modules work hand in hand in order to achieve the program’s goal. The act of partitioning a program into individual unit is called modularity. It reduces program’s complexity.
Question 3.
You have seen the enquiry machine in a railway station. The user just types in a few details like train number, station, and date. The details of train, seat availability, fare, etc. will be displayed. The user is not aware of its working. Which OOP feature can you correlate with this situation?
Answer:
Data Abstraction:
Data abstraction is an important feature of OOP. It refers to the act of representing essential features without including the background details or explanations. Abstraction supports data hiding so that only the relevant information is expressed to the user and the rest of the information remains hidden from the user.
Question 4.
The famous luxury ship ‘TITANIC’ has provided all facilities like food, entertainment and medical aid available at that time for its passengers. Can you correlate this with any of the OOP features you have left. Justify.
Answer:
Encapsulation:
Encapsulation is the most fundamental concept of OOP. Placing data and functions together is the central idea of object oriented programming. This is known as Encapsulation
Question 5.
Using a real world example explain the concept of inheritance.
Answer:
Parent child relationship is the best example of inheritance. Child derives properties of parents. C++ supports inheritance.
It is the capability of one class to inherit properties from another class. In other words, inheritance is the process of creating new classes called derived classes, from existing base classes. The derived class inherits all the properties of base class but can add features of its own. The base class is unchanged by this process.
Question 6.
In an ATM machine the user will be given options to access their account details, withdraw money, deposit money, etc. only. The background details are not shown to the user.
- Name the object oriented feature that we can correlate with this situation.
- Briefly explain about the feature.
Answer:
1. Data abstraction
2. Abstraction refers to the act of representing essential features without including the background details or explanations. Abstraction supports data fiding so that only the relevant information is expressed to the user and the rest of information remains hidden from the user.
Question 7.
Consider the diagram. Can you correlate any OOP feature from this? Write a note on the feature.
Answer:
Data Encapsulation. Placing data and functions together is the central idea of object oriented programming. This is encapsulation. It is a way to implement abstraction by wrapping up data and associated functions into a single unit.
Question 8.
Consider the following statements.
6 + 9 = 15 but ‘x’ + ‘yz’ = ‘xyz’ Which OOP feature can you infer from the above. Explain.
Answer:
Polymorphism. Polymorphism is the ability for a message or data to be processed in more than one form. The same operation is performed differently depending upon type of data it is working with.
Question 9.
Abstraction and encapsulation are complementary concepts of OOP. Justify.
Answer:
Abstraction and encapsulation are complementary concepts of OOP. Abstraction refers to the act of representing essential features without including the background details. Encapsulation is wrapping up of data and functions into a single unit. Abstraction focuses upon the observable behaviour of an object, whereas encapsulation focuses upon the implementation that gives rise to this behaviour
Question 10.
Write four reasons for the increasing complexity of procedural programming.
Answer:
Following are the main reasons of increasing the procedural language complexity.
- Data is undervalued
- Adding new data requires modifications to all/many functions.
- Creating new data types is difficult
- Provides poor real world modeling
Question 11.
List the advantages of Object Oriented Programming.
Answer:
- OOP allows modularity (divide the large programs into smaller ones.)
- it is good for defining abstract data types
- It allows data abstraction
- It allows code reusability
- Real life entities can be easily created
- It supports to create new data types.
Question 12.
Identify a suitable attribute from the 2nd column and an associated behaviour from 3rd column for each object in the 1st column.
Answer:
i) → b → 4
ii) → d → 3
iii) → a → 2
Question 13.
“School kalolsavam” is organised with the help of various committees. Each committee is assigned with a specific task. Identify the OOP concept that is analogous to this situation. Give another real life case that resembles with this concept.
Answer:
The OOP concept used in this situation is modularity. Consider the situation to fill up the application forms of students in a class. Suppose one application form takes nearly 5 minutes of time.
So a class teachers will take 5 * 50 = 250 minutes to fill up the application forms of the entire class. Instead of this, the teacher distributes the application forms to the students, that takes only 5 minutes and teachers gives 5 minutes instructures to the students how to fill up the forms:
Next 5 minutes enough for the students to complete the work. After that the next 5 minutes to return back the filled up application forms. So the entire work will take only 5 + 5 + 5 + 5 = 20 minutes
Question 14.
Look at the following figure:
- Identify the OOP concept shown by the figure.
- Write short note about this concept.
Answer:
1. Inheritance
2. Inheritance is the capability Of one class of things to inherit properties from another class. The class from which attributes are inherited is called the base class. The inherited class is called the derived class.