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




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

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.

Methodologies to the development of reusable software relate to ____________.
Structure programming
Procedural programming
Generic programming
None of the given

A template argument is preceded by the keyword__________.
Vector
Class
Template
Type*

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

Friends are used exactly the same for template and non-template classes.
True

False




A function template must have a parameter
True
False

An abstract class is useful whenno 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
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.

 Vukwl- Virtual Education Solution

Child class can call constructor of its,
Direct base class
Indirect base class
Both direct and indirect base classes
None of these.


Derived class can inherit from public base class as well as private and protected base classesTrueFalse 
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 error4th line will produce error
3rd and 4th line will produce error.
5th line will produce error. 
Methodologies to the development of reusable software relate to ____________.Structure programming
Procedural programming
Generic programmingNone of the given 
A template argument is preceded by the keyword__________.Vector
ClassTemplate
Type* 
Friends are used exactly the same for template and non-template classes.True
False 
A function template must have a parameterTrueFalse 

Child class can call constructor of its,
Direct base classIndirect base class

Both direct and indirect base classes
None of these.
 
Which statement will be true for concrete class?It implements an virtual concept.
It can be instantiatedIt cannot be instantiated
None of given
Which statement will be true for concrete class?
It implements an virtual concept.
It can be instantiated
It cannot be instantiated
None of given

A class D can be derived from a class C, which is derived froma class B, which is derived from a class A
True
False

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

A Class or class template can have member ___________ that are themselves templates.

Variable
Function
Objects
None of given


Memory is allocated to non static members only, when:
  1.  Class is created
  2.  Object is defined
  3.  Object is initialized
  4.  Object is created
Consider the code below, class class1{ private: void func1(); }; class class2 : public class1 { }; Function func1 of class1 is ____ in class2,public
protected
private
none of the given options
Templates automatically create different versions of a function, depending on user input.
True

False
________ Binding means that target function for a call is selected at run timeAutomatic
DynamicStatic
Dramatic
When we create objects, then space is allocated to:Member function
Access specifier
Data member
None of given
There is only one form of copy constructor.True
False 
Which of the following features of OOP is used to deal with only relevant details?Abstraction
Information hiding
Object
___________ Binding means that targets function for a call is selected at compile time.
StaticDynamic
Automatic
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 
In C++, we declare a function virtual by preceding the function header with keyword “Inline”.TrueFalse 
It is illegal to make objects of one class members of another class.TrueFalse 
In Resolution order compiler search firstly____________.Generic Template
Partial Specification
Complete Specification
Ordinary function 

The sub-object’s life is not dependent on the life of master class in ___________.
  1. Composition
  2.  Aggregation
  3.  Separation
  4.  non of the given

Unary operators and assignment operator are right associative.
  1. true
  2. false

Methodologies to the development of reusable software relate to________.Structure programming
procedural programming
generic programmingNone of the given
Function template must have a parameter.True
False
The default inheritance mode is,Public inheritance
Protected inheritance
Private inheritanceNone 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 tocreate 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


The >= operator can't be overloaded.
  1. true
  2. false

_____ is creating objects of one class inside another class.
  1.  Association
  2. Composition
  3. Aggregation
  4.  Inheritance


Which will be the Primary task or tasks of generic programming?
Categorize the abstractions in a domain into concepts
Implement generic algorithms based on the concepts
Build concrete models of the concepts
All of given

The default inheritance mode is,
Public inheritance
Protected Inheritance
Private Inheritance
None of these 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

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 statementNone 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
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

Function overriding is done in context of,
Select correct option:
Single class
Single derived class
Single base class
Derived and base classes

A class template ____________
Facilitates reuse of class
Does not facilitate reuse of class

Sender of the message does not need to know the exact class of receiver in________.
Abstraction
Polymorphism
Inheritance
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.



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

 Vukwl- Virtual Education Solution

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
False 



Consider the code below, class class1{ public: int i; }; class class2 : protected class1 { }; Then int member i of class1 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 func1(); }; class class2 : public class1 { }; Function func1 of class1 is ______ in class2,
Select correct option:
public
protectedprivate
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





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

