Important Questions Class 12 Computer Science C Object Oriented Programming
Free PDF download of Important Questions for CBSE Class 12 Computer Science (C++) Chapter 2 Object Oriented Programming prepared by expert Computer Science (C++) teachers from latest edition of CBSE(NCERT) books, On StudySolver.Org to score more marks in CBSE board examination.
Question 1: Write any four important characteristics of object oriented programming. Give example of any one of the characteristics using C++. All India 2016 Answer: Four important characteristics of object oriented programming are as follows: (i) Data encapsulation (ii) Inheritance (iii) Polymorphism (iv) Data abstraction Example of Inheritanc e
Question 2: Explain data hiding with an example. All India 2014C Answer: Data hiding is a property, where internal data structure of an object is hidden from the outside world. Data hiding helps to secure the data. It is implemented with private and protected keywords. , e.g.
Here, in this example variables item_no and item_cost are hidden, i.e. cannot be directly accessed from outside the class Item. Question 3: What is function overloading? Give an example in C++ to illustrate function overloading. All India 2014,2009 or What do you understand by function overloading? Give an example illustrating its use in a C++ program. All India 2009 Answer: When several functions have same name but performing different tasks, then it is known as function overloading. The definitions of these functions are differentiable by the number or types of their arguments. e.g.
Question 4: Write the output of the following C++ code. Also, write the name of feature of Object Oriented Programming used in the following program jointly illustrated by the functions [I] to [IV]. Delhi 2011
Answer: Feature of C++→ Function overloading The output will be: @@@@ 91827 Question 5: Write the output of the following C++ code. Also, write the name of feature of Object Oriented Programming used in the following program jointly illustrated by the functions [I] to [IV]: All India 2011
Answer: Feature of C ++ Function overloading Output will be : #### 91827 Question 6: What do you understand by Data Encapsulation and Data Hiding? Also, give an example in C++ to illustrate both. All India 2010 Answer: Data Encapsulation The wrapping up of data (member variables) and functions into a single unit is known as data encapsulation. Encapsulation is implemented in C ++ with the help of classes. Data Hiding When member data and member function are binded into a single unit then the data is not accessible to the outside world and only those functions, which are wrapped in that class can access it. Data hiding is implemented in C+ + with the help of private and protected keywords. e.g. Question 7: What do you understand by polymorphism? Give an example illustrating its use in a C++ program. Delhi 2010 Answer: Polymorphism means processing of data or messages in more than one form. C ++ implements polymoiphism through overloaded functions and overloaded operators, e.g.
Question 8: How are abstraction and encapsulation interrelated? Delhi 2009 Answer: Abstraction refers to the representation of only the essential features of the real-world object in the program. This process does not include the background details and explanations. This concept of abstraction is used in classes whereas, data encapsulation is the most significant characteristic of the class. By this term, we mean the wrapping up of data and functions which operate on the data, into a single unit called the class. This encapsulation prevents free access to the data within an object. Question 9: What is event driven programming? Answer: In event driven programming, the user indicates the order of program execution not the programmer. Instead of, the program ‘driving’ the user ‘drives’ the program. Programming, in which the code that responds to the event is called event driven programming. Question 10: What is the significance of classes in OOPs? Answer: The classes are the manufacturing units of the objects of their type, i.e. it is the class that can be used to create an object. Classes are user defined data types and behave like the built-in types of a programming language. Classes are the basic building blocks of object oriented programming. Question 11: What are the advantages of object oriented programming over procedural oriented programming? Answer: Advantages of Object Oriented Programming (OOP) over Procedural Oriented Programming (POP)
Question 12: Encapsulation is one of the major properties of OOP. How is it implemented in C++? HOTS or Define the term data encapsulation in terms of object oriented programming. Give a suitable example using a C++ code to illustrate the same. Answer: The wrapping up of data and functions into a single unit is called data encapsulation. That single unit is known as class. e.g.
The above program implements data hiding as data can’t be accessed directly from outside. Question 13: What is operator overloading? Explain with example. Answer: The process of making an operator to exhibit or show different behaviour in different situations is called as operator overloading. e.g. consider the operation of (+) operator. Operation is sum, if operands are integer type and the operation is concatenation, if operands are strings.
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.
In OOP, program is divided into parts called objects.
In POP, program is divided into small parts called functions.
OOP provides data hiding that provides more security.
POP does not have any proper way for data hiding so it is less secure.
C++, Java, VB.NET, C, .NET, etc. are the examples of OOP language.
C, VB, FORTRAN, Pascal etc are the examples of POP language.