Pageviews

Tuesday, 28 July 2020

+2].2-Concepts of Object Oriented Programming - Previous Questions Chapter wise


                           PLUS TWO  COMPUTER SCIENCE

 Second Year Computer Science Previous Questions Chapter wise ..

Chapter 2.Concepts of Object Oriented Programming




       1. Compare static and dynamic polymorphism.

       There are two types of polymorphism

a. Compile time(early binding/static) polymorphism:

                   The ability of a compiler to relate or bind a function call with the function definition during compilation itself.

   These are two type.Function overloading and operator overloading

Function overloading: Multiple function with same name and different function signatures is known as function overlaoding.

Operator overloading: Ordinary Operator exhibit  different  behaviors on different object of a class depending on the types of operands it receives.

2. Run time(Late binding/dynamic:

      Run time (Dynamic) polymorphism (or late binding): Polymorphism during run-time. It uses pointers. Virtual functions are examples.

       2. A program is implemented to find the area of a circle and areas of rectangle with two           functions        having same name but with different signature.
 (a) Name the concept.
 (b) Explain this concept by writing the above program.

  3. Differentiate between data abstraction and data encapsulation.

            Refers to showing only  the essential features of the application  and  hiding  the details from outside world.Data abstraction separates interface and separates  interface and implementation.Implementation denotes how variables are declared,how functions are coded etc.It is through an interface a communiaction send to the object as messages.

       Data encapsulation: It binds the data and functions together and keeps them safe.C++ implements encapsulation through  a declaration of a class.A class contain Public,Private and Protected members.

 4. What is the difference between structure and class?

      Structure:  1. Contains only data as members.
                       2. No access specifiers are used.
                       3. By default, the members are public

     Class:       1. Contains data and functions as members.
                     2. Access specifiers private, public and protected are used for members.
                     3. By default, the members are private.


5. Default access specifier is (a) private (b) public (c) protected (d) none

Ans. b

6. Showing only the essential features and hiding complexities from outside world is refers to ----------
Ans. Data abstraction

7. What is the object oriented programming paradigm?give any two advantages.

   Ans.  

Object-oriented programming (OOP) is a programming paradigm based upon objects (having both data and methods) that aims to incorporate the advantages of modularity and reusability.

Improved software-development productivity: Object-oriented programming is modular, as it provides separation of duties in object-based program development. It is also extensible, as objects can be extended to include new attributes and behaviors.