Previous Year Questions Concepts of Object-Oriented Programming
The document contains a series of previous year questions related to Object-Oriented Programming (OOP) concepts, including topics such as polymorphism, encapsulation, inheritance, and data abstraction. It includes multiple-choice questions, true/false statements, and open-ended questions aimed at assessing understanding of OOP principles. Additionally, it provides solutions and explanations for some of the questions, illustrating the key features and advantages of OOP.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
7 views10 pages
Previous Year Questions Concepts of Object-Oriented Programming
The document contains a series of previous year questions related to Object-Oriented Programming (OOP) concepts, including topics such as polymorphism, encapsulation, inheritance, and data abstraction. It includes multiple-choice questions, true/false statements, and open-ended questions aimed at assessing understanding of OOP principles. Additionally, it provides solutions and explanations for some of the questions, illustrating the key features and advantages of OOP.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10
Chapter 2
Previous Year Questions
Concepts of Object-Oriented Programming
1. Compare static and dynamic polymorphism. [MARCH – 2016] (3)
2. Differentiate between Data Abstraction and Data Encapsulation. [MARCH – 2017] (3) 3. Protecting data from access by unauthorized function is Data (a) Polymorphism (b) encapsulation (c) data abstraction (d) Inheritance 4. The act of partitioning a program into individual components is called, (a) Polymorphism (b) encapsulation (c) data abstraction (d) modularity 5. Which of the following is not an OOP concept? (a) Overloading (b) procedural programming (c) data abstraction (d) Inheritance 6. 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 7. C++ is a ……. language. (a) Qbject based (b) non-procedural (c) Object-oriented (d) procedural 8. Which of the following is not a characteristic of OOP?
മലയാളികളുടെ സ്വന്തം +917510998855
Learning App +919207998855 (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 9. 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 10. 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. 11. “One form many behaviours” represents (a) modularity (b) Abstraction (c) polymorphism (d) Inheritance 12. What do you understand by programming paradigm? 13. What are the characteristics of procedural paradigm? Procedural programming. 14. Which of the following is not a programming paradigm? (a) Object oriented (b) Procedure oriented (c) Both a and b (d) Standard 15. In programming, modules are composed of (a) data types (b) functions (c) statements (d) programs 16. State whether the following statements are true or false. 1. In procedural oriented programming, data is the reason for a program’s existence.
മലയാളികളുടെ സ്വന്തം +917510998855
Learning App +919207998855 2. The real word concept gets simplified using concept of abstraction. 17. How does inheritance support ‘reusability’? 18. Define the term base class, subclass and the relationship between a base class and subclass. 19. How the data is hidden and safe if encapsulation is implemented? 20. Differentiate object and Class. 21. Distinguish class and object with the help of examples. 22. 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. 23. 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 24. Explain how operator overloading implements polymorphism. 25. 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. 1. Name the OOP feature that we can correlate with this situation. 2. Write a short note about that feature 26. 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. 1. Which OOP feature can be correlated to this situation? 2. Write a brief note on that feature 27. 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?
മലയാളികളുടെ സ്വന്തം +917510998855
Learning App +919207998855 28. 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. 29. Using a real world example explain the concept of inheritance. 30. 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. 1. Name the object oriented feature that we can correlate with this situation. 2. Briefly explain about the feature. 31. Consider the diagram. Can you correlate any OOP feature from this? Write a note on the feature.
32. Consider the following statements.
6 + 9 = 15 but ‘x’ + ‘yz’ = ‘xyz’ Which OOP feature can you infer from the above. Explain. 33. Abstraction and encapsulation are complementary concepts of OOP. Justify. 34. Write four reasons for the increasing complexity of procedural programming. 35. List the advantages of Object Oriented Programming. 36. Identify a suitable attribute from the 2nd column and an associated behaviour from 3rd column for each object in the 1st column. Object Attribute Behavior i) Student a) Legs 1) Conducting examination ii) Fruit b) Admission number 2) Carrying a platform iii) Furniture c) Speed 3) Ripening
മലയാളികളുടെ സ്വന്തം +917510998855
Learning App +919207998855 d) Colour 4) Scoring mark
37. “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. 38. Look at the following figure:
1. Identify the OOP concept shown by the figure.
2. Write short note about this concept.
മലയാളികളുടെ സ്വന്തം +917510998855
Learning App +919207998855 Solutions
1. There are 2 types of polymorphism they are static and dynamic.
a) Compile time (early binding/static) polymorphism It is the ability of the compiler to relate or bind a function call with the function definition during compilation time itself. Examples are Function overloading and operator overloading b) Run time (late binding/dynamic) polymorphism It is the ability of the compiler to relate or bind a function call with the function definition during mn time. It uses the concept of pointers and inheritance. 2. Data Abstraction: Data abstraction refers to the act of representing essential features without including the background details Data Encapsulation: The wrapping up of data and functions into a single unit. It is the mechanism that associates the code and the data it manipulates and keep them safe from external interference and misuse. 3. (b) encapsulation 4. (d) modularity 5. (b) Procedural programming 6. (a) Polymorphism 7. (c) Object-oriented 8. (a) It emphasises more on procedure rather than data. 9. (d) It supports all the above 10. (a), (b), (d) 11. (c) polymorphism 12. Paradigm means organizing principle of a program. It is an approach to programming. 13. 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. 14. (d) Standard. This is not a programming paradigm
മലയാളികളുടെ സ്വന്തം +917510998855
Learning App +919207998855 15. (b) functions 16. 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. 17. 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. 18. 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’. 19. 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. 20. 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 21. 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 22. Data abstraction: It refers to the act of representing essential features without including the background details. Switchboard is an example for this. 23. (a) Private and protected members
മലയാളികളുടെ സ്വന്തം +917510998855
Learning App +919207998855 24. 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. 25. 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 26. 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. 27. 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. 28. 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. 29. 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.
മലയാളികളുടെ സ്വന്തം +917510998855
Learning App +919207998855 30. 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. 31. 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. 32. 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. 33. 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 behavior. 34. Following are the main reasons of increasing the procedural language complexity. 1. Data is undervalued 2. Adding new data requires modifications to all/many functions. 3. Creating new data types is difficult 4. Provides poor real world modeling 35. Advantages: 1. OOP allows modularity (divide the large programs into smaller ones.) 2. it is good for defining abstract data types 3. It allows data abstraction 4. It allows code reusability 5. Real life entities can be easily created
മലയാളികളുടെ സ്വന്തം +917510998855
Learning App +919207998855 6. It supports to create new data types. 36. i) → b → 4 ii) → d → 3 iii) → a → 2 37. 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 38. 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 derived class.