CS304 Object Oriented Programming Online Solved MCQ's Quizzes File 1



The ______ keyword tells the compiler
to substitute the code within the
function definition for every instance
of a function call
Select correct option :
virtual
inline
instance
none of the given



Which of the following is a weak
relationship between two objects ?
Select correct option :
Inheritance
Composition
Aggregation
None of given

Only tangible things can be chosen as
an object .
Select correct option :
True
False


Consider the code below, class class1{ private: int i; }; class class2 : private class1 { }; Then int member i of class1 is ____ in class2,public
protected
private
none of the given options
If there is a pointer, p, to objects of a base class, and it contains the address of an object of a derived class, and both classes contain a virtual member function, ding(), then the statement p->ding(); will cause the version of ding() in the ___ class to be executed.
base
derived

virtual
implemented
A class template may inherit from another class template.
True
False
Derived class can inherit from public base class as well as private and protected base classesTrue
False
Two functions with same names, parameters and return type can exist in,
Function overloading
Function overriding

Operator overloading
None of these options
Consider the code below, class class1{ private: int i; }; class class2 : public class1 { }; Then int member i of class1 is ____ in class2,public
protected
private
none of the given options
Target of a _____ function call is determined at run time.instance
virtualoperator
none of given
In case base and derived classes are
behaviorally compatiable , base class can
always be replaced by derived class .
Select correct option :
True
False

Which of the following types is an
example of intangible object?
Select correct option :
Chair
Pencil
Time table
Book

We can create array of objects if we
have a user defined constructor .
Select correct option :
True
False

Which of the following parts of an
object exhibits its state ?
Select correct option :
Data
Operations
Any public part
Any private part


A template argument is preceded by
the keyword ________ .
Select correct option :
vector
class
template
type *

The Specialization pattern after the
name says that this specialization is to
be used for every_____.
Select correct option :
data type
meta types
virtual types
pointers type


Select correct line of code for
inheritance relationship between
“ Nationality ” class and “ Foreigner ”
class. “ Nationality ” is parent class
while “ Foreigner ” is child class.
Select correct option :
class Foreigner : public Nationality
class Nationality : public Foreigner
class Foreigner :: public Nationality
class Nationality :: public Foreigner

In _____________ sub- object has a life
that is NOT dependant on the life of
its master class.
Select correct option :
Aggregation
Composition
Inheritance
Association KKK


A class hierarchy
Select correct option :
shows the same relationships as an
organization chart.
describes “ has a ” relationships .
describes “ is a kind of ” relationships .
shows the same relationships as a
family tree.


Suppose that the Test class does not have an overloaded assignment operator. What happens when an assignment a=b; is given for two Test objects a and b?
► The automatic assignment operator is used
► The copy constructor is used
► Compiler error
► Run-time error
Question No: 2 ( Marks: 1 ) - Please choose one

A static member function can be called, even when a class is not __________.
► Declared
► Define
► Instantiated
► Called
Question No: 3 ( Marks: 1 ) - Please choose one
Identify which of the following overloaded operator function’s declaration is appropriate for the given call?
Rational_number_1 + 2.325
Where Rational_number_1 is an object of user defined class Rational_number.
► Rational_number operator+( Rational_number & obj);
► Rational_number operator+(double& obj);
► Rational_number operator+(Rational_number &obj, double& num);
► operator+(double& obj);
Question No: 4 ( Marks: 1 ) - Please choose one
What problem(s) may occur when we copy objects without using deep copy constructor?
► Dangling pointer
► Memory Leakage
► All of the given
► System crash
Question No: 5 ( Marks: 1 ) - Please choose one
__________ provide the facility to access the data member.
► accesser function
► private function
► inline function
► None of the given
Question No: 6 ( Marks: 1 ) - Please choose one
Constant objects cannot change their state,
► True
► False
Question No: 7 ( Marks: 1 ) - Please choose one

The ________ relationship indicates that an object contains other objects.
► None of given
► ‘has-a’
► ‘is-a’
► ‘be-
Question No: 8 ( Marks: 1 ) - Please choose one
Which one of the following features of OOP is used to derive a class from another?
► Encapsulation
► Polymorphism
► Data hiding
► Inheritance

