When we create objects, then space is allocated to:
Member functions
Access specifier
Data members
None of the given
If we extend our model, and the rest of model is not affected, then its called ___________
Consistency
Flexibility
Efficiency
Reusability
Using encapsulation we can achieve
Information hiding
Least interdependencies among modules
Implementation independence
All of given options
Consider the statement “room has chair” which of the following type of association exists between room and chair?
Inheritance
Composition
There is no association
Aggregation
A good model is ................ related to a real life problem.
Loosely
Openly
Closely
Not
If a class A inherits from class B, then class A is called.
Child Class
Derived class
Parent class
Child and derived class
Which one of the following is not a major element in an object model?
Abstraction
Encapsulation
Persistence
Hierarchy
Member functions defined inside a class declaration are ________ by default.
Visible
Public
Private
Changed
Advantage(s) of information hiding
Simplifies the model
Restriction to change
Both of above
None of the above
Which of the following parts of an object exhibits its state?
Data
Operations
Any public part
Any private part
Without using Deep copy constructor. A___________ problem can occur
System crash
Memory
Leakage
Dangling printer
All the given
Three main characteristics of "Object Oriented programming" are,
Encapsulation, dynamic binding, polymorphism
Polymorphism, overloading, overriding
Encapsulation, inheritance, dynamic , binding
Encapsulation, inheritance, polymorphism
Overriding concept is used in”
Encapsulation
Polymorphism
Information hiding
None of the given
Main advantage of inheritance is:
Better understanding
Les understating
Reuse
Less complexity
Which one is a class association
Simple association
Inheritance
Composition
Aggregation
Public member function exposed by a class is called surface
True
False
Constructor and destructor can be declared constant
True
False
Which can allocate dynamic memory allocation through______ keyword.
Static
Global
New
Const
In inheritance, a child class is sub-type of base class.
True
False
If only one behaviour of a derived class is incompatible with base class, then it is:
Generalization
Specification
Extension
Inheritance
“A fan has wings”. Which type of relation exists between fan and wings in the sentence?
Aggregation
Association
Generalization
Composition
When an object initialize _________ automatically call by the complier
Constructor
Function
Object
None of the given
A class __________ destructor.
No
One
Two
Three
Suppose there is an object of type person, which of the following can be considered as one of its attributes
Name
Age
Work ()
Both name and Age
If MyClass has destructor named?
MyClass
~MyClass
My~Class
MyClass~
An abstract class shows _______ behaviour.
Overriding
Specific
General
None of the given
The _________ keyword tells the compiler to substitute the code within the function definition for every instance of a function call.
Virtual
Inline
Instance
None of the given
We can choose any arbitrary name for a constructor.
Select correct option:
True
False
Which one is not the main feature of object oriented programming?
Select correct option:
Classes and Objects
Exception handling
Inheritance
Polymorphism
The dot operator (or class member access operator) connects the following two entities (reading from left to right):
Select correct option:
A class member and a class object
A class object and a class
A class and a member of that class
A class object and a member of that class
If only one behaviour of a derived class is incompatible with base class, then it is:
Select correct option:
Generalization
Specialization
Extension
Inheritance
Storing data and functions in a single unit (class). Data cannot be accessible to the outside world and only those functions which are stored in the class can access it
Select correct option:
Inheritance
Abstraction
Polymorphism
Encapsulation
If MyClass has a destructor what is the destructor named?
Select correct option:
MyClass
~MyClass
My~Class
MyClass~
A real world object can be transformed into programming entity by defining its respective
Select correct option:
Class
Function
Only states
Only behaviour
Which of the following features of OOP is used to deal with only relevant details?
Select correct option:
Abstraction
Information hiding
Object
Inheritance
In class, attributes and behaviour is represented by:
Select correct option:
Member functions, data members
Member functions, scope of data members
Data members, member functions
None of the given
Using encapsulation we can achieve
Select correct option:
Information hiding
Least interdependencies among modules
Implementation independence
All of given options
Information hiding can be achieved through__________.
Encapsulation, Inheritance
Encapsulation, Polymorphism
Encapsulation, Abstraction
Overloading
A good model is ................ related to a real life problem.
Select correct option:
Loosely
Openly
Closely
Which of the following features of OOP is used to derive a class from another?
Select correct option:
Encapsulation
Polymorphism
Data hiding
Inheritance
Which of the following is a weak relationship between two objects?
Select correct option:
Inheritance
Composition
Aggregation
None of given
Data items in a class must be private.
Select correct option:
True
False
Which one is a class association?
Select correct option:
Simple Association
Inheritance
Composition
Aggregation
Suppose there is an object of type Person, which of the following can be considered as one of its attributes
Select correct option:
Name
Age
Work()
Both Name and Age
Question # 8 of 10 ( Start time: 01:17:52 AM ) Total M a r k s: 1
Which one is not an object association?
Select correct option:
Simple association
Inheritance
Aggregation
Association
Using encapsulation we can achieve
Select correct option:
Information hiding
Least interdependencies among modules
Implementation independence
All of given options
In constant member function the type of this pointer is:
Select correct option:
Constant pointer
Constant pointer to object
Constant pointer to class
Constant pointer to constant object
Which of the following is the way to extract common behavior and attributes from the given classes and make a separate class of those common behaviors and attributes?
Generalization
Sub-typing
Specialization
Extension
The ability to derive a class from more than one class is called
Single inheritance
Encapsulation
Multiple inheritance
Polymorphism
If MyClass has a destructor what is the destructor named?
MyClass
~MyClass
My~Class
MyClass~
Class abc{ ----- }; Is a valid class declaration?
yes
no
Without using Deep copy constructor, A ____________ problem can occur
System crash
Memory Leakage
Dangling pointer
All of the given
If only one behaviour of a derived class is incompatible with base class, then it is:
Generalization
Specialization
Extension
Inheritance
Which of the following may not be an integral part of an object?
state
behavior
Protected data members
All of given
Only tangible things can be chosen as an object.
True
False
Class is not a mechanism to create objects and define user data types.
true
false
Memory is allocated to non static members only, when:
Class is created
Object is defined
Object is initialized
Object is created
The sub-object’s life is not dependent on the life of master class in ___________.
Composition
Aggregation
Separation
non of the given
Unary operators and assignment operator are right associative.
true
false
The >= operator can't be overloaded.
true
false
_____ is creating objects of one class inside another class.
Association
Composition
Aggregation
Inheritance
If we are create array of objects through new operator, then
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
Object can be declared constant with the use of Constant keyword.
true
false
__________ Operator will take only one operand.
New
int
object
none of the given
Which of the following operator(s) take(s) one or no argument if overloaded?
++
*
%
All of the given choices
this pointer does not pass implicitly to __________ functions.
Static Member
Non-Static Member
Instance Number
None of the given
Operator overloading is
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
Which of the following is TRUE,
Derived class pointer can be used as Base class pointer
Base class pointer can be used as Derived class pointer
Both of these options
None of these options
___________ Binding means that target function for a call is selected at run time
Automatic
Dynamic
Static
Dramatic
When we want to implement one class in terms of another class then we use
Public inheritance
Protected inheritance
Private inheritance
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
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
A parent class can call constructor of its child class through
Its constructor initialization list
Its constructor body
Both from its constructor initialization list or body
Can not call the constructor of its child class
In Private Inheritance the public members of base class become __________ in derived class.
Public
Private
Protected
None of the given options
Function overriding is done in context of,
Single class
Single derived class
Single base class
Derived and base classes
Child class can call constructor of its,
Direct base class
Indirect base class
Both direct and indirect base classes
None of these
Adding a derived class to a base class requires fundamental changes to the base class
True
False
_______________ is automatically called when the object is created.
Member function
Object
Constructor
None of the given
Inheritance is a way to
Organize data
Pass arguments to objects of classes
Add features to existing classes without rewriting them
Improved data-hiding and encapsulation
Through interface we access object_____________.
States
Data members
Behaviour
None of the given
Which of the following may not be integral part of an object?
State
Behavior
Protected data members
All of given
Suppose there is an object of type Person, which of the following can be considered as on of its attributes.
Name
Age
Work()
Both Name and Age
If we have an overloaded constrictor in our class, then compiler construct the default constructor.
True
False
Advantages(s) of information hiding
Simplifies the model
Restriction to change
Both of above
None of the above
If some of objects exhibit identical characteristics, then they belong to:
Different classes
Multiple classes
Same class
None of the given
Which of the following is the way to extract common behaviour and attributes from the given and make a separate class of those common behaviours and attributes?
Generalization
Sub-typing
Specification
Extension
A class has ________ destructor
One
Two
Three
Bahaviors of a type of objects are represented through
States
Attributes
Operations
Which is not an example of multiple inheritances?
Mermaid
Amphibious Vehicle
Car
None of the above
Static data members are called ____________ variable
Class
Object
Structure
None of the given
Associatively can be change in operator overloading.
True
False
________ and ______ methods may not be declared abstract.
Private,static
private,public
static,public
none of the given
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
take two arguments.
None of the given choices
take single argument
take three arguments
To initialize an array of objects, only _____________ will be called
Default Constructor
Overloaded Constructor
Default Object
None of the above
__________ provide the facility to access the data member.
accesser function
private function
inline function
None of the given
If a class involves dynamic memory allocation, then:
Default copy constructor, shallow copy is implemented
User defined copy constructor, shallow copy is implemented
Default copy constructor, deep copy is implemented
User defined copy constructor, deep copy is implemented
The sentence “Object Oriented Programming book in bookshelf” is an example of:
Association
Multiple associations
Aggregation
How the information hidden within an object can be accessed?
Through its interface
Through its private data member
Through its private member functions
There is no need to is or is a kind of relationship in generalization
True
False
An object has _______ interface(s)
Only one
Only two
One or more than one
Which of the following is an advantage of OOP?
It provides an ability to create one user defined data type extending the other
It provides the facility of defining abstract data type through which real entities can be defined better
All of the given option
Encapsulation means
Select correct option:
Extending the behaviour of class in another class
Data and behaviour are tightly coupled within an entity
One entity takes all the attributes and operations of the other
Taking out the common features and put those in a separate class
We can allocate dynamic memory allocation through___________ key word.
Select correct option:
Static
Global
New
Const
In programming, where the actual actions are coded is called:
Select correct option:
Function declaration
Function calling
Function definition
None of the given
Which of the following is directly related to polymorphism?
Select correct option:
Overriding
Const members
Static members
None of given
In a class declaration, data or functions designated private are accessible
Select correct option:
to any function in the program.
only if you know the password.
to member functions of that class.
only to public members of the class.
An instance of user defined type is called
Select correct option:
Object
Class
both of above
none of above
Aggregation is implemented using pointer.
Select correct option:
True
False
If class A supports all the operations of class B, then class A is:
Class A is behaviourally compatible with class B
Class A is behaviourally incompatible with class B
Class A is independent of class B
None of the given
Objects having identical characteristics belong to ______________
Same class
Two different classes
Any number of different classes
Objects can not have identical characteristics
When we create objects, then space is allocated to:
Member functions
Access specifier
Data members
None of the given
If we extend our model, and the rest of model is not affected, then its called ___________
Consistency
Flexibility
Efficiency
Reusability
Using encapsulation we can achieve
Information hiding
Least interdependencies among modules
Implementation independence
All of given options
Consider the statement “room has chair” which of the following type of association exists between room and chair?
Inheritance
Composition
There is no association
Aggregation
A good model is ................ related to a real life problem.
Loosely
Openly
Closely
Not
If a class A inherits from class B, then class A is called.
Child Class
Derived class
Parent class
Child and derived class
Which one of the following is not a major element in an object model?
Abstraction
Encapsulation
Persistence
Hierarchy
Member functions defined inside a class declaration are ________ by default.
Visible
Public
Private
Changed
Advantage(s) of information hiding
Simplifies the model
Restriction to change
Both of above
None of the above
Which of the following parts of an object exhibits its state?
Data
Operations
Any public part
Any private part
Without using Deep copy constructor. A___________ problem can occur
System crash
Memory
Leakage
Dangling printer
All the given
Three main characteristics of "Object Oriented programming" are,
Encapsulation, dynamic binding, polymorphism
Polymorphism, overloading, overriding
Encapsulation, inheritance, dynamic , binding
Encapsulation, inheritance, polymorphism
Overriding concept is used in”
Encapsulation
Polymorphism
Information hiding
None of the given
Main advantage of inheritance is:
Better understanding
Les understating
Reuse
Less complexity
Which one is a class association
Simple association
Inheritance
Composition
Aggregation
Public member function exposed by a class is called surface
True
False
Constructor and destructor can be declared constant
True
False
Which can allocate dynamic memory allocation through______ keyword.
Static
Global
New
Const
In inheritance, a child class is sub-type of base class.
True
False
If only one behaviour of a derived class is incompatible with base class, then it is:
Generalization
Specification
Extension
Inheritance
“A fan has wings”. Which type of relation exists between fan and wings in the sentence?
Aggregation
Association
Generalization
Composition
When an object initialize _________ automatically call by the complier
Constructor
Function
Object
None of the given
A class __________ destructor.
No
One
Two
Three
Suppose there is an object of type person, which of the following can be considered as one of its attributes
Name
Age
Work ()
Both name and Age
If MyClass has destructor named?
MyClass
~MyClass
My~Class
MyClass~
An abstract class shows _______ behaviour.
Overriding
Specific
General
None of the given
The _________ keyword tells the compiler to substitute the code within the function definition for every instance of a function call.
Virtual
Inline
Instance
None of the given
We can choose any arbitrary name for a constructor.
Select correct option:
True
False
Which one is not the main feature of object oriented programming?
Select correct option:
Classes and Objects
Exception handling
Inheritance
Polymorphism
The dot operator (or class member access operator) connects the following two entities (reading from left to right):
Select correct option:
A class member and a class object
A class object and a class
A class and a member of that class
A class object and a member of that class
If only one behaviour of a derived class is incompatible with base class, then it is:
Select correct option:
Generalization
Specialization
Extension
Inheritance
Storing data and functions in a single unit (class). Data cannot be accessible to the outside world and only those functions which are stored in the class can access it
Select correct option:
Inheritance
Abstraction
Polymorphism
Encapsulation
If MyClass has a destructor what is the destructor named?
Select correct option:
MyClass
~MyClass
My~Class
MyClass~
A real world object can be transformed into programming entity by defining its respective
Select correct option:
Class
Function
Only states
Only behaviour
Which of the following features of OOP is used to deal with only relevant details?
Select correct option:
Abstraction
Information hiding
Object
Inheritance
In class, attributes and behaviour is represented by:
Select correct option:
Member functions, data members
Member functions, scope of data members
Data members, member functions
None of the given
Using encapsulation we can achieve
Select correct option:
Information hiding
Least interdependencies among modules
Implementation independence
All of given options
Information hiding can be achieved through__________.
Encapsulation, Inheritance
Encapsulation, Polymorphism
Encapsulation, Abstraction
Overloading
A good model is ................ related to a real life problem.
Select correct option:
Loosely
Openly
Closely
Which of the following features of OOP is used to derive a class from another?
Select correct option:
Encapsulation
Polymorphism
Data hiding
Inheritance
Which of the following is a weak relationship between two objects?
Select correct option:
Inheritance
Composition
Aggregation
None of given
Data items in a class must be private.
Select correct option:
True
False
Which one is a class association?
Select correct option:
Simple Association
Inheritance
Composition
Aggregation
Suppose there is an object of type Person, which of the following can be considered as one of its attributes
Select correct option:
Name
Age
Work()
Both Name and Age
Question # 8 of 10 ( Start time: 01:17:52 AM ) Total M a r k s: 1
Which one is not an object association?
Select correct option:
Simple association
Inheritance
Aggregation
Association
Using encapsulation we can achieve
Select correct option:
Information hiding
Least interdependencies among modules
Implementation independence
All of given options
In constant member function the type of this pointer is:
Select correct option:
Constant pointer
Constant pointer to object
Constant pointer to class
Constant pointer to constant object
Which of the following is the way to extract common behavior and attributes from the given classes and make a separate class of those common behaviors and attributes?
Generalization
Sub-typing
Specialization
Extension
The ability to derive a class from more than one class is called
Single inheritance
Encapsulation
Multiple inheritance
Polymorphism
If MyClass has a destructor what is the destructor named?
MyClass
~MyClass
My~Class
MyClass~
Class abc{ ----- }; Is a valid class declaration?
yes
no
Without using Deep copy constructor, A ____________ problem can occur
System crash
Memory Leakage
Dangling pointer
All of the given
If only one behaviour of a derived class is incompatible with base class, then it is:
Generalization
Specialization
Extension
Inheritance
Which of the following may not be an integral part of an object?
state
behavior
Protected data members
All of given
Only tangible things can be chosen as an object.
True
False
Class is not a mechanism to create objects and define user data types.
true
false
Memory is allocated to non static members only, when:
Class is created
Object is defined
Object is initialized
Object is created
The sub-object’s life is not dependent on the life of master class in ___________.
Composition
Aggregation
Separation
non of the given
Unary operators and assignment operator are right associative.
true
false
The >= operator can't be overloaded.
true
false
_____ is creating objects of one class inside another class.
Association
Composition
Aggregation
Inheritance
If we are create array of objects through new operator, then
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
Object can be declared constant with the use of Constant keyword.
true
false
__________ Operator will take only one operand.
New
int
object
none of the given
Which of the following operator(s) take(s) one or no argument if overloaded?
++
*
%
All of the given choices
this pointer does not pass implicitly to __________ functions.
Static Member
Non-Static Member
Instance Number
None of the given
Operator overloading is
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
Which of the following is TRUE,
Derived class pointer can be used as Base class pointer
Base class pointer can be used as Derived class pointer
Both of these options
None of these options
___________ Binding means that target function for a call is selected at run time
Automatic
Dynamic
Static
Dramatic
When we want to implement one class in terms of another class then we use
Public inheritance
Protected inheritance
Private inheritance
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
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
A parent class can call constructor of its child class through
Its constructor initialization list
Its constructor body
Both from its constructor initialization list or body
Can not call the constructor of its child class
In Private Inheritance the public members of base class become __________ in derived class.
Public
Private
Protected
None of the given options
Function overriding is done in context of,
Single class
Single derived class
Single base class
Derived and base classes
Child class can call constructor of its,
Direct base class
Indirect base class
Both direct and indirect base classes
None of these
Adding a derived class to a base class requires fundamental changes to the base class
True
False
_______________ is automatically called when the object is created.
Member function
Object
Constructor
None of the given
Inheritance is a way to
Organize data
Pass arguments to objects of classes
Add features to existing classes without rewriting them
Improved data-hiding and encapsulation
Through interface we access object_____________.
States
Data members
Behaviour
None of the given
Which of the following may not be integral part of an object?
State
Behavior
Protected data members
All of given
Suppose there is an object of type Person, which of the following can be considered as on of its attributes.
Name
Age
Work()
Both Name and Age
If we have an overloaded constrictor in our class, then compiler construct the default constructor.
True
False
Advantages(s) of information hiding
Simplifies the model
Restriction to change
Both of above
None of the above
If some of objects exhibit identical characteristics, then they belong to:
Different classes
Multiple classes
Same class
None of the given
Which of the following is the way to extract common behaviour and attributes from the given and make a separate class of those common behaviours and attributes?
Generalization
Sub-typing
Specification
Extension
A class has ________ destructor
One
Two
Three
Bahaviors of a type of objects are represented through
States
Attributes
Operations
Which is not an example of multiple inheritances?
Mermaid
Amphibious Vehicle
Car
None of the above
Static data members are called ____________ variable
Class
Object
Structure
None of the given
Associatively can be change in operator overloading.
True
False
________ and ______ methods may not be declared abstract.
Private,static
private,public
static,public
none of the given
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
take two arguments.
None of the given choices
take single argument
take three arguments
To initialize an array of objects, only _____________ will be called
Default Constructor
Overloaded Constructor
Default Object
None of the above
__________ provide the facility to access the data member.
accesser function
private function
inline function
None of the given
If a class involves dynamic memory allocation, then:
Default copy constructor, shallow copy is implemented
User defined copy constructor, shallow copy is implemented
Default copy constructor, deep copy is implemented
User defined copy constructor, deep copy is implemented
The sentence “Object Oriented Programming book in bookshelf” is an example of:
Association
Multiple associations
Aggregation
How the information hidden within an object can be accessed?
Through its interface
Through its private data member
Through its private member functions
There is no need to is or is a kind of relationship in generalization
True
False
An object has _______ interface(s)
Only one
Only two
One or more than one
Which of the following is an advantage of OOP?
It provides an ability to create one user defined data type extending the other
It provides the facility of defining abstract data type through which real entities can be defined better
All of the given option
Encapsulation means
Select correct option:
Extending the behaviour of class in another class
Data and behaviour are tightly coupled within an entity
One entity takes all the attributes and operations of the other
Taking out the common features and put those in a separate class
We can allocate dynamic memory allocation through___________ key word.
Select correct option:
Static
Global
New
Const
In programming, where the actual actions are coded is called:
Select correct option:
Function declaration
Function calling
Function definition
None of the given
Which of the following is directly related to polymorphism?
Select correct option:
Overriding
Const members
Static members
None of given
In a class declaration, data or functions designated private are accessible
Select correct option:
to any function in the program.
only if you know the password.
to member functions of that class.
only to public members of the class.
An instance of user defined type is called
Select correct option:
Object
Class
both of above
none of above
Aggregation is implemented using pointer.
Select correct option:
True
False
If class A supports all the operations of class B, then class A is:
Class A is behaviourally compatible with class B
Class A is behaviourally incompatible with class B
Class A is independent of class B
None of the given
Objects having identical characteristics belong to ______________
Same class
Two different classes
Any number of different classes
Objects can not have identical characteristics
Consider the statement “room has chair” Which of the following types of association exist between room and chair?
- inheritance
- composition
- There is no association
- Aggregation
Consider the following code segment :
class test
{
int a;
int b;
int c;
- 5, 5, 5
- 5, junk value, 5
- junk value, 5, junk value
- junk value, 5,5
Member function defined inside a class declaration are ________ by default.
- Visible
- Public
- Private
- Protected
A post-fix unary operator is implemented in C++ using member function with:
- 1 dummy char argument
- 1 dummy int argument
- 1 dummy float argument
- None of the given option
Suppose person is a class, which of the following statement define object of class person ?
- Create person object;
- Define Object;
- Person person;
- Object person;
__________ is the reverse process of Generalization.
- Aggregation
- Inheritance
- Dependence
- Specialization
If you have three classes in a C++ program A, B and C where class A inherits from class B, then class_________contains all the character of class________
- B, A
- A, B
- A, C
- B, C
Which of the following is true about inline function?
- It is used by compliers to improve efficiency of the program
- Small size function that need to be called many times during program execution are decaled inline
- Inline function decrease the code execution time
- All of the given option
What is a class?
- A class is section of computer memory containing objects
- A class is a section of the hard disk reserved for object oriented programs
- A class is the part of an object that contains the variables.
- A class is a description of a kind of object
Composition is ________ relationship
- is a
- is kind a
- Has
- part-whole
_________ represents “ IS a “ relationship.
- Simple Association
- Inheritance
- Composition
- Aggregation
A class can have only ________ destructor.
- One
- Two
- Three
- Four
Student *ptr = new Student(“ALI”); is an example of _______
- Static memory allocation
- Dynamic memory allocation
- Destructor
- Constructor
Inheritance is shown by;
- Open head arrow
- Filled arrow
- Single Line
- Bi-directional
Compile generated default constructor is called ________ and user written default constructor is called
- Compiler-defined, Implicit
- Explicit, User-defined
- Explicit, Implicit
- Implicit, Explicit
Entities in OO model are represented by;
- Circle
- Square
- Lines
- Rectangle
Which of the following concept is more close to encapsulation
- Exception handling
- Inheritance
- Polymorphism
- information hiding
In________ a pointer or reference to an object is created inside a class
- aggregation
- Composition
- Separation
- None of the given
Polymorphism makes the system
- reusable
- flexible
- faster
- All of the given option
A child inherits characteristics from its__________
- Neighbor
- parent
- sibling
- itself
How can we identify classes from a given problem statement?
- By extracting Nouns from problem statement
- By extracting verbs from problem statement
- By extracting adjective from problem statement
- All of the given option
Aggregation between objective shows that__________
- Objects have strong relationship
- Objects have weak relationship
- Objects have no relationship
- Objective have hierarchical relationship
Choose the correct option
- constructors cannot be const
- Destructors cannot be const.
- Constructors and Destructors are used to modify the object to a well-defined state.
- All of the given options
Through interface access object’s__________
- States
- Data members
- Behavior
- Class
All objects of same class has_____________attributes.
- Different
- Equal
- Same
- None of the given option
In __________ base class can be replaced by the derived class.
- Aggregation
- Inheritance
- Dependency
- Extension
Which of the following can only be overloaded as member function of the class?
- Equality operator: ==
- Inequality operator: !=
- Function operator: ()
- Stream extraction operator: >>
Which of the following is an example of objects in school?
- Car, Chair
- Student, Teacher
- Teacher, Height
- Book, Pages
In OOP we can achieve reusability through?
- Inheritance
- Encapsulation
- Aggregation
- Association
Subtyping means that derived class is behaviorally _________ with the base class.
- Same
- Compatible
- Different
- Incompatible
Which of the following can be used as an alternative to static members?
- Local Variables
- Global Variables
- Constant Variable
- Array of objects
_________ operator is used to create objects at run time
- create
- new
- dynamic
- subscript
Identify the common attributes of the given scenario:
Circle has color, vertices, and radius
Triangle has color, vertices, and angle
- Color, Vertices
- vertices, Radius
- Color, Angle
- Vertices, Radius
Inheritance is shown by:
- Open head arrow
- Filled arrow
- Single Line
- Bi-directional
In expression c1*c2+c3-c4 which of the following will be executed in first order?
- c1*c2
- c2+c3
- c3-c4
- c1-c4
An object has attribute, operations, and__________
- Unique Identity
- Behavior
- Characteristics
- All of these
Suppose a class does not have any constructor. what will happen when an object of this class is created ?
- Compiler will generate syntax error
- Run time error will occur
- Compiler will call implicit default constructor
- None of the given options
Hiding the implementation details makes program:
- Easy to understand
- More complex
- Provide more features
- Logical
In object oriented programming, objects communicate with each other through________
- Message
- Data member
- Voice chat
- Ports
Which of the following operator(s) take(s) one or no argument if overloaded?
- ++
- *
- %
- All of the given option
What is meant by multiple inheritance?
- Deriving a base class from derived class
- Deriving a derived class from base class
- Deriving a derived class from more than one base class
- None of the given option
Through_________,objects communication which outer world.
- Encapsulation
- Interface
- Inheritance
- Polymorphism
Information hiding can be achieved through__________
- Encapsulation, Inheritance
- Encapsulation, Polymorphism
- Encapsulation, Abstraction
- Encapsulation, Overloading
-
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
-
In Protected Inheritance the public members of base class become ________ in derived class.
- Public
- Private
- Protected
- None of the given
-
In which of the following OOP paradigm objects cannot exist independently?
- Polymorphism
- Inheritance
- Aggregation
- Composition
-
Function overriding is done in context of,
- Single class
- Single derived class
- Single base class
- Derived and base class
-
In polymorphism, messages can be interpreted in different ways depending upon the ________ class.
- base
- derived
- sender
- receiver
-
Insertion operator is ________ associative.
- Right to Left
- Left to Right
- Left to Left
- Right to Right
-
If class B inherits from class A then it contains all characteristics of ________.
- Class B
- Class A
- No inheritance
- None of the given
-
What is meant by multiple inheritance?
- Deriving a base class from derived class
- Deriving a derived class from base class
- Deriving a derived class from more than one base class
- None of the given
-
The other name of specialization is ________.
- Restriction
- Extension
- Dependency
- Subtyping
-
In C++ by default access of classes is ________.
- Private
- Protected
- Public
- None of the given
-
Suppose for a class String, assignment operator is overloaded with following declaration.
void operator =(const String &);
What will happen when we will write following statement in main()?
str1 = str2 = str3;
Where, str1, str2 and str3 are objects of class String.- Program will compile successfully.
- Compiler will generate compile time error.
- Run time error will be generated.
- None of the given
-
Subtyping means that derived class is behaviorally ________ with the base class.
- Same
- Compatible
- Different
- Incompatible
-
Suppose str1, str2 and str3 are objects of class String. Choose appropriate declaration of overloaded assignment operator for the following statement to work correctly.
- void operator =(const String &);
- String& operator =(const String &);
- String& overload =(const String &);
- void op =(const String &);
-
In C++, Composition is a relationship between ________ and ________ objects.
- Parent, child
- Base, derived
- Whole, part
- All of the given
-
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
-
Compiler generated copy constructor performs ________.
- Shallow copy
- Deep copy
- Both Shallow and Deep copy
- None of the given
-
We can have ________ type of member functions in a class.
- Public
- Private
- Protected
- All of the given
-
In C++ generic programming is done using ________.
- Procedures
- Packages
- Templates
- None of the given
-
How many objects are involved in the N-ary association?
- More than 1
- More than 2
- More than 3
- More than 4
-
Suppose there is an object of type Person, which of the following can be considered as one of its attributes?
- Name
- Eat
- Work
- Sleep
-
Generalization is ________ approach.
- Bottom-up
- Top-bottom
- Right-Left
- Left-Right
-
A good model is ________ related to a real life problem.
- Loosely
- Openly
- Closely
- Not
-
When derived class has user defined assignment operator.
- Compiler itself calls base class assignment operator.
- Compiler itself calls base class copy constructor.
- Compiler itself calls base class default constructor.
- Compiler does nothing.
-
What is the output of the following code?
int main()
{
int const x = 10;
cout << ++x;
return 0;
}- 10
- 11
- Error
- None of the given
-
Which of the following is True about class?
- It is a mechanism in C++ to realize objects in a program.
- It is concrete implementation of objects in C++
- It is used to create new types in C++ according to our requirement
- All of the given
-
If you have three classes in a C++ program A, B, and C where class A inherits from class B, then class ________ contains all the characteristics of class ________.
- B, A
- A, B
- A, C
- B, C
-
"Student registers Course and Teacher teaches the Course." is an example of:
- Binary Association
- Two way Association
- Ternary Association
- N-ary Association
-
How can we differentiate between constructors and destructors?
- Destructors have a return type but Constructors do not have return type.
- Destructors can't be defined by the programmer, but Constructors can be defined by the programmer.
- Destructors are preceded with a tilde (~) symbol, and constructors are not preceded with any symbol.
- Destructors are exactly same as Constructors in syntax.
-
Polymorphism makes the system:
- reusable
- flexible
- faster
- All of the given
-
What is a class?
- A class is a section of computer memory containing objects
- A class is a section of the hard disk reserved for object oriented programs
- A class is the part of an object that contains the variables
- A class is a description of a kind of object
-
Consider the statement "room has chair" Which of the following type of association exists between room and chair?
- Inheritance
- Composition
- There is no association
- Aggregation
-
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
-
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
-
The ________ tells the compiler what task the function will be performing.
- Function declaration
- Function calling
- Function definition
- None of the given
-
Which of the following is True about Destructor?
- It is used to free memory that is allocated through dynamic allocation.
- Free memory allocated using new operator by over self in destructor.
- It is used to perform house keeping operations.
- All of the given
-
Class is blueprint of ________.
- Interface
- Class
- Objects
- Model
-
________ defines the order of evaluation of an operator in an expression.
- Operator Associativity
- Operator Precedence
- Arity of Operators
- None of the given
-
Abstraction provides information according to ________.
- User perspective
- Owner perspective
- Random information
- All information
-
________ is represented by a line with an unfilled diamond head towards the container.
- Inheritance
- Association
- Aggregation
- Composition
-
How the information hidden within an object can be accessed?
- Through its interface
- Through its private data members
- Through its private member functions
- Through both public and private members
-
A pure virtual function is a virtual function that
- causes its class to be abstract.
- returns nothing.
- is used in a derived class.
- takes no arguments.
-
Which of the following can be the attribute of an object "Ali"?
- Eat
- Walk
- Sleep
- Address
-
Which of the following can be the behavior of an object "Usman"?
- Name
- Age
- Address
- Eat
-
In case when we define the function outside the class then we must use the keyword ________ to make the function inline.
- requestin
- inlineout
- inline
- defineinline
-
How many entities are there in the following scenario?
Ali lives in the house that is near the tree and he also drives his car.- 1
- 2
- 3
- 4
-
________ remain in memory even when all objects of a class have been destroyed.
- Static Variables
- Instance Variables
- Primitive Variables
- None of the given
-
In case of public inheritance, protected members of base class will be ________ in derived class.
- private
- public
- Protected
- hidden
-
A template argument is preceded by the keyword ________.
- vector
- class
- template
- type*
-
In resolution order compiler search firstly ________.
- Generic Template
- Partial Specialization
- Complete Specialization
- Ordinary function
-
The overloaded '-' operator for Complex class will be called with reference to ________ in the following statement
Complex C3 = C1 - C2;- Complex
- C1
- C2
- C3
-
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?- 5, 5, 5
- 5, Junk value, 5
- Junk value, 5, Junk value
- Junk value, 5, 5
-
Which of the following concept is more close to encapsulation?
- Exception Handling
- Inheritance
- Polymorphism
- Information Hiding
-
________ Binding means that target function for a call is selected at compile time.
- Static
- Dynamic
- Automatic
- None of the given
-
In operator overloading, which of the following operator takes one or no argument.
- ++
- *
- %
- <<
-
Which of the following is the correct syntax of declaring static variable "count" of type int?
- static count int;
- static int count;
- int static count;
- int count static;
-
Which of the following types of Inheritance is used to model "Implemented in terms of" relationship?
- Public
- Private
- Protected
- Confidential
-
Which of the following is a strong relationship?
- Inheritance
- Composition
- Association
- Polymorphism
-
Suppose we have defined derived class copy constructor but have not defined base class copy constructor then compiler will,
- Use base class default constructor
- Generate base class copy constructor itself
- Use base class assignment operator
- None of the given
-
Which of the following operators operate on one operand?
- Binary Operators
- Unary Operators
- Ternary Operator
- All of the given
-
In ________, Base class can't always be replaced by the derived class.
- Aggregation
- Inheritance
- Specialization
- Extension
-
How many objects of a given class may be constructed in an application?
- Only one per constructor.
- As many as the application asks for
- Only one per class
- One object per variable
-
Methodologies to the development of reusable software relate to ________.
- Structure programming
- procedural programming
- generic programming
- None of the given
-
In order to make any function constant, keyword const is placed at the ________ of the parameter list.
- Beginning
- Middle
- End
- None of the given
-
A Child class can call constructor of its parent class through,
- Its constructor initialization list
- Its constructor body
- Both from its constructor initialization list or body
- Can not call the constructor of its parent class
-
Which of the following is TRUE.
- Derived class pointer can be used as Base class pointer
- Base class pointer can be used as Derived class pointer
- Both of these options
- None of the given
-
The default inheritance mode is,
- Public inheritance
- Protected inheritance
- Private inheritance
- None of the given
-
Which of the following classes are used by Amphibious vehicle to inherit characteristics?
- Land Vehicle
- Water Vehicle
- Both Land & Water Vehicle
- None of the given
-
A template provides a convenient way to make a family of
- variables and data members
- functions and classes
- classes and exceptions
- programs and algorithms
-
Static Data Member is declared ________.
- Inside the class
- Outside the class
- Inside main() method
- None of the given
-
In expression c1*c2+c3-c4 which of the following will be executed in first order?
- c1*c2
- c2+c3
- c3-c4
- c1-c4
-
We can access a private static variable through:
- Static data member
- Static member function
- Global data member
- None of the given
-
Static casting is,
- Implicit way of calling base class functions from derived class
- Explicit way of calling base class functions from derived class
- Both of the given
- None of the given
-
Constructors have ________ return type.
- int
- char
- void
- no
-
Defining a function in class body, the compiler treats that function as:
- User defined function
- Static function
- Recursive function
- Inline function
-
Mermaid is an example of:
- Single inheritance
- Polymorphism
- Specialization
- Multiple Inheritance
-
Assignment operators are:
- Left associative
- Right associative
- Left and right associative
- Non associative
-
Choose correct declaration of overloaded stream insertion operator for class String as non-member friend function.
- friend ostream & operator << ();
- friend void & operator << (ostream & os);
- friend void operator << (const String & rhs);
- friend ostream & operator << (ostream & os, const String & s);
-
In C++, which of the following keywords works only with constructors?
- const
- static
- explicit
- virtual
-
In C++, which of the following operator can only be overloaded as a member function of the class?
- Equality Operator: ==
- Inequality Operator: !=
- Function Operator: ()
- Stream Extraction Operator: >>
-
Identify the abstract class from the given statement:
"Vehicle class is base class. Bus, Car, and Truck are derived classes"- Vehicle
- Bus
- Car
- Truck
-
Which of the following is NOT casting operator in C++ standard?
- static_cast
- var_cast
- dynamic_cast
- reinterpret_cast
-
In case of protected inheritance, public members of base class will be ________ in derived class?
- private
- public
- protected
- hidden
-
In case of private inheritance, private members of base class will be ________ in derived class.
- private
- public
- protected
- hidden
-
Which of the following statements best describes the Constructor?
- Constructor is used to modify constant data members of the class.
- Constructor is used to delete the objects of a class.
- Constructor is used to initialize the data members of a class.
- All of the given
-
The other name of specialization is ________.
- Restriction
- Extension
- Dependency
- Subtyping
-
The overloaded '-' operator for Complex class will be called with reference to ________ in the following statement
Complex C3 = C1 - C2;- Complex
- C1
- C2
- C3
-
What is a class?
- A class is a section of computer memory containing objects
- A class is a section of the hard disk reserved for object oriented programs
- A class is the part of an object that contains the variables
- A class is a description of a kind of object
-
In polymorphism, messages can be interpreted in different ways depending upon the ________ class.
- base
- derived
- sender
- receiver
-
Suppose there is an object of type Person, which of the following can be considered as one of its attributes?
- Name
- Eat
- Work
- Sleep
-
Which of the following is True about class?
- It is a mechanism in C++ to realize objects in a program.
- It is concrete implementation of objects in C++
- It is used to create new types in C++ according to our requirement
- All of the given
-
In C++, which of the following keywords works only with constructors?
- const
- static
- explicit
- virtual
-
Choose correct declaration of overloaded stream insertion operator for class String as non-member friend function.
- friend ostream & operator << ();
- friend void & operator << (ostream & os);
- friend void operator << (const String & rhs);
- friend ostream & operator << (ostream & os, const String & s);
-
Which of the following classes are used by Amphibious vehicle to inherit characteristics?
- Land Vehicle
- Water Vehicle
- Both Land & Water Vehicle
- None of the given
-
Constructors have ________ return type.
- int
- char
- void
- no
-
The other name of specialization is ________.
- Restriction
- Extension
- Dependency
- Subtyping
-
________ is represented by a line with an unfilled diamond head towards the container.
- Inheritance
- Association
- Aggregation
- Composition
-
________ remain in memory even when all objects of a class have been destroyed.
- Static Variables
- Instance Variables
- Primitive Variables
- None of the given
-
Static Data Member is declared ________.
- Inside the class
- Outside the class
- Inside main() method
- None of the given
-
A good model is ________ related to a real life problem.
- Loosely
- Openly
- Closely
- Not
-
In which of the following OOP paradigm objects cannot exist independently?
- Polymorphism
- Inheritance
- Aggregation
- Composition
-
In order to make any function constant, keyword const is placed at the ________ of the parameter list.
- Beginning
- Middle
- End
- None of the given
-
"Student registers Course and Teacher teaches the Course." is an example of:
- Binary Association
- Two way Association
- Ternary Association
- N-ary Association
-
Which of the following can be the attribute of an object "Ali"?
- Eat
- Walk
- Sleep
- Address
-
Consider the statement "room has chair" Which of the following type of association exists between room and chair?
- Inheritance
- Composition
- There is no association
- Aggregation
-
We can access a private static variable through:
- Static data member
- Static member function
- Global data member
- None of the given
-
Abstraction provides information according to ________.
- User perspective
- Owner perspective
- Random information
- All information
-
Which of the following concept is more close to encapsulation?
- Exception Handling
- Inheritance
- Polymorphism
- Information Hiding
-
How the information hidden within an object can be accessed?
- Through its interface
- Through its private data members
- Through its private member functions
- Through both public and private members
-
________ defines the order of evaluation of an operator in an expression.
- Operator Associativity
- Operator Precedence
- Arity of Operators
- None of the given
-
Which of the following is the correct syntax of declaring static variable "count" of type int?
- static count int;
- static int count;
- int static count;
- int count static;
-
Defining a function in class body, the compiler treats that function as:
- User defined function
- Static function
- Recursive function
- Inline function
-
What is the output of the following code?
int main()
{
int const x = 10;
cout << ++x;
return 0;
}- 10
- 11
- Error
- None of the given
-
Which of the following statements best describes the Constructor?
- Constructor is used to modify constant data members of the class.
- Constructor is used to delete the objects of a class.
- Constructor is used to initialize the data members of a class.
- All of the given
-
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?- 5, 5, 5
- 5, Junk value, 5
- Junk value, 5, Junk value
- Junk value, 5, 5
-
Which of the following is a strong relationship?
- Inheritance
- Composition
- Association
- Polymorphism
-
How many objects of a given class may be constructed in an application?
- Only one per constructor.
- As many as the application asks for
- Only one per class
- One object per variable
-
The other name of specialization is ________.
- Restriction
- Extension
- Dependency
- Subtyping
-
How can we differentiate between constructors and destructors?
- Destructors have a return type but Constructors do not have return type.
- Destructors can't be defined by the programmer, but Constructors can be defined by the programmer.
- Destructors are preceded with a tilde (~) symbol, and constructors are not preceded with any symbol.
- Destructors are exactly same as Constructors in syntax.
-
How many entities are there in the following scenario?
Ali lives in the house that is near the tree and he also drives his car.- 1
- 2
- 3
- 4
-
Which of the following is True about Destructor?
- It is used to free memory that is allocated through dynamic allocation.
- Free memory allocated using new operator by over self in destructor.
- It is used to perform house keeping operations.
- All of the given
-
How many objects are involved in the N-ary association?
- More than 1
- More than 2
- More than 3
- More than 4
-
Which of the following can be the behavior of an object "Usman"?
- Name
- Age
- Address
- Eat
-
In C++, Composition is a relationship between ________ and ________ objects.
- Parent, child
- Base, derived
- Whole, part
- All of the given
-
If you have three classes in a C++ program A, B, and C where class A inherits from class B, then class ________ contains all the characteristics of class ________.
- B, A
- A, B
- A, C
- B, C
-
In case when we define the function outside the class then we must use the keyword ________ to make the function inline.
- requestin
- inlineout
- inline
- defineinline
-
Mermaid is an example of:
- Single inheritance
- Polymorphism
- Specialization
- Multiple Inheritance
-
Assignment operators are:
- Left associative
- Right associative
- Left and right associative
- Non associative
-
Generalization is ________ approach.
- Bottom-up
- Top-bottom
- Right-Left
- Left-Right
-
The ________ tells the compiler what task the function will be performing.
- Function declaration
- Function calling
- Function definition
- None of the given
-
Suppose str1, str2 and str3 are objects of class String. Choose appropriate declaration of overloaded assignment operator for the following statement to work correctly.
- void operator =(const String &);
- String& operator =(const String &);
- String& overload =(const String &);
- void op =(const String &);
-
In operator overloading, which of the following operator takes one or no argument.
- ++
- *
- %
- <<
-
Class is blueprint of ________.
- Interface
- Class
- Objects
- Model
-
Polymorphism makes the system:
- reusable
- flexible
- faster
- All of the given
-
If class B inherits from class A then it contains all characteristics of ________.
- Class B
- Class A
- No inheritance
- None of the given
-
What is meant by multiple inheritance?
- Deriving a base class from derived class
- Deriving a derived class from base class
- Deriving a derived class from more than one base class
- None of the given
-
In C++, which of the following operator can only be overloaded as a member function of the class?
- Equality Operator: ==
- Inequality Operator: !=
- Function Operator: ()
- Stream Extraction Operator: >>
-
Insertion operator is ________ associative.
- Right to Left
- Left to Right
- Left to Left
- Right to Right
-
In expression c1*c2+c3-c4 which of the following will be executed in first order?
- c1*c2
- c2+c3
- c3-c4
- c1-c4
-
Suppose for a class String, assignment operator is overloaded with following declaration.
void operator =(const String &);
What will happen when we will write following statement in main()?
str1 = str2 = str3;
Where, str1, str2 and str3 are objects of class String.- Program will compile successfully.
- Compiler will generate compile time error.
- Run time error will be generated.
- None of the given
-
Identify the abstract class from the given statement:
"Vehicle class is base class. Bus, Car, and Truck are derived classes"- Vehicle
- Bus
- Car
- Truck
-
Which of the following operators operate on one operand?
- Binary Operators
- Unary Operators
- Ternary Operator
- All of the given
-
Subtyping means that derived class is behaviorally ________ with the base class.
- Same
- Compatible
- Different
- Incompatible
-
In ________, Base class can't always be replaced by the derived class.
- Aggregation
- Inheritance
- Specialization
- Extension
What will be the value of variables a,b, and c after instantiating an object of the
given class? class test {int a; int b; int c;public:test():b(5),c(a),a(b){}};
A. 5, 5, 5
B. 5, Junk value,
5
C. Junk value, 5, Junk value
D. Junk value, 5, 5
Student *ptr = new Student(“Ali”); is an example
of .
A. Dynamic memory
allocation ok
B. Destructor
C. Static memory
allocation
D. Constructor
Constant data members of a class can be initialized by using
.
A. Non-constant Member
Function
B. Class
C. Constant Member
Function
D. Member
Initializer List ok
Static Data
Member of a class is declared .
A. Outside the class
B. Outside the main()
method
C. Inside the class ok
D. Inside main()
method
Which of the following can be created
without any object
of a class?
A. Static Data Members ok
B. Array of Objects
C. Non-Static Data Members
D. Instance Variables
What will be the value of variables a,b, and c after instantiating an object of the
given class? class test {int a; int b; int c;public:test():b(5),c(a),a(b){}};
A. 5, 5, 5
B. 5, Junk value,
5
C. Junk value, 5, Junk value
D. Junk value, 5, 5
In operator overloading, which of the following operator
takes one or no
argument.
A. ++ ok
B. %
C. *
D. <<
In OOP, static
data members of a class are called variables.
A.
Structure
B.
Class ok
C. Object
D.
Function
Memory is allocated to non-static members
only, when
.
A. Program is compiled
B. Object is destructed
C.
Class is created
D.
Object is created ok
Which of the following
best describes relationship between House and Address classes?
A.
Association
B.
Inheritance
C.
Aggregation
D.
Composition
Which of the following
best describes relationship between House and Address classes?
A.
Association
B.
Inheritance
C. Aggregation
D.
Composition
means that different objects
can behave in different ways for the same message.
A.
Generalization
B.
Specialization
C.
Polymorphism
D.
Abstraction
In order to make any function constant, keyword const is placed
the parameter
list.
A.
after
B.
within
C. between
D.
before
Which of the following is NOT true about Inline
function?
A.
Inline function decreases the code execution
time.
B.
Inline function
does not substitute the code within
the function definition on a
function call.
C. It is used by compilers to improve efficiency of the program.
D.
Small size functions that need to be called
many times during program execution are declared
inline.
are best candidates to become objects
in problem description.
A. Verbs
B. Adjectives
C.
Adverb
D.
Nouns
Which of the following is not a pillar of Object Orientation Programming?
A. Polymorphism
B.
Abstraction
C.
Encapsulation
D.
Normalization
Which of the following is an advantage of inheritance?
A. Inconsistency
B. Re-usability
C.
Redundancy
D. Ambiguity
An object has interface(s).
A.
One or more than one
B. No
C.
Only one
D. Only two
How the information hidden
within an object
can be accessed?
A. Through its interface
B. Through
both public and private members ok
C.
Through its private
data members
D.
Through its private
member functions
Suppose there is an object of type Person,
which of the following can be
considered as one of its attributes?
A. Eat
B. Work
C.
Name
D.
Sleep
Inheritance is
the relationship between .
A. Functions
B. Classes ok
C.
Messages
D.
Interfaces
Suppressed form of class
representation contains .
A.
Interface Name
B.
Operations
C. Class Name
D.
Attributes
Generalization is
implemented through .
A.
Aggregation
B.
Inheritance
C. Composition
D.
Polymorphism
Entities in Object Oriented model are represented by .
A.
Rectangle ok
B.
Circle
C. Lines
D.
Square
couples data and behavior
tightly inside the object.
A. Abstraction
B.
Polymorphism
C.
Inheritance
D.
Encapsulation
Constructors have return type.
A. No ok
B.
Char
C.
Void
D. Int
Destructor is a function
which has the same
name as that of class,
but starts with a sign.
A.
$
B.
~ ok
C. #
D.
%
Which of the following is NOT true about constructors?
A.
Constructors
can use Initializer list for initializing the constant data members.
B.
Constructors can be const.
C. Constructors are called automatically.
D.
Constructors are used to modify the object to a well-defined state. 100% Correct answer required.
is automatically called when the object is created.
A.
Data Member
B. Member Function
C.
Constructor ok
D. Object
A child inherits characteristics
from .
A.
Sibling
B.
Neighbor
C. Itself
D.
Parent ok
is the relationship between
the “part” object
and the “whole” object.
A.
Association
B. Inheritance
C.
Composition ok
D. Polymorphism
Constructor is used to the objects
of a class.
A.
update
B.
delete
C. create
D.
initialize
Which of the following is NOT True about Destructor?
A.
Used to perform
house keeping operations
B. Free memory
allocated using new operator
C. Used to free memory allocated through
dynamic allocation
D.
Used to free memory
allocated through static
allocation
“A fan has wings”.
Which type of relationship exists
between fan and wings in this sentence?
A.
Association
B. Generalization
C.
Aggregation
D. Composition ok
The concept of derived
classes is involved
in .
A.
encapsulation
B.
abstraction
C. inheritance
D.
aggregation
The functions
defined inside the class are usually taken by compiler.
A.
Public
B. Static
C.
Inline ok
D. Constant
Which of the following statement best describes the Constructor?
A.
Constructor is used to initialize the data members
of a class. ok
B.
Constructor
is used to delete the objects of a class.
C. Constructor is used to create an object of a class.
D.
Constructor
is used to modify constant
data members of the class.
Compiler
generated default constructor is called and user written default constructor is
called .
A.
Implicit, Explicit ok
B. Explicit, User-defined
C.
Compiler-defined, Implicit
D. Explicit, Implicit
We can allocate
dynamic memory in C++ through
operator.
A. Static
B.
New ok
C.
Const
D.
Global
Which of the following is a tangible
entity?
A.
Database
B.
Time
C. Car
D.
Date of birth
What is meant by multiple
inheritance?
A.
Deriving a derived
class from base class
B.
Deriving a derived class from more than one base class ok
C. None of the given option
D.
Deriving a base class from derived class
Through , Objects
communicate with outer
world.
A.
Polymorphism
B.
Encapsulation
C.
Interface ok
D.
None of these
Suppose Person is a class, which of the following statement
declares an object of class
Person?
A.
Object Person;
B.
Define Object;
C. Create Person
object;
D.
Person person; ok
is the reverse process
of Generalization.
A.
Specialization ok
B.
Aggregation
C. Inheritance
D.
Dependence
Suppose a class does not have any constructor. What will happen
when an object of this class is created?
A. Compiler will call default
parameterized constructor.
B. Compiler will call implicit
default constructor. ok
C.
Compiler will generate
syntax error.
D.
Run time error
will occur.
How many objects can be created
once a class is defined?
A.
As many as needed
B. Two
C.
Four
D.
Three
“Object hides its information from others”, this concept is known as
.
A. Polymorphism
B. Information Hiding
C.
Specialization
D. Inheritance
In OOP, which of the following
feature is used to
derive a class from
another class?
A.
Inheritance ok
B.
Data hiding
C.
Polymorphism
D.
Encapsulation
Statement “Yasir
is a friend of Ali and Ali is a friend of Yasir” is an
example of .
A.
Ternary association
B.
N-ary association
C. Two way association
D.
One way association
Which of the following can be the behavior of an object “Usman”?
A.
Name
B.
Eat ok
C.
Address
D.
Age
Class is
blueprint of a/an .
A.
Interface
B.
Model
C. Function
D.
Object
Which of the following statements defines destructor for class Student?
A.
~Student() {//… } ok
B. ~Destruct() {//… }
C.
~Destructor() {//… }
D. ~DestroyStudent() {//…}
Which of the following is an advantage of encapsulation?
A. Increase Memory
Usage
B. Inefficient Code
C.
Complexity
D.
Information Hiding
Which of the following is NOT true about constructor?
A.
Constructor is a special
function which can have different
name than class name.
B. Constructor is used to initialize data members of a class.
C.
Constructors
are commonly public
members of a class.
D.
Constructor
does not have return type.
Abstraction hides the details.
A. Irrelevant
B. Public
C.
Relevant
D.
Private
is used for hiding
the details of an object
from the other parts
of a program?
A.
Encapsulation
B.
Composition
C.
Inheritance
D.
Aggregation
Which of the following method allows to reuse the characteristics of more than one parent class?
A. Polymorphism
B.
Single inheritance
C.
Specialization
D. Multiple Inheritance ok
Which of the following is part of the class
in UML diagram?
A.
Attributes
B.
Behaviors
C.
Class Name
D.
All of the given
options ok
Abstraction provides
information according to .
A.
Random information
B.
All information
C. Behavioural perspective
D. User perspective
In class, attributes and behaviors are represented by and
respectively.
A.
Access Specifiers, Friend Functions
B.
Member functions, Data members
C.
Member functions, Accessor
Specifiers
D.
Data Members,
Member Functions ok
Interface is
a set of of an object exposed
to other objects.
A. Methods
B.
Classes
C.
Attributes
D.
Structures
Question No:1 (Marks:1) Vu-Topper RM Which of the following best describes
relationship between Book and BookChapter classes?
Which of the following
best describes relationship between House and Address classes?
E. Association
F.
Inheritance
G. Aggregation
H.
Composition ok
Question No:2 (Marks:1) Vu-Topper RM
The keyword "friend" should be placed
in :
A.
Main Function
B.
Function Definition
C.
Anywhere in program
D.
Function Declaration Google ok
Question No:3 (Marks:1) Vu-Topper RM
Which of the following
stores the address
of a variable?
A. Pointer ok
B.
Function
C.
Destructor
D.
Constructor
Question No:4 (Marks:1) Vu-Topper RM
is creating
objects of one class inside
another class.
A.
Association
B.
Inheritance
C.
Aggregation
D. Composition Page 125 ok
Question No:5 (Marks:1) Vu-Topper RM
Which of the following can be used as an alternative to static members?
A.
Local Variables
B.
Array of Objects
C. Global
Variables ok
D.
Constant Variables
Question No:6 (Marks:1) Vu-Topper RM What is the general syntax of overloading
Unary Operator as member function of the class?
A.
TYPE & operator OP ();
B.
TYPE & operator
OP (int);
C.
TYPE & operator
OP (TYPE &);
D.
TYPE & operator
OP (TYPE &, TYPE &);
Question No:7 (Marks:1) Vu-Topper RM
Which of the following operators operate on one operand?
A.
Unary Operators
B.
Ternary Operator
C.
Binary Operators
D.
All of the given options
Question No:8 (Marks:1) Vu-Topper RM Composition is and aggregation is relationship.
A.
Weak, Weak
B.
Weak, Strong
C. Strong,
Weak ok
D.
Strong, Strong
Question No:9 (Marks:1) Vu-Topper RM Which of the following function declaration
is correct to overload the + operator as member function in Complex class?
A.
Complex +(const Complex
& rhs);
B.
operator + Complex
(const Complex & rhs);
C.
Complex operator
+(const Complex & rhs); ok
D.
Complex operator + ::(const Complex
& rhs);
Question No:10 (Marks:1) Vu-Topper RM
Insertion operator is associative.
A.
Left to Left
B.
Right to Left
C. Left to Right Page 160
D.
Right to Right
Question No:11 (Marks:1) Vu-Topper RM Which of the following statement is TRUE
about a class's Static Member Function?
A.
It can access
non-static data members.
B. It is used to access
static data members
only. ok
C.
It can only be called by a particular object
of class.
D.
It can access
constant data members
of the class.
Question No:12 (Marks:1) Vu-Topper RM Which of the following is the correct way of
declaring a constant variable named RollNo?
A.
const RollNo;
B.
int const rollNo;
C.
int RollNo const;
D. const
int RollNo; ok
Question No:13 (Marks:1) Vu-Topper RM
Which of the following is defined as stream extraction operator in C++?
A.
*<
B. <<
C.
*>
D. >> Page 158
Question No:14 (Marks:1) Vu-Topper RM
What will be the output of the following
code? #include<iostream>
using namespace std; int
main()
{
int const x = 10;cout <<
++x;}
A. 10 ok
B. Run Time Error
C. 11
D. Compile time Error
Question No:15 (Marks:1) Vu-Topper RM In C++, the subscript operator [] must be
overloaded as a of the class, with one parameter of type.
A. Member
function, int Google
B. Member function, char
C. Non-member function,
int
D. Non-member function, char
Question No:16 (Marks:1) Vu-Topper RM
We can get the address
of a variable stored in a pointer
using
:
A. :symbol
B. :: symbol
C. ->symbol
D. & symbol Google ok
Question No:17 (Marks:1) Vu-Topper RM Suppose "int a;" is a
static data member of a class named test. Which of the following is the correct
way of initializing the static variable outside the class test?
A.
test a = 0; ok
B. int test::a
= 0;
C. int test->a = 0;
Question No:18 (Marks:1) Vu-Topper RM
Operator is used to create objects
at run time.
A. New Page 118 ok
B. Create
C. Dynamic
D. Subscript
Question No:19 (Marks:1) Vu-Topper RM Which of the following statement is NOT true
about static variable of a class?
A. They are created
even when there is no object of a class.
B. Static
variable belongs to a particular instance of a class.
C. Static variable
is initialized once only throughout the program.
D. They remain in memory even when all Objects of a class are
destroyed.
Question No:20 (Marks:1) Vu-Topper RM
Static Data
Members can be accessed through .
A. Semi colon
B. Dot operator
C. Scope resolution operator
D. Dot operator and scope resolution operator ok
Question No:21 (Marks:1) Vu-Topper RM Suppose we have a class named “Student”;
which of the following statement is correctly declaring the pointer to the
object for “Student” class?
A. Student obj;
B. Student &obj;
C. Student
*obj; ok
D. *Student obj;
Question No:22 (Marks:1) Vu-Topper RM Which of the following is the correct syntax
of declaring static variable “count” of type int?
A. int static
count;
B. int count static;
C. static count
int;
D. static int count; ok
Question No:23 (Marks:1) Vu-Topper RM In composition are called from composing objects to composed
objects.
A. Pointers
B. Destructors Page 131 ok
C. Constructors
D. Member Functions
Question No:24 (Marks:1) Vu-Topper RM
In C++, Composition is a relationship between and
objects.
A. Whole, part
B. Parent, child
C. Base, derived
D. All given options
are correct.
Question No:25 (Marks:1) Vu-Topper RM In which of the following OOP paradigm
objects cannot exist independently?
A. Aggregation
B. Inheritance
C. Composition
D. Polymorphism Page 56
Question No:26 (Marks:1) Vu-Topper RM
remain in memory
even when all objects of a class have been destroyed.
A. Primitive Variables
B. Static Data Members Page 114 ok
C. Constant Data Members
D. Instance Data Members
Question No:27 (Marks:1) Vu-Topper RM
We can access
a private static
data member of a class through
.
A. Static
data member Google ok
B. Global data member
C. Static member
function
D. Global member function
Question No:28 (Marks:1) Vu-Topper RM
Copy constructor is called when:
A. An object is deleted.
B. An object is created.
C. An array of objects
is created.
D. An object is created in term of pre
existing object. ok
Question No:29 (Marks:1) Vu-Topper RM
In
expression b = c / d , the arity of division (/) operator is : A. 1
B. 4
C. 2 ok
D. 3
Question No:30 (Marks:1) Vu-Topper RM If you do not initialize static data member
of a class of int type, it is automatically initialized with .
A. 0 ok
B. 1
C. Null
D. -32767
Question No:31 (Marks:1) Vu-Topper RM In composition are called from composed objects to composing
objects.
A. Pointers
B. Variables
C. Destructors
D. Constructors Page 130 ok
Question No:32 (Marks:1) Vu-Topper RM
In C++, which of the following is defined as stream insertion
operator?
A. *<
B.
<< Page 158
C. *>
D. >>
Question No:33 (Marks:1) Vu-Topper RM
Which of the following is an example
of unary operator?
A. Division Operator
( / )
B. Equality Operator
( = =)
C. Inequality Operator
( != )
D. Increment Operator ( ++ )
Question No:34 (Marks:1) Vu-Topper RM Which of the following issue(s) can be caused
by the use of friend functions?
A. All of the given ok
B. Tough debugging
C. Data vulnerability
D. Programming bugs
Question No:35 (Marks:1) Vu-Topper RM 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.
A. operator+(double& obj);
B. None of the given choices
C. Rational_number operator+( Rational_number & obj); ok
D. Rational_number operator+(Rational_number &obj, double& num);
Question No:36 (Marks:1) Vu-Topper RM In C++, which of the following operator can
only be overloaded as a member function of the class?
A. Equality Operator: ==
B. Function Operator:
()
C. Inequality Operator:
!=
D. Stream
Extraction Operator: >>
Question No:37 (Marks:1) Vu-Topper RM
In , Base class can’t always be replaced by the derived
class.
Specialization
Question No:38 (Marks:1) Vu-Topper RM
A class can have only destructor(s).
One
Question No:39 (Marks:1) Vu-Topper RM Which of the following keyword tells the
compiler to substitute the code
within the function definition for every instance of a function call?
A. Inline ok
B. Virtual
C. Instance
D. Function
Question No:40 (Marks:1) Vu-Topper RM
In OOP, we can
achieve reusability through .
A. Inheritance ok
B. Association
C. Data Hiding
D. Encapsulation
Question No:41 (Marks:1) Vu-Topper RM
Through interface we represent object's .
A. State
B. Class
C. Behavior ok
D. Data members
Question No:42 (Marks:1) Vu-Topper RM How many objects of a given class may be
constructed in an application?
A. Only one per class
B. One object per variable
C. Only one per constructor.
D. As many as the application asks for ok
Question No:43 (Marks:1) Vu-Topper RM The process of extracting common
characteristics from two or more classes and combining them into a superclass
is called .
A. Abstraction
B. Composition
C. Generalization ok
D. Specialization
Question No:44 (Marks:1) Vu-Topper RM “Student registers Course and Teacher teaches
the Course.” is an example of .
A. Binary
Association ok
B. N-ary Association
C. Ternary Association
D. Two way Association
Question No:45 (Marks:1) Vu-Topper RM
Which of the following concept is more close to encapsulation?
Information Hiding
Question No:46 (Marks:1) Vu-Topper RM
Aggregation between
objects shows that
Objects have weak relationship
Question No:47 (Marks:1) Vu-Topper RM Identify the abstract class from the given
statement: "Vehicle class is base class. Bus, Car, and Truck are derived
classes."
Vehicle
Question No:48 (Marks:1) Vu-Topper RM
An instance of user defined
type is called .
Object
Question No:49 (Marks:1) Vu-Topper RM Enclosing all the characteristics of an
object within the object itself is described as .
A. Inheritance
B. Abstraction
C. Encapsulation ok
D. Polymorphism
Question No:50 (Marks:1) Vu-Topper RM
Which of the following is a strong
relationship?
A. Association
B. Inheritance ok
C. Composition
D. Polymorphism
Question No:51 (Marks:1) Vu-Topper RM
Composition is a strong
relationship because
.
A. Composed objects
can exist independently.
B. Compose
object cannot exist independently ok
C. Composed objects are dependent on the relation
type.
D. Composed object’s relationship depends on the number of objects.
Question No:52 (Marks:1) Vu-Topper RM
Which of the following is NOT an access specifier
in C++?
A. Public
B. Private
C. Hidden ok
D. Protected
Question No:53 (Marks:1) Vu-Topper RM
How can we identify classes
from a given problem statement?
A. By extracting Verbs from problem
statement
B. By extracting Adverbs from problem
statement
C.
By extracting Nouns from problem
statement ok
D. By extracting Adjectives from problem statement
Question No:54 (Marks:1) Vu-Topper RM
If class B inherits from class A then it contains all characteristics of
.
Class A
Question No:55 (Marks:1) Vu-Topper RM
Which of the following represents the two-way association?
Employee works
for the company.
Question No:56 (Marks:1) Vu-Topper RM
Constructor without any parameter is called .
A. Copy constructor
B. Default
constructor ok
C. Overloaded constructor
D. Parameterized constructor
Question No:57 (Marks:1) Vu-Topper RM
All objects of same class has attributes.
A. Same ok
B. Double
C. Integer
D. Different
Question No:58 (Marks:1) Vu-Topper RM
Mermaid is an example of .
A. Specialization
B. Polymorphism
C. Single
inheritance ok
D. Multiple Inheritance
Thanks everone