If we are create array of objects through new operator, then
  1.  We can call overloaded constructor through new
  2.  We can’t call overloaded constructor through new
  3.  We can call default constructor through new
  4.  None of the given

Object can be declared constant with the use of Constant keyword.
  1. true
  2. false
__________ Operator will take only one operand.
  1. New
  2. int
  3. object
  4. none of the given

 Which of the following operator(s) take(s) one or no argument if overloaded?
  1. ++
  2. *
  3. %
  4. All of the given choices
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 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

this pointer does not pass implicitly to __________ functions.
  1. Static Member
  2. Non-Static Member
  3. Instance Number
  4. None of the given


Operator overloading is
  1.  making C++ operators work with objects.
  2. giving C++ operators more than they can handle.
  3. giving new meanings to existing Class members.
  4. making new C++ operators


 Vukwl- Virtual Education Solution




In Private Inheritance the public members of base class become __________ in derived class.
Public
Private
Protected
None of the given options.

Consider the following two lines of code written for a class Student, 1. Student sobj1; 2. Student sobj2(sobj1); In line No.2 what constructor of Student class will be called,
Default constructor of Student class
Copy constructor of student class
Both default and copy constructer of Student class
No constructor will be called

 Vukwl- Virtual Education Solution



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

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

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


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


In specialization we can,
Select correct option:
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

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


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





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


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





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





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

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

Function overriding is done in context of, Single class 
Single derived class 
Single base class 
Derived and base classes


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 ” 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
Yes
No

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


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


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


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




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

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


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

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


_____ is creating objects of one class
inside another class.
Association
Composition
Aggregation
Inheritance


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





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


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.


Sender of the message does not need
to know the exact class of receiver
in _ _____.
Select correct option :
Abstraction
Polymorphism
Inheritance
none of the given


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


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


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


Function overriding is done in context
of ,
Select correct option :
Single class
Single derived class
Single base class
Derived and base classes


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
Which will be the Primary task or tasks
of generic programming ?
Select correct option :
Categorize the abstractions in a domain
into concepts
Implement generic algorithms based on
the concepts
Build concrete models of the concepts
All of given

Sender of the message does not need
to know the exact class of receiver
in ________ .
Select correct option :
Abstraction
Polymorphism
Inheritance
none of the given

A class can inherit from more then one
class is called .
Select correct option :
Simple inheritance
Multiple inheritances
Single inheritance
Double inheritance

In type independed function template
should be use where code and behavior
must be identical .
Select correct option :
True
False KKK

To make a pure virtual , we ineed to
gve______ after ( ) of this function .
Select correct option :
= 0 ;
=!;
null ;
none of the 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.
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

Derived class can inherit from public
base class as well as private and
protected base classes
Select correct option :
True
False

Select correct option :
Static
Constant
Virtual
Both Constant and Virtual

If you do not initialize static variable
of int type then it is automatically
initialized with _________ .
Select correct option :
0
1
Null
None of the given

Associativity can change due to
operator overloading.
Select correct option :
True
False

If we are create array of objects
through new operator, then
Select correct option :
We can call overloaded constructor
through new
We can ’ t call overloaded constructor
through new
We can call default constructor
through new
None of the given

The sub - object ’ s life is not dependant
on the life of master class in
___________ .
Select correct option :
Composition
Aggregation
Seperation
non of the given

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

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 ).

In private inheritance derived class
pointer can be assigned to base class
pointer in ,
Select correct option :
Main function
In derived class member and friend
functions
In base class member and friend
functions
None of the given options

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
Both Rational _ number _ 1 &
Rational _ number _
any of the two objects , randomly

Copy constructor is called when :
Select correct option :
An object is created .
An object is created in term of pre
existing object.
An array of objects is created .
An object is deleted .

Static member can not be called with
the class name .
Select correct option :
True
False

________ and ______ methods can not
be declared virtual .
Select correct option :
Private, Static
Private, Public
Static ,Public
None of the given

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




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

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

