Object
Oriented Programming with C++
Inheritance
Evaluation
Choose the correct answers
1. Which of the followingis the
process of creating new classes from an existing class
(a)
Polymorphism
(b) Inheritance
(c)
Encapsulation
(d)
super class
2. Which of the following derives a
class student from the base class school
(a)
school: student
(b) class student : public school
(c)
student : public school
(d)
class school : public student
3. The type of inheritance that
reflects the transitive nature is
(A)
Single Inheritance
(B)
Multiple Inheritance
(C) Multilevel Inheritance
(D)
Hybrid Inheritance
4. Which visibility mode should be
used when you want the features of the base class to be available to the
derived class but not to the classes that are derived from the derived class?
(A)
Private
(B)
Public
(C) Protected
(D)
All of these
5. Inheritance is process of
creating new class from
(A) Base class
(B)
abstract
(C)
derived class
(D)
Function
6. A class is derived from a class
which is a derived class itself, then this is referred to as
(A)
multiple inheritance
(B) multilevel inheritance
(C)
single inheritance
(D)
double inheritance
7. Which amongst the following is
executed in the order of inheritance?
(A)
Destructor
(B)
Member function
(C) Constructor
(D)
Object
8. Which of the following is true
with respect to inheritance?
(A)
Private members of base class are inherited to the derived class with private
(B) Private members of base class
are not inherited to the derived class with private accessibility
(C)
Public members of base class are inherited but not visible to the derived class
(D)
Protected members of base class are inherited but not visible to the
outsideclass
9. Based on the following class
declaration answer the questions (from 9.1 to 9.5 )
class
vehicle
{
int wheels;
public:
void
input_data(float,float);
void
output_data();
protected:
int
passenger;
};
class
heavy_vehicle : protected vehicle {
int
diesel_petrol;
protected:
int
load;
protected:
int
load;
public:
voidread_data(float,float)
voidwrite_data();
};
class
bus: private heavy_vehicle {
charTicket[20];
public:
voidfetch_data(char);
voiddisplay_data();
};
};
9.1. Which is the base class of the
class heavy_vehicle?
(a)
Bus
(b)
heavy_vehicle
(c) vehicle
(d)
both (a) and (c)
9.2. The data member that can be
accessed from the function displaydata()
(a)
passenger
(b)
load
(c) Ticket
(d)
All of these
9.3. The member function that can
be accessed by an objects of bus Class is
(a)
input_data() ,
(b)
read_data() ,output_data()write_data()
(c) fetch_data()
(d)
All of these display_data()
9.4. The member function that is
inherited as public by Class Bus
(a)
input_data() ,
(b)
read_data() , output_data()write_data()
(c) fetch_data()
(d)
All of these display_data()
10.
class
x
{
int a; public : x()
{}
};
class
y
{
x x1; public : y(){} };
class
z : public y,x
{
int
b; public: z(){} }z1;
What is the order of constructor
for object z1 to be invoked?
(A)
z , y,x,x
(B)
x,y,z,x
(c)
y,x,x,z
(D) x,y,z
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.