Object Oriented Programming – Question and Answer

1. Define Encapsulation.

Encapsulation : It is a mechanism that associates the code and the data it manipulates into a single unit. In C++, this is supported by a construct called class.

2. What is an expression? Give an example.

Expression is a construct or operation created by combination of operators and operands. Example : c = a + b.

3. State the meaning of the public across specifier.

Public access members can be accessed from outside the class.

4. Can the precedence of an operator be altered?

Yes, the precedence of an operator be altered, by using the paranthesis.

5. What stream class is required to create an output stream?

Ostream class is used to create an output stream.

6. Why is it not possible to refer an exception declared within try block outside try block?

Exception declared within try block cannot be referred outside because it is out of scope.

7. Justify the statement “Java is platform independent”.

Changes and upgrades in operating system, processors and system resources will not trace any changes in java programs. This is why it is used on internet which interconnects different kinds of systems worldwide.

8. What is data encapsulation?

It is a mechanism that associated the code and data it manipulates into a single unit. In C++, this is supported by a construct called class.

9. What is meant by file access specifier?

File access specifies the visibility of data members and member functions.

10. What is dynamic initialisation of objects?

Objects can be initialized dynamically by using constructors.

11. Name few operators which can’t be overloaded.

::, Size of, ):, →*,::*.

12. What is abstract class?

A class which in not used to create an object.

13. Define method with reference to Java. How to call it?

Method is a function which is used to define a particular task. Method is called by using the object.

14. What is inline function?

Inline functions are those function whose body is inserted in place of the function all statement during the compilation process.

15. When are base class and derived class constructor and destructor functions called?

Base class constructors and derived class constructors are called when the object is created. Destructor function is called when the object is destroyed.

16. Can you use a ‘this’ pointer to a friend function? Comment on it.

‘This’ pointer cannot be used for function. Because it is a non-member function.

17. Compare ad contrast early and also binding.

Early binding : Binding or linking will take place during compilation time itself.
Late binding : Binding or linking will be postponded till run time.

18. When do you want to declare a class in a package public?

If we want to access the members of the other package then the class in a package will be declared as public.

About the author

Santhakumar Raja

Hi, This blog is dedicated to students to stay update in the education industry. Motivates students to become better readers and writers.

View all posts

Leave a Reply