Adding a derived class to a base class
requires fundamental changes to the
base class .
Select correct option :
True
False


User can make virtual table explicitly .
Select correct option :
True
False


Binding means that target function for
a call is selected at compile time .
Select correct option : Static Dynamic
Automatic
None of given


Target of a _____ function call is
determined at run time.
Select correct option :
instance
virtual
operator
none of given

________ Binding means that target function for a call is selected at run timeAutomatic
Dynamic
Static
Dramatic

correct line of code for inheritance
relationship between “ Nationality ” class
and “ Foreigner ” class. “ Nationality ” is
parent class while
“ Foreigner ” is child class.
class Foreigner : public Nationality
class Nationality : public Foreigner
class Foreigner :: public Nationality


Which line will produce error . Class
phone : private Transmit , private
Receiver { } 1 . int main() 2 . { 3 . phone
obj; 4 . Tranmit * obj1 = & obj ; 5 .
Received obj2 = & obj; 6 . }
Select correct option :
3 rd line will produce error
4 th line will produce error
3 rd and 4 th line will produce error .
5 th line will produce error





Consider the code below , class
class1 { public: void func 1 (); }; class
class2 : protected class1 { }; Function
func1 of class1 is ____ in class 2 ,
Select correct option :
public
protected
private
none of the given options


the following statements: 1 ) int iArray
[ 5 ]; 2 ) int *pArr = iArray ;
Select correct option :
These statements will compile
successfully
Error in first statement
Error in second statement
None of given options

A template provides a convenient way to make a family of.
variables and data members 
functions and classes 
classes and exceptions 
programs and algorithms

A Class hierarchy
Shows the same relationships as an organization chart
Describes “has a” relationships.
Describes “is a kind of” relationships.

Shows the same relationships as a family tree

A class template may inherit from another class template.
True
False

Target of a _____ function call is determined at run time.
instance
virtual operator 
none of given
A class hierarchy .

shows the same relationships as an organization chart.
describes “has a” relationship. 
describes “is a kind of” relationships. 
shows the same relationships as a family tree.

Sender of the message does not need to know the exact class of receiver in______.Abstraction 
Polymorphism 
Inheritance 
none of the given

A function call is resolved at run-time in_________ .
non-virtual member function
virtual member function 

Both non-virtual member and virtual member function. 
None of given

Adding a derived class to a base class requires fundamental changes to the base class.
True
False

User can make virtual table explicitly.
True
False

 Vukwl- Virtual Education Solution

Binding means that target function for a call is selected at compile time.
Static
Dynamic
Automatic 
None of given

Target of a _____ function call is determined at run time.
instance
virtual 
operator 
none of given

Which line will produce error. Class phone: private Transmit, private Receiver { } 1. int main() 2. { 3. phone obj; 4. Tranmit* obj1 = &obj; 5. Received obj2 = &obj; 6. }.
3rd line will produce error
4th line will produce error 
3rd and 4th line will produce error. 
5th line will produce error



Consider the code below, class class1{ public: void func1(); }; class class2 : protected class1 { }; Function func1 of class1 is ____ in class2, public 
protected 
private 
none of the given options

The following statements: 1) int iArray[5]; 2) int *pArr = iArray;These statements will compile successfully 
Error in first statement 
Error in second statement 
None of given options

Methodologies to the development of reusable software relate to________Structure programming 
procedural programming 
generic programming 
None of the given

Function template must have a parameter. 
True 
False

 Vukwl- Virtual Education Solution

The default inheritance mode is, 
Public inheritance 
Protected inheritance 
Private inheritance
 None of these options

Two functions with same names, parameters and return type can exist in,
Function overloading 

Function overriding 
Operator overloading 
None of these options

Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 : public c2 { }; Then c2 is, 
Direct base class of c3 
Direct child class of c3 
Direct base class of c1 
None of these

Virtual functions allow you to create an array of type pointer-to-base class that can hold pointers to derived classes. 
create functions that can never be accessed. 
group objects of different classes so they can all be accessed by the same function code. 
use the same function call to execute member functions of objects from different classes.

