Search This Blog

Saturday, November 23, 2019

These are frequently asked Interview and Viva Questions in Object-Oriented Programming.





1. What is OOPs?

A. OOPs stands for Object-Oriented Programming in which programs have a collection of objects. Each object is an instance of a class.


2.Basic concepts of OOPs?

A. 1 .Objects
     2.Classes
     3.Data abstraction 
     4.Encapsulation
     5.Inheritance
     6.Polymorphism
     7.Dynamic binding
     8.Message passing


3. What is an Object?

A. OOP allows decomposition of a problem into a number of entities called objects and objects are basic run-time entities in an object-oriented system.


4.what is Class?

A. A class is a collection of objects with similar types. 
       It is a us.er-defined datatype, which holds its own data members and member functions, which can be accessed by creating an instance of that class. A class is like a blueprint for an object.
Syntax: Class name{
              ............... };


5. What is Data abstraction?

A. Data abstraction refers to providing only essential information to the outside world and hiding their background details,i.e, to represent the needed information in the program without presenting the details.


6. What is Encapsulation?

A. The wrapping up of data and functions into a single unit called class is known as encapsulation.
        The data is not accessible to the outside world, and only those functions which are wrapped in the class can access it.


7. What is Inheritance?

A. Inheritance is a process in which objects of one class acquire the properties of objects of another class is called inheritance. The concept of inheritance provides the idea of reusability.


8. What is Polymorphism?

A. Polymorphism means the ability to perform more than one form. An operator may exhibit different behaviors in different instances.


9. What is Dynamic binding?

A. Dynamic binding is also known as late binding or run-time binding. If the function call is to know at run time then it is called dynamic binding.


10. What is Message passing?

A. Object-Oriented Programming consists of a set of objects that communicate with each other. objects communicate with each other by sending and receiving information.


11. What is the String?

A. Strings are using for storing text. A string variable contains a collection of characters surrounded by double-quotes.


12. What is a Friend function?

A. It is to make an outside function friendly to a class. We have to simply declare this function as a friend of the class.
syntax: Class name {
             ...........
              ..........
              Public:
              ...........
              ...........
friend void xyz(void);//declaration };


13. What is Access specifiers?

A. 1.Public: Members are accessible from outside the class.
     2.Private: Members cannot be accessed from outside the class.
     3. Protected: Members cannot be accessed from outside the class, However, they can be accessed 
         in inherited classes.


14. What is Hierarchical inheritance?

A: When more than one class is derived from a single base class, such inheritance is known as hierarchical inheritance.


15. What is Hybrid inheritance?

A. It is called multipath inheritance, which is the process of deriving a class using more than one level or more than one mode of inheritance.


16. What is a Virtual function?

A. A virtual function is a member function that is declared within a base class and redefined by a derived class.


17. What is Template?

A. A template allows creating a family of classes.


18. What are Multiple inheritances?

A. A single class is derived from two or more parent classes.


19. What is Scope resolution operator(::)?

A. It is used to define a particular function outside a class and we can access global variables.
     Syntax: ::variable name 
     Syntax:return type class name::function.


20. What is Function overloading?

A. We can make two or more functions having the same name but they should be different in arguments.


21. What is Inline function?

A. An inline function is a function that is expanded in line when it is invoked. It will reduce the execution time.
Syntax: Inline function header
             {
                 function body
              }



22. What is Function prototyping?

A. The function prototype describes an interface to the compiler by giving details such as the number and type of arguments and type of return values.



23. What is  Data hiding or Information hiding?

A. The insulation of data from direct access by the program is called data hiding.



24. What is Operator overloading?

A. A single function name to perform different types of tasks is known as function overloading.



25. What is Static binding?

A. If the function calling knows at compile time then it is called static binding.

















No comments:

Post a Comment