Unary operators and assignment
operator are right associative .
Select correct option :
True
False

Constant objects cannot change their
state .
Select correct option :
True
False



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 ?
Select correct option :
Rational _ number _ 1
None of

Which of the following operator (s ) take
(s ) one or no argument if overloaded ?
Select correct option :
+ +
*
%
All of the given choices

If we are create array of objects
through new operator, then
Select correct option :
We can call overloaded constructor
through new
We can ’ t call overloaded constructor
through new
We can call default constructor
through new
None of the given

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

We can access a private static variable
through :
Select correct option :
Static data member
Static member function
Global data member
None of the given

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


Static member can not be called with
the class name .
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

Constant objects cannot change their
state .
Select correct option :
True
False

The sub - object ’ s life is not dependant
on the life of master class in
___________ .
Select correct option :
Composition
Aggregation
Seperation
non of the given

this pointer does not pass implicitly to
__________ functions .
Select correct option :
Static Member
Non- Static Member
Instance Number
None of the given

Member function of a class can not
access its private data members .
Select correct option :
True
False

Static variable can be initialized more
than once .
Select correct option :
True
False

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

Operator overloading is
Select correct option :
making C + + operators work with
objects .
giving C + + operators more than they
can handle.
giving new meanings to existing Class
members .
making new C + + operators.

If you do not initialize static variable
of int type then it is automatically
initialized with _________ .
Select correct option :
0
1
Null
None of the given


Unary operators and assignment
operator are right associative .
Select correct option :
True
False

Associativity can change due to
operator overloading.
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

Separation of implementation from
interface provides the facility to
restrict the _________ from direct
access
Select correct option :
Data Member
Data Function
Class
None of the given

Static variable can be initialized more
than once .
Select correct option :
True
False

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

Memory is allocated to non static
members only, when :
Select correct option :
Class is created
Object is defined
Object is initialized
Object is created

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 ?
Select correct option :
Rational _ number _ 1
None of the given choices
Both Rational _ number _ 1 &
Rational _ number _ 2
any of the two objec

Copy constructor is called when :
Select correct option :
An object is created .
An object is created in term of pre
existing object.
An array of objects is created .
An object is deleted .

Static data members are called
____________ variable
Select correct option :
Class
Object
Structure
none of the given

Which of the following is not an object
association ?
Select correct option :
Simple association
Inheritance
Aggregation
Composition


If we are create array of objects
through new operator, then
Select correct option :
We can call overloaded constructor
through new
We can ’ t call overloaded constructor
through new
We can call default constructor
through new
None of the given

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

Constant data members can be
initialized by using :
Select correct option :
Constant Member Function
Non- constant Member Function
Member Initializer List
Class

Which of the following operator (s ) take
(s ) one or no argument if overloaded ?
Select correct option :
+ +
*
%
All of the given choices

Copy constructor is called when :
Select correct option :
An object is created .
An object is created in term of pre
existing object.
An array of objects is created .
An object is deleted .

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 ?
Select correct option :
Rational _ number _ 1
None of the given choices
Both Rational _ number _ 1 &
Rational _ number _ 2
any of the two objects , randomly



Consider the following code segment :
class test { int a ; int b ; int c; public:
test() :b (5 ) ,c( a ),a ( b ) {} } What will the
value of
variables a , b , and c after instantiating
an object of above class ?
Select correct option :
5 , 5 , 5
5 , Junk value , 5
Junk value , 5 , Junk value
Junk value , 5 , 5

Operator overloading is
Select correct option :
making C + + operators work with
objects .
giving C + + operators more than they
can handle.
giving new meanings to existing
Class members .
making new C + + operators.

Copy constructor is called when :
Select correct option :
An object is created .
An object is created in term of pre
existing object.
An array of objects is created .
An object is deleted .


this pointer does not pass implicitly to
__________ functions .
Select correct option :
Static Member
Non- Static Member
Instance Number
None of the given