User can make virtual table explicitly. 
True 
False
In order to define a class template the first line of definition must be:
template <typename T>
 

typename <template T> 
Template Class <ClassName> 
Class <Template T>

Consider the following statements: 1) int iArray[5]; 2) int *pArr = iArray; These statements will compile successfully 
Error in first statement 
Error in second statement 
None of given options
In c++ dynamic binding and polymorphism will be achieved when member function will be __.private 
public 
virtual 
inline

In type in depended function template should be use where code and behavior must be identical.
True 

False

 Vukwl- Virtual Education Solution

Consider the code below, class class1{ protected: int i; }; class class2 : private class1 { }; Then int member i of class1 is ____ in class2, public 
protected 
private 
none of the given options

In specialization we can, 
Replace child class with its base class 
Replace base class with its child class (Not Sure) 
Replace both child and base classes interchangeably 
None of the given options

Consider the code below, class class1{ public: void func1(); }; class class2 : public class1 { }; Function func1 of class1 is ____ in class2,
public 
protected

private 
none of the given options

It is illegal to make objects of one class members of another class.
True
False

An abstract class is useful when no classes should be derived from it. 
there are multiple paths from one derived class to another.
no objects should be instantiated from its.
you want to defer the declaration of the class.

In resolution order compiler search firstly _______.Generic Template 
Partial Specialization 
Complete Specialization 
Ordinary function



In private inheritance derived class pointer can be assigned to base class pointer in.
Main function
In derived class member and friend functions 
In base class member and friend functions 
None of the given options

Which statement will be true for concrete class? it implements an virtual concept. 
it can be instantiated it cannot be instantiated 
none of given

Information hiding can be achieved through__________.
  1. Encapsulation, Inheritance
  2. Encapsulation, Polymorphism
  3. Encapsulation, Abstraction
  4. Overloading
Question # 2 of 10 ( Start time: 01:11:21 AM ) Total M - 1
A good model is ................ related to a real life problem.
Select correct option:
  1. Loosely
  2. Openly
  3. Closely
Question # 3 of 10 ( Start time: 01:12:33 AM ) Total M - 1
Which of the following features of OOP is used to derive a class from another?
Select correct option:
  1. Encapsulation
  2. Polymorphism
  3. Data hiding
  4. Inheritance


Question # 4 of 10 ( Start time: 01:13:51 AM ) Total M - 1
Which of the following is a weak relationship between two objects?
Select correct option:
  1. Inheritance
  2. Composition
  3. Aggregation
  4. None of given
Question # 5 of 10 ( Start time: 01:14:56 AM ) Total M - 1
Data items in a class must be private.
Select correct option:
  1. True
  2. False



c++ dynamic binding and polymorphism will be achieved when member function will be __.private 
public 
virtual inline

 Vukwl- Virtual Education Solution

Consider the code below, class class1{ protected: void func1(); }; class class2 : public class1 { }; Function func1 of class1 is ____ in class2, public 
protected
private 
none of the given options

template<> class Vector{ void** p; //.... void*& operator[] ((int i); }; This specialization can then be used as the common implementation for all Vectors of pointers.
This specialization can then be used as the all type implementation for one type classes. 
This specialization can then be used double type pointers. 


This specialization should be used for Vectors of all type int types.

Consider the code below, class class1{ protected: int i; }; class class2 : protected class1 { }; Then int member i of class1 is ____ in class2, public 
protected 
private none of the given options

Consider the code below, class class1{ private: void func1(); }; class class2 : private class1 { }; Function func1 of class1 is ____ in class2, public 
protected 
private 
none of the given options

Target of a _____ function call is determined at run time.
instance
virtual operator 
none of given

Consider the following statements: 1) int iArray[5]; 2) int *pArr = iArray; 
These statements will compile successfully 
Error in first statement 
Error in second statement 
None of given options


To initialize an array of objects , only
_____________ will be called
Select correct option :
Defualt Constructor
Overloaded Constructor
Default Object



None of the above

Consider the code below, class class1{ private: int i; }; class class2 : private class1 { }; Then int member i of class1 is____ in class2,
public 
protected 
private
none of the given options

If there is a pointer, p, to objects of a base class, and it contains the address of an object of a derived class, and both classes contain a virtual member function, ding(), then the statement p->ding(); will cause the version of ding() in the___ class to be executed.
base
derived
virtual 
implemented

A class template may inherit from another class template.
True 

False

Derived class can inherit from public base class as well as private and protected base classes 
True 
False


Two functions with same names, parameters and return type can exist in,
Function overloading

 Function overriding 
Operator overloading 
None of these options

Consider the code below, class class1{ private: int i; }; class class2 : public class1 { }; Then int member i of class1 is____ in class2, public 
protected 
private 
none of the given options

 Vukwl- Virtual Education Solution

Target of a _____ function call is determined at run time.
instance
virtual
operator 
none of given



A class hierarchy 
shows the same relationships as an organization chart. 
describes “has a” relationships. 
describes “is a kind of” relationships. 
shows the same relationships as a family tree.

Consider the code below, class class1{ public: int i; }; class class2 : public class1 { }; Then int member i of class1 is____ in class2,
public

 protected 
private 
none of the given options

Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 : public c2 { }; Then c1 is, Direct base class of c3 
Direct child class of c3 
Direct base class of c2 
Direct child class of c2


_____ is creating objects of one class
inside another class.
Association
Composition
Aggregation
Inheritance
______ in class 2 ,
Select correct option :
public
protected
private
none of the given options

A class template may inherit from
another class template .
Select correct option :
True
False

A class D can be derived from a class
C, which is derived from a class B ,
which is derived from a class A .
Select correct option :
True
False

In c + + dynamic binding and
polymorphism will be achieved when
member function will be ____ .
Select correct option :
private
public
virtual
inline

A parent class can call constructor of
its child class through ,
Select correct option :
Its constructor initialization list
Its constructor body
Both from its constructor initialization
list or body
Can not call the constructor of its
child class

A template provides a convenient way
to make a family of
Select correct option :
variables and data members
functions and classes
classes and exceptions
programs and algorithms

Copy constructor is called when :
Select correct option :
An object is created in term of pre
existence object
An object is created
An object is initialized
None of the given

Consider the code below , class
class1 { private : int i ; }; class class2 :
protected class 1 { }; Then int member i
of class 1 is
______ in class 2 ,
Select correct option :
public
protected
private
none of the given options

__________ Binding means that target
function for a call is selected at
compile time.
Select correct option :
Static
Dynamic
Automatic
None of given

“ 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 Constructor : :Keys .. then
Constructor :: Keyboard ..
First Constructor : : Keyboard .. then
Constructor :: Keys ..




Class is not a mechanism to create
objects and define user data types .
True
False


Which of the following operator doesn' t
take any argument if overloaded?
/
+
.
None of Given


Object can be declared constant with
the use of Constant keyword .
True
False


Associatively can be change in operator
overloading.
True
False

In _______________ a pointer or
reference to an object is created inside
a class
Select correct option :
Aggregation
Composition
Seperation
None of the given


Sub - Object can not be initialized using
the constructor
Select correct option :
True
False


To initialize an array of objects , only
_____________ will be called
Select correct option :
Defualt Constructor
Overloaded Constructor
Default Object
None of the above

The sub - object ’ s life is not dependant
on the life of master class in _ _ _ _ _ _ _
_ _ _ _ .
compostion





Consider the call given below of an
overloaded operator " + " , Rational _
number _ 1 + Rational _ number _ 2 Where
Rational _ number _ 1 and Rational _
number _ 2 are the two objects of
Rational _ number class ( a user defined
class) . Identify which of the above two
objects will be passed as an argument
to the overloaded operator function ?
Rational _ number _ 1
None of the given choices


Sub - Object can not be initialized using
the constructor
True
False



Methodologies to the development of
reusable software relate to _ _______ .
Select correct option :
Structure programming
procedural programming
generic programming
None of the given


function template must have a
parameter.
Select correct option :
True
False

The default inheritance mode is ,
Select correct option :
Public inheritance
Protected inheritance
Private inheritance
None of these options


Two functions with same names ,
parameters and return type can exist
in ,
Select correct option :
Function overloading
Function overriding
Operator overloading
None of these options


Consider the code below , class c 1 { };
class c2 : public c1 { }; class c 3 : public
c2 { }; Then c 2 is ,
Select correct option :
Direct base class of c3
Direct child class of c 3
Direct base class of c1
None of these


Virtual functions allow you to
Select correct option :
create an array of type pointer - to-
base class that can hold pointers to
derived classes .
create functions that can never be
accessed .
group objects of different classes so
they can all be accessed by the same
function code .
use the same function call to execute
member functions of objects from
different classes .


User can make virtual table explicitly .
Select correct option :
True
False


In order to define a class template the
first line of definition must be :
Select correct option :
template < typename T >
typename < template T >
Template Class < ClassName >
Class < Template T >


Consider the following statements: 1 )
int iArray [ 5 ]; 2 ) int * pArr = iArray ;
Select correct option :
These statements will compile
successfully
Error in first statement
Error in second statement
None of given options



In _______________ a pointer or
reference to an object is created inside
a class
Select correct option :
Aggregation
Composition
Seperation
None of the given


Sub - Object can not be initialized using
the constructor
Select correct option :
True
False


To initialize an array of objects , only
_____________ will be called
Select correct option :
Defualt Constructor
Overloaded Constructor
Default Object
None of the above


Let Suppose a class Student with
objects std 1 , std 2 , and std 3 . For the
statement std 3 = std 1 – std 2 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




Which of the following operator doesn’ t
take any argument if overloaded?
Select correct option :
/
-
+
None of the given choices


Object can be declared constant with
the use of Constant keyword .
Select correct option :
True
False


Always make pointer to null , whenever
dynamic memory is deleted .
Select correct option :
True
False


__________ provide the facility to
access the data member.
Select correct option :
accesser function
private function
inline function
None of the given


Friend Functions of a class are
_________ members of that class .
Select correct option :
Public
Private
Protected
None of the given options .


Let Suppose a class Student with
objects std 1 , std 2 , and std 3 . For the
statement std 3 = std 1 - std 2 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

Consider the code below , class
class1 { protected : int i ; }; class
class2 : protected class1 { }; Then int
member i of class1 is ______ in class 2 ,
Select correct option :
public
protected
private
none of the given options

A Child class can call constructor of its
parent class through ,
Select correct option :
Its constructor initialization list
Its constructor body
Both from its constructor initialization
list or body -
Can not call the constructor of its
parent class

We can
access private members of the class
from outside the class using ______
operator with its object pointer .
Select correct option :
- >
.
&
None of the given options

A function call is resolved at run - time
in ___________
Select correct option :
non - virtual member function
virtual member function
Both non - virtual member and virtual
member function .
None of given

It is sometimes useful to specify a
class from which no objects will ever be
created .
Select correct option :
True
Flase

Consider the code below , class
class1 { public: void func 1 (); }; class
class2 : private class 1 { }; Function
func1 of class1 is ______ in class 2 ,
Select correct option :
public
protected
private
none of the given options

Consider the code below , class
class1 { public: int i ; }; class class 2 :
protected class 1 { }; Then int member i
of class 1 is ______ in class2 ,
Select correct option :
public
protected
private
none of the given options

Static casting is,
Select correct option :
Implicit way of calling base class
functions from derived class
Explicit way of calling base class
functions from derived class
None of these
Both of these


Consider the code below , class
class1 { protected : void func 1 (); };
class class2 : public class1 { }; Function
func1 of class1 is ______ in class 2 ,
Select correct option :
public
protected
private
none of the given options



Sender of the message does not
need to know the exact class of
receiver in ______ .
Please chose one
Abstraction
Polymorphism
Inheritance
none of the given


Target of a _____ function call is
determined at run time.
Please chose one
instance
virtual
operator
none of given


A function call is resolved at run - time
in _________ .
Please chose one
non - virtual member function
virtual member function
Both non - virtual member and virtual
member function .
None of given


Consider the code below , class
class1 { public: void func 1 (); }; class
class2 : protected class1 { }; Function
func1 of class1 is ____ in class 2 ,
Please chose one
public
protected
private
none of the given options


Consider the code below , class c 1 { };
class c2 : public c1 { }; class c 3 : public
c2 { }; Then c 2 is ,
Please chose one
Direct base class of c3
Direct child class of c 3
Direct base class of c1
None of these


A template provides a convenient way
to make a family of .
Please chose one
Variables and data members
Functions and classes
classes and exceptions
programs and algorithms


Consider the code below , class c 1 { };
class c2 : public c1 { }; class c 3 : public
c2 { }; Then c 1 is ,
Please chose one
Direct base class of c3
Direct child class of c 3
Direct base class of c2
Direct child class of c 2


User can make virtual table explicitly .
Please chose one
True
False


In type in depended function template
should be use where code and behavior
must be identical .
Please chose one
True
False


Consider the code below , class
class1 { protected : int i ; }; class
class2 : private class 1 { }; Then int
member i of class1 is ____ in class 2 ,
Please chose one
public
protected
private
none of the given options


What will be most appropriate C + + data
type for variable “ InterestRate ”?
Select correct option :
int
long int
double
=> float

Select correct line of code for
aggregation relationship between
“ Person ” class and “ Address” class .
Select correct option :
=> class Person { Address * a ; };
class Address { Person * a ; };
class Person { Address a ; };
class Address { Person a ; };

__________is creating objects of one
class inside another class.
Select correct option :
Aggregation
=> Composition
Inheritance
Association

What type of relationship exists
between “ SavingAccount ” class and
“ CurrentAccount ” class?
Select correct option :
Both are child classes
Both contains each other
=? Both are composed of each other
None of the given option

In ______________ destructor of sub-
object is called after destructor of
master class.
Select correct option :
Aggregation
=> Composition
Inheritance
Association

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 option :
=> class StandardKeys : public Keys
class Keys : public StandardKeys
class StandardKeys :: public Keys
class Keys :: public StandardKeys

Select correct line of code for
aggregation relationship between
“ Person ” class and “ Phone” class.
Select correct option :
=> class Person { Phone * p ; };
class Phone { Person * p ; };
class Person { Phone p ; };
class Phone { Person p ; };

A template provides a convenient way
to make a family of
Select correct option :
variables and data members
functions and classes
classes and exceptions
programs and algorithms


A class template may inherit from
another class template .
Select correct option :
True
False

“ Keyboard ” class is composed off
“ keys ” class. What will be the order of
execution of destructor of “ Keyboard ”
class and “ Keys” class ?
Select correct option :
First Detructor: :Keys .. Second
Destructor : :Keyboard . .
=> First Destructor : : Keyboard ..
Second Destructor :: Keys. .

There is an object of type Person ,
which of the following can be
considered as one of its attributes :
Select correct option :
Name
Workat ()
Age
=> Both age and name

Select correct line of code for
composition relationship between
“ Keyboard ” class and “ Keys ” class.
Select correct option :
=> class keyboard { Keys type ;};
class keys { KeyBoard type ; };
class keyboard : private keys
class keys : private KeyBoard




Select correct line of code for
inheritance relationship between
“ Gender ” class and “ Male ” class.
“ Gender ” is parent class while “ Male ”
is child class.
Select correct option :
class Male: public Gender
class Gender : public Male
class Male:: public Gender
class Gender :: public Male


In ______________, a pointer or
reference to an object is created inside
a class.
Select correct option :
Aggregation
Composition
Inheritance
Association


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


Keyboard ” class is composed off
“ keys ” class. What will be the order of
execution of destructor 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

Question No: 5 ( Marks: 1 )
It is sometimes useful to specify a class from which no objects will ever be created.
True
False
Question No: 6 ( Marks: 1 )
Assume a class Derv that is privately derived from class Base. An object of class Derv
located in main() can access
public members of Derv.
protected members of Derv.
private members of Derv.
protected members of Base.
Question No: 7 ( Marks: 1 ) 
A pointer to a base class can point to objects of a derived class.
True
False
Question No: 8 ( Marks: 1 )
A copy constructor is invoked when
a function do not returns by value.
an argument is passed by value.
a function returns by reference.
an argument is passed by reference.
Question No: 9 ( Marks: 1 )
A function call is resolved at run-time in___________
non-virtual member function.
virtual member function.
Both non-virtual member and virtual member function.
None of given
Question # 8
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


Identify which of the following
overloaded operator function ' s
declaration is appropriate for the given
call? Rational _ number _ 1 + 2 . 325 Where
Rational _ number _ 1 is an object of user
defined class Rational _ number .
Select correct option :
Rational _ number operator
+ ( Rational _ number & obj );
None of the given choices
Rational _ number operator
+ ( Rational _ number & obj , double &
num );
operator+ (double & obj );


When the base class and the derived class have a member function with the same name, you must be more specific which function you want to call (using ___________).
scope resolution operator
dot operator
null operator
Operator overloading
Question No: 11 ( Marks: 1 )
Each try block can have _____no. of catch blocks.
1
2
3
As many as necessary.
Question No: 12 ( Marks: 1 )
Two important STL associative containers are ______and _______.
set,map
sequence,mapping
setmet,multipule
sit,mat
Question No: 13 ( Marks: 1 )
The mechanism of selecting function at run time according to the nature of calling object
is called,
late binding
static binding
virtual binding
None of the given options
Question No: 14 ( Marks: 1 )
An abstract class is useful when,
We do not derive any class from it.
There are multiple paths from one derived class to another.
We do not want to instantiate its object.
You want to defer the declaration of the class.

In _______________ a pointer or
reference to an object is created inside
a class
Select correct option :
Aggregation
Composition
Seperation
None of the given


Sub - Object can not be initialized using
the constructor
Select correct option :
True
False


To initialize an array of objects , only
_____________ will be called
Select correct option :
Defualt Constructor
Overloaded Constructor
Default Object
None of the above

Consider the code below, class class1{ public: void func1(); }; class class2 : protected class1 { }; Function func1 of class1 is ____ in class2,public
protected
private
none of the given options
The following statements: 1) int iArray[5]; 2) int *pArr = iArray;These statements will compile successfully
Error in first statement
Error in second statement
None of given options

Let Suppose a class Student with
objects std 1 , std 2 , and std 3 . For the
statement std 3 = std 1 - std 2 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


Copy constructor is called when :
Select correct option :
An object is created in term of pre
existence object
An object is created
An object is initialized
None of the given


Which of the following operator doesn' t
take any argument if overloaded?
Select correct option :
/
-
+
None of the given choices


Object can be declared constant with
the use of Constant keyword .
Select correct option :
True
False


Always make pointer to null , whenever
dynamic memory is deleted .
Select correct option :
True
False


__________ provide the facility to
access the data member.
Select correct option :
accesser function
private function
inline function
None of the given


User can make virtual table explicitly.
True

False
Binding means that target function for a call is selected at compile time.
Static
Dynamic

Automatic
None of given
Target of a _____ function call is determined at run time.instance
virtual
operator
none of given
Which line will produce error. Class phone: private Transmit, private Receiver { } 1. int main() 2. { 3. phone obj; 4. Tranmit* obj1 = &obj; 5. Received obj2 = &obj; 6. }.3rd line will produce error
4th line will produce error
3rd and 4th line will produce error.
5th line will produce error
Function overriding is done in context of,Single class
Single derived class
Single base class
Derived and base classes

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
class Account : : public SavingAccount


“ 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 .
class StandardKeys: public Keys
class Keys: public StandardKeys
class StandardKeys:: public Keys
class Keys: : public StandardKeys


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


Method “ getInterestRate()” should
belongs to class
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


correct line of code for inheritance
relationship between “ Nationality ” class
and “ Foreigner ” class. “ Nationality ” is
parent class while
“ 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


Account ” is parent class while
“ CurrentAccount ” is child class . Can I
inherit the destructor of “ account”
class?
Yes
no

Consider the code below, class class1{ private: void func1(); }; class class2 : private class1 { }; Function func1 of class1 is ____ in class2,public
protected
private
none of the given options
Target of a _____ function call is determined at run time.instance
virtualoperator
none of given
Consider the following statements: 1) int iArray[5]; 2) int *pArr = iArray;These statements will compile successfully
Error in first statement
Error in second statementNone of given options


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 ; };


In ______________ constructors of the
sub- objects are always executed
before the constructors of the master
class.
Select correct option :
Aggregation
Composition
Inheritance
Association

A class template may inherit from another class template.
True
False
A function call is resolved at run-time in_________non-virtual member function
virtual member function
Both non-virtual member and virtual member function.None of given
A class hierarchyshows the same relationships as an organization chart.
describes “has a” relationships.
describes “is a kind of” relationships.shows the same relationships as a family tree.
Consider the code below, class class1{ public: int i; }; class class2 : public class1 { }; Then int member i of class1 is ____ in class2,
public
protected

private
none of the given options
Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 : public c2 { }; Then c1 is,Direct base class of c3
Direct child class of c3
Direct base class of c2
Direct child class of c2
A class can inherit from more then one class is called.Simple inheritance
Multiple inheritances
Single inheritance
Double inheritance
template<> class Vector{ void** p; //.... void*& operator[] ((int i); };
This specialization can then be used as the common implimentation for all Vectors of pointers.
This spcialization can then be used as the all type implimentation for one type classes.
This specialization can then be used double type pointers.
This specialization should be used for Vectors of all type int types.
Consider the code below, class class1{ public: int i; }; class class2 : protected class1 { }; Then int member i of class1 is ____ in class2,public
protected
private
none of the given options


What will be most appropriate C + + data
type for variable “ MinimumBalance ”?
Select correct option :
int
long int
float
double


5. Public member function exposed by a class is called surface
A. TRUE
B. FALSE
False
Public member function exposed by a class is called Interface.

6. If class A supports all the operations of class B, then class A is:
A. Class A is behaviourally compatible with class B
B. Class A is behaviourally incompatible with class B
C. Class A is independent of class B
D. None of the given
Class A is behaviourally compatible with class B.

7. A fan has wings”. Which type of relation exists between fan and wings in this sentence?
A. Aggregation
B. Association
C. Generalization
D. Composition
Composition
Composition is a stronger relationship, because Composed object becomes a part of the composer Composed object can't exist indepedently.


Which one of the following terms must relate to polymorphism?
Static allocation
Static typing
Dynamic binding
Dynamic allocation
Question No: 2 ( Marks: 1 )
Multiple inheritance can be of type
Public
Private
Protected
All of the given
Question No: 3 ( Marks: 1 )
When a subclass specifies an alternative definition for an attribute or method of its
superclass, it is ______the definition in the superclass.
overload
overriding
copy riding
none of given
Question No: 4 ( Marks: 1 )
Like template functions, a class template may not handle all the types successfully.
True
False
8. Which is true about sub-typing in case of inheritance?
A. In sub-typing a new class is derived from existing where the derived class shows some extended behavior of its parent.
B. In sub-typing a new class is derived from existing which is a restricted form of its parent class.
C. In sub-typing a class is derived from existing one where the derived class should be abstract.
D. None of the given
In sub-typing a new class is derived from existing where the derived class shows some extended behavior of its parent..

9. Class is not a mechanism to create objects and define user data types.
A. TRUE
B. FALSE
FALSE.

10. Which of the following may not be an integral part of an object?
A. state
B. behavior
C. Protected data members
D. All of given
All of given.

Person ” class is composed off
“ Nationality ” class . What will be the
order of execution of constructor of
“ Keyboard ” class and “ Keys ” classFirst
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 YesNo
Question # 41
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
class Account : : public SavingAccount


“ 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 .
class StandardKeys: public Keys
class Keys: public StandardKeys
class StandardKeys:: public Keys
class Keys: : public StandardKeys


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


Post a Comment

Previous Post Next Post