Object Oriented Programming: Chapter 3: Inheritance and Compile Time Polymorphism

Inheritance and Compile Time Polymorphism: Two Marks Important Questions and Answers

Object Oriented Programming - C++

Object Oriented Programming - C++ : Chapter 3: Inheritance and Compile Time Polymorphism : Anna University Part A Two Marks Important Questions and Answers

Object Oriented Programming – C++

Chapter 3: Inheritance and Compile Time Polymorphism

 

Two Marks Questions with Answers


1. What is single inheritance ?

Answer:

The single inheritance is one of the form of inheritance in which there is only one base class and from this base class only one class can be derived. This is the most common and simple form of inheritance.

 

2. Specify the situation in which protected member is used.

Answer:When the members of a class should be accessible by its immediate derived class(child class) and not by the derived class of derived class(grand child class) then in that situation the protected members are used.

 

3. What is multilevel inheritance ?

Answer: When the derived class is derived from a base class which itself is derived class then that type of inheritance is called multilevel inheritance.

 

4. How can a private member be made inheritable ?

Answer:: We can not inherit the private members of a class, but we can use friend function to access the private members.

 

5.  How are virtual functions declared in C++?

Answer:Virtual function is a member function that is declared within a base class and redefined by a derived class. The virtual keyword is preceded to the function name. This virtual function can be redefined in the derived class. The virtual function within the base class defined the form of the interface to that function. Each redefinition of the virtual function by a derived class indicate some different task related to derived class.

 

6. What is abstract class in cpp in C++ ?

Answer: Abstract class is a kind of base class in which at least one pure virtual function is present. The abstract classes can be used to specify an interface that must be implemented by all subclasses.

 

7. Give any two rules for overloading operators.

Answer:

1. Only existing operators can be overloaded and the basic meaning of the operators can not be changed.

2. Overloaded operator must follow the syntax of the original operator. For example for binary operator the syntax is operand1 operator operand2. This original syntax must not be changed during overloading.

 

8.  What is the necessary condition for an assignment operator to get overloaded?

Answer: The assignment condition should always be overloaded if an object dynamically allocates memory.

 

9. Is it possible to change the precedence of operators in operator overloading?

Answer: No it is not possible to change the precedence of operator during operator overloading.

 

10. Give syntax of operator function.

Answer: The keyword operator followed by operator symbol such as +, ‒ then followed by the argument list in the bracket. For example

Vector operator+(Vector obj);

 

11. What is the use of operator overloading ?

Answer: Operator overloading is a technique by which operators used in a programming language are implemented in user‒defined type. In this technique the operation can be performed on one or both operands that are of user‒defined class or structure type. This helps user‒defined types to behave much like the fundamental primitive data types.

 

Object Oriented Programming: Chapter 3: Inheritance and Compile Time Polymorphism : Tag: Oops, Computer Programming : Object Oriented Programming - C++ - Inheritance and Compile Time Polymorphism: Two Marks Important Questions and Answers


Object Oriented Programming: Chapter 3: Inheritance and Compile Time Polymorphism



Under Subject


Object Oriented Programming (OOPs)

CS25C07 2nd Semester CSE, CSE(CY) Depts | 2025 Regulation | 2nd Semester 2025 Regulation



Related Subjects


English Essentials II

EN25C02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation



Linear Algebra

MA25C02 2nd Semester | 2025 Regulation


Applied Physics (CSIE) II

PH25C03 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Digital Principles and Computer Organization

CS25C06 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Basic Electrical and Electronics Engineering

EE25C01 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Object Oriented Programming (OOPs)

CS25C07 2nd Semester CSE, CSE(CY) Depts | 2025 Regulation | 2nd Semester 2025 Regulation


Re-Engineering for Innovation

ME25C05 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Object Oriented Programming (OOPs) - Laboratory

CS25C07 2nd Semester CSE, CSE(CY) Depts | 2025 Regulation | 2nd Semester 2025 Regulation