A static member function can not be
declared :
Select correct option :
Static
Constant
Virtual
Both Constant and Virtual

Which of the following operators takes
only one operand ?
Select correct option :
+
>
<=
New

Constant objects cannot change their
state .
Select correct option :
True
False

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

Copy constructor is called when :
Select correct option :
An object is created .
An object is created in term of pre
existing object.
An array of objects is created .
An object is deleted .

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

Memory is allocated to non static
members only, when :
Select correct option :
Class is created
Object is defined
Object is initialized
Object is created

Unary operators and assignment
operator are right associative .
Select correct option :
True
False

Associativity can change due to
operator overloading.
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

In private inheritance derived class
pointer can be assigned to base class
pointer in ,
Select correct option :
Main function
In derived class member and friend
functions
In base class member and friend
functions
None of the given options

A class D can be derived from a class C, which is derived froma class B, which is derived from a class ATrueFalse

Adding a derived class to a base class requires fundamental changes to the base class.TrueFalse

A Class or class template can have member ___________ that are themselves templates.Variable
FunctionObjects
None of given

Which will be the Primary task or tasks of generic programming?Categorize the abstractions in a domain into concepts
Implement generic algorithms based on the concepts
Build concrete models of the concepts
All of given

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

2. The ______ keyword tells the compiler to substitute the code within the function definition for every instance of a function call
A. virtual
B. inline
C. instance
D. none of the given

The __inline keyword tells the compiler to substitute the code within the function definition for every instance of a function call. However, substitution occurs only at the compiler's discretion. For example, the compiler does not inline a function if its address is taken or if it is too large to inline..

3. Objects communicate each other through ________
A. Messages
B. Data members
C. Both of above
D. None of the above
Messages.

4. Which one is not the main feature of object oriented programming?
A. Classes and Objects
B. Exception handling
C. Inheritance
D. Polymorphism
Exception handling.

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
VirtualImplemented

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

We can call base class assignment
operator in derived class user defined
assignment operator ,
Select correct option :
Implicitly
Explicitly
Using both of these options
Using none of these options

Which of the following features of OOP
is used to derive a class from another?
Select correct option :
Encapsulation
Polymorphism
Data hiding
Inheritance

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 : protected class1 { };
Function func1 of class1 is _ _ _ _ _ _ in
class2 ,
Select correct option :
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 3 is ,
Select correct option :
Direct base class of c1
Direct child class of c 1
Direct base class of c2
Direct child class of c 2

Which will be the Primary task or tasks
of generic programming ?
Select correct option :
Categorize the abstractions in a domain
into concepts
Implement generic algorithms based on
the concepts
Build concrete models of the concepts
All of given

Function overloading is done with
respect of ,
Select correct option :
A single class
A derived class
A base class
Both derived and base classes

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

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 .




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

Select correct line of code for
composition relationship between
“ Person ” class and “ Nationality ” class.
Select correct option :
class Nationality { Person p ;};
class Person { Nationality c; };
class Person : private Nationality
class Nationality : private Person



“ 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 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

In c + + , compiler can generate which of
the following operators’ code ,
Select correct option :
= =
=
&
& &
A function template must have a
parameter.
True
False

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





CS304 Object Oriented Programming mcqs solved CS304 Object Oriented Programming quiz mega file CS304 Object Oriented Programming midterm solved papers 2017 CS304 Object Oriented Programming solved mcqs mega file CS304 Object Oriented Programming midterm solved papers 2016 CS304 Object Oriented Programming data structures midterm papers CS304 Object Oriented Programming final term solved mcqs mega file CS304 Object Oriented Programming handouts CS304 Object Oriented Programming lectures CS304 Object Oriented Programming assignment CS304 Object Oriented Programming handouts CS304 Object Oriented Programming assignment solution 2018 CS304 Object Oriented Programming ppt slides CS304 Object Oriented Programming assignment no 2 solution 2018 CS304 Object Oriented Programming midterm solved papers by moaaz CS304 Object Oriented Programming final term solved mcqs by moaaz

Post a Comment

Previous Post Next Post