CS304 Quiz No.2 Dated
CS304 Quiz No.2 Dated
com
Select correct line of code for inheritance relationship between “Person” class and
“Supervisor” class. “Person” is parent class while “Supervisor” is child class.
Select correct option:
class Supervisor: public Person
class Person: public Supervisor
class Supervisor:: public Person
class Person:: public Supervisor
The direction specifies which object contains the other object. In composition direction
is must.
No
Yes
Select correct line of code for inheritance relationship between “Keys” class and
“SpecialKeys” class. “Person” is parent class while “SpecialKeys” is child class.
Select correct option:
class SpecialKeys: public Keys
class Keys: public SpecialKeys
class SpecialKeys:: public Keys
class Keys:: public SpecialKeys
www.vuplanet.com
www.vuplanet.com
“Keyboard” class is composed of “keys” class. What will be the order of execution of
constructor of “Keyboard” class and “Keys” class?
Select correct option:
First Detructor::Keys..
Second Destructor::Keyboard..
First Destructor:: Keyboard..
Second Destructor:: Keys..
“A fan has wings”. Which type of relationship exists between fan and wings?
Aggregation
Association
Composition
Inheritance
What type of relationship exists between “Account” class and “SavingAccount” class?
Inheritance
Composition
Aggregation
Association
Select correct line of code for inheritance relationship between “Nationality” class and
“Citizen” class. “Nationality” is parent class while “Citizen” is child class.
class Citizen: public Nationality
class Nationality: public Citizen
class Citizen:: public Nationality
class Nationality:: public Citizen
www.vuplanet.com
www.vuplanet.com
Let Suppose a class Student with objects std1, std2, and std3. For the statement std3 =
std1 - std2 to work correctly, if the overloaded - operator must
Select correct option:
take two arguments.
None of the given choices
take single argument
take three arguments
www.vuplanet.com
www.vuplanet.com
Person” class is composed off “Nationality” class. What will be the order of execution of
constructor of “Keyboard” class and “Keys” class
First Constructor:: Nationality..
Second Constructor:: Person..
First Constructor:: Person..
Second Constructor:: Nationality..
The direction specifies which object contains the other object. In aggregation direction
is must
Yes
No
Select correct line of code for inheritance relationship between “Account” class and
“SavingAccount” class. “Account” is parent class while “SavingAccount” is child clas
www.vuplanet.com
www.vuplanet.com
“Keyboard” class is composed off “keys” class. What will be the order of execution of
destructor of “Keyboard” class and “Keys” class
First Detructor::Keys..
Second Destructor::Keyboard..
First Destructor:: Keyboard..
Second Destructor:: Keys..
Select correct line of code for inheritance relationship between “Keys” class and
“StandardKeys” class. “Person” is parent class while “StandardKeys” is child class.
Select correct line of code for inheritance relationship between “Gender” class and
“Male” class. “Gender” is parent class while “Male” is child class.
class Male: public Gender
class Gender: public Male
class Male:: public Gender
class Gender:: public Male
What will be most appropriate C++ data type for variable “InterestRate
Int
long int
double
float
Select correct line of code for composition relationship between “Keyboard” class and
“Keys” class
www.vuplanet.com
www.vuplanet.com
Account()
SavingAccount()
CurrentAccount()
None of the given options
Can we access methods of composed object in the same way as we can access methods
of other objects?
Yes
No
The sub-object’s life is not dependant on the life of master class in ___________.
Composition
Aggregation
Seperation
non of the given
Select correct line of code for inheritance relationship between “Nationality” class and “Foreigner” class. “Nationality”
is parent class while “Foreigner” is child class.
“Foreigner” is child class.
class Foreigner: public Nationality
class Nationality: public Foreigner
class Foreigner:: public Nationality
Select correct line of code for aggregation relationship between “Person” class and
“Phone” class.
class Person { Phone * p; };
class Phone { Person * p; };
class Person { Phone p; };
class Phone { Person p; };
In ______________destructor of sub-object is called after destructor of master class.
smilechat: options
Aggregation
Composition
Inheritance
Association
correct line of code for inheritance relationship between “Gender” class and “Female”
class. “Gender” is parent class while “Female” is child
class.
class Female: public Gender
class Gender: public Female
class Female:: public Gender
class Gender:: public Female
www.vuplanet.com
www.vuplanet.com
Account” is parent class while “CurrentAccount” is child class. Can I inherit the
destructor of “account” class?
Yes
No
Select correct line of code for aggregation relationship between “Person” class and
“Address” class.
class Person { Address * a; };
class Address { Person * a; };
class Person { Address a; };
class Address { Person a; };
What will be most appropriate C++ data type for variable “MinimumBalance”?
Select correct option:
int
long int
float
double
Person” class is composed off “Nationality” class. What will be the order of execution of
constructor of “Keyboard” class and “Keys” class
First Constructor:: Nationality..
Second Constructor:: Person..
First Constructor:: Person..
Second Constructor:: Nationality..
The direction specifies which object contains the other object. In aggregation direction
is must
Yes
No
Select correct line of code for inheritance relationship between “Account” class and
“SavingAccount” class. “Account” is parent class while “SavingAccount” is child clas
class SavingAccount : public Account
class Account: public SavingAccount
class SavingAccount :: public Account
www.vuplanet.com
www.vuplanet.com
“Keyboard” class is composed off “keys” class. What will be the order of execution of
destructor of “Keyboard” class and “Keys” class
First Detructor::Keys..
Second Destructor::Keyboard..
Select correct line of code for inheritance relationship between “Keys” class and
“StandardKeys” class. “Keys” is parent class while “StandardKeys” is child class.
Select correct line of code for inheritance relationship between “Gender” class and
“Male” class. “Gender” is parent class while “Male” is child class.
class Male: public Gender
class Gender: public Male
class Male:: public Gender
class Gender:: public Male
What will be most appropriate C++ data type for variable “InterestRate
Int
long int
double
float
Select correct line of code for composition relationship between “Keyboard” class and
“Keys” class
class keyboard { Keys type;};
class keys{ KeyBoard type; };
class keyboard : private keys
class keys: private KeyBoard
www.vuplanet.com
www.vuplanet.com
Can we access methods of composed object in the same way as we can access methods
of other objects?
Yes
No
Let Suppose a class Student with objects std1, std2, and std3. For the statement std3 =
std1 - std2 to work correctly, if the overloaded - operator must
Select correct option:
take two arguments.
None of the given choices
take single argument
take three arguments
www.vuplanet.com
www.vuplanet.com
www.vuplanet.com