0% found this document useful (0 votes)
79 views42 pages

CS304 Quiz File by Vu Topper RM

Uploaded by

1 dm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views42 pages

CS304 Quiz File by Vu Topper RM

Uploaded by

1 dm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Cs-304 Important Mid Term

Mcq’s Solution 100% Correct :


Solve By Vu-Topper RM!!
Question No:1(Marks:1) (Marks:1) Vu-Topper RM
A language feature that combines variables and methods in a single package is
called _____ Encapsulation

Question No:2 (Marks:1) Vu-Topper RM


__is a methodology that organizes a program into a collection of interacting
objects.
OOP

Question No:3 (Marks:1) Vu-Topper RM


Every object hides its state and show through behavior. this concept is known as
Information Hiding

Question No:4 (Marks:1) Vu-Topper RM


Capture only those details about an object that are relevant to current perspective
Abstraction

Question No:5 (Marks:1) Vu-Topper RM


Which is not feature of OOP in general definitions….
Duplicate/Redundant data

Question No:6 (Marks:1) Vu-Topper RM


What is the additional feature in classes that was not in structures?
Member functions

Question No:7 (Marks:1) Vu-Topper RM


Who invented OOP….
Alan Kay

Question No:8 (Marks:1) Vu-Topper RM


if we extend our model, and the rest of the model is not affected then it is called—

Flexibility
Class

Question No:9 (Marks:1) Vu-Topper RM


Suppose there is an object of type Person, which of the following can be
considered as one of its attributes?
Name and Age

Question No:10 (Marks:1) Vu-Topper RM


Which of the following is not true about constant member function?
All

Question No:11 (Marks:1) Vu-Topper RM


Subtyping means that derived class is behaviorally _____________ with the base
class.
Compatible

Question No:12 (Marks:1) Vu-Topper RM


___ is represented by a line with an unfilled diamond head towards the container.
Aggregation

Question No:13 (Marks:1) Vu-Topper RM


Minimum classes required for implementing multiple inheritance: 3

Question No:14 (Marks:1) Vu-Topper RM


Destructor is a function which has the same name as that of class, but starts with
a-----sign.
Tilda (~)

Question No:15 (Marks:1) Vu-Topper RM


A good model is ................ related to a real life problem.
Closely

Question No:16 (Marks:1) Vu-Topper RM


How many objects are involved in the N-ary association?
more than 3

Question No:17 (Marks:1) Vu-Topper RM


In constant member function the type of this pointer is:
Constant pointer to constant data

Question No:18 (Marks:1) Vu-Topper RM


Compiler generated default constructor is called-----and user written--- default
constructor is called__________________.
Implicit, explicit

Question No:19 (Marks:1) Vu-Topper RM


Which of the following is an advantage of encapsulation?
Better understanding

Question No:20 (Marks:1) Vu-Topper RM


If some of objects exhibit identical characteristics, then they belong to: Different
classes
Question No:21 (Marks:1) Vu-Topper RM
Abstraction hides the---------details.
Relevant

Question No:22 (Marks:1) Vu-Topper RM


Polymorphism makes the system:
All of the given option

Question No:23 (Marks:1) Vu-Topper RM


If class B inherits from class A then it contains all characteristics of _.
Class A

Question No:24 (Marks:1) Vu-Topper RM


How the information hidden within an object can be accessed?
Through its interface

Question No:25 (Marks:1) Vu-Topper RM


Which of the following depicts the proper definition of class?
A class is a description of a kind of object

Question No:26 (Marks:1) Vu-Topper RM


Which of the following statement best describes the Constructor?
Constructor is used to initialize the data members of a class

Question No:27 (Marks:1) Vu-Topper RM


________ is automatically called when the object is created.
Constructor

Question No:28 (Marks:1) Vu-Topper RM


Consider the statement” room has chair” which of the following type of
Association exists between whom and chair?
Aggregation

Question No:29 (Marks:1) Vu-Topper RM


The—— tells the compiler what task the function will be performing
Function definition

Question No:30 (Marks:1) Vu-Topper RM


Which of the following is a tangible entity
Car

Question No:31 (Marks:1) Vu-Topper RM


Suppose derived class is inherited from base class. What happens when a derived class object is
created?
The constructor of base class is executed before the constructor of derived class.

Question No:32 (Marks:1) Vu-Topper RM


Suppose str1, str2 and str3 are objects of class String. Choose appropriate declaration of
overloaded assignment operator for the following statement to work correctly.

str1 = str2 = str3;

String& operator =(const String &);

Question No:33 (Marks:1) Vu-Topper RM


In C++, which of the following is defined as stream insertion operator?

<<

Question No:34 (Marks:1) Vu-Topper RM


Choose correct declaration of overloaded inequality (!=) operator for class String as
nonmember friend function.

None of the given options

Question No:35 (Marks:1) Vu-Topper RM


Relationship in which child object gets destroyed if parent object is destroyed.

Composition

Question No:36 (Marks:1) Vu-Topper RM


How the information hidden within an object can be accessed?

Through its interface

Question No:37 (Marks:1) Vu-Topper RM


Which of the following defines default constructor for class "Student"?

Student() {//...}

Question No:38 (Marks:1) Vu-Topper RM

The sub-object’s life is not dependent on the life of master class in ___________.

Aggregation

Question No:39 (Marks:1) Vu-Topper RM


Hiding the implementation details makes program:

Easy to understand

Question No:40 (Marks:1) Vu-Topper RM


The functions defined inside the class are by default ________.

Inline

Question No:41 (Marks:1) Vu-Topper RM


Which of the following statement is TRUE about static function of a class?

It is used to access static data members.

Question No:42 (Marks:1) Vu-Topper RM


Deconstruct is a function which has the same name as that of class but starts with a—– sign ~

Question No:43 (Marks:1) Vu-Topper RM


'this' pointer cannot be passed implicitly to __________ functions.

Static Member

Question No:44 (Marks:1) Vu-Topper RM

Which of the following can be the behavior of an object “Usman”?

Eat

Question No:45 (Marks:1) Vu-Topper RM


In Object Oriented programming, objects communicate with each other through ________

Messages

Question No:46 (Marks:1) Vu-Topper RM


Constructor is used to______the objects of a class.

Initialize

Question No:47 (Marks:1) Vu-Topper RM


Which of the following is NOT an access specifier in C++?

Hidden

Question No:48 (Marks:1) Vu-Topper RM


The other name of subtyping is ________.

Extension

Question No:49 (Marks:1) Vu-Topper RM


Suppose a class does not have any constructor. What will happen when an object of this class is
created?

Compiler will call implicit default constructor.

Question No:50 (Marks:1) Vu-Topper RM


In case when we define the function outside the class then we must use the keyword _________
to make the function inline.

Inline

Question No:51 (Marks:1) Vu-Topper RM


In constant member function the type of this pointer is:

Constant pointer to constant data

Question No:52 (Marks:1) Vu-Topper RM


In ____________, base class can be replaced by the derived class.

Extension

Question No:53 (Marks:1) Vu-Topper RM


We can get the address of a variable stored in a pointer using __________:

&symbol

Question No:54 (Marks:1) Vu-Topper RM


A child inherits characteristics from its _________.

Parent

Question No:55 (Marks:1) Vu-Topper RM


Which of the following function declaration is correct to overload the + operator as member
function in Complex class?

Complex operator +(const Complex &rhs);

Question No:56 (Marks:1) Vu-Topper RM


Which of the following is not true about constant member function?

All of the given options

Question No:57 (Marks:1) Vu-Topper RM


What is the general syntax of overloading Unary Operator as member function of the class?

TYPE & operator OP ();

Question No:58 (Marks:1) Vu-Topper RM


_____ is creating objects of one class inside another class.

Composition

Question No:59 (Marks:1) Vu-Topper RM


Memory is allocated to non static members only, when Object
is created

Question No:60 (Marks:1) Vu-Topper RM


A child inherit characteristics from its ? parents

Question No:61 (Marks:1) Vu-Topper RM


A post-fix unary operator is implemented in C++ member function with 1
dummy int arguments

Question No:62 (Marks:1) Vu-Topper RM


Which of the following is the example of objects in school? Books
, pages

Question No:63 (Marks:1) Vu-Topper RM


Suppose student is a class, which of the following constructor with one parameter for class
student? Student()

Question No:64 (Marks:1) Vu-Topper RM


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 ________. A, C

Question No:65 (Marks:1) Vu-Topper RM


In ____ base class can be replaced by the derived class. Extension

Question No:66 (Marks:1) Vu-Topper RM


The concept of derived class is involved in _____ inheritance

Question No:67 (Marks:1) Vu-Topper RM


Suppose person is a class which of the following statement defines an object of class person?
Create person object

Question No:68 (Marks:1) Vu-Topper RM


The other name of subtyping is
Extension
Question No:69 (Marks:1) Vu-Topper RM
Which of the following statement best describes the constructor constructor
is used to initialize the data member of a class.

Question No:70 (Marks:1) Vu-Topper RM

Which of the following can be the behavior of an object “Usman”? Eat

Question No:71 (Marks:1) Vu-Topper RM


Composition is ____ relationship
Part whole

Question No:72 (Marks:1) Vu-Topper RM


Which of the following is a strong relationship? Composition

Question No:73 (Marks:1) Vu-Topper RM


This car is composed of wheels. What is the relationship between car and wheels?
Composition

Question No:74 (Marks:1) Vu-Topper RM


In ____ base class can be replaced by the derived class. Extension

Question No:75 (Marks:1) Vu-Topper RM


___ defines the order of evaluation of an operator is an expression.
Operator precedence

Question No:76 (Marks:1) Vu-Topper RM


In composition __ are called from composing objects to composed objects. Destructor

Question No:77 (Marks:1) Vu-Topper RM


How many objects of a given class may be constructed in an application? As
many as the application asks for
Question No:78 (Marks:1) Vu-Topper RM
Relationship in which child object gets destroyed, If parent object is destroyed. Composition

Question No:79 (Marks:1) Vu-Topper RM


Which of the following is not true about constructor?
Constructor is a special function which can have different name than class name.

Question No:80 (Marks:1) Vu-Topper RM


Suppose test is a class, void show() is its public member function. which of the following is
correct call of show() function using Test pointer ptr? ptr->show()

Question No:81 (Marks:1) Vu-Topper RM


Which of the following features of OOP is used to deal with only relevant details?
Abstraction

Question No:82 (Marks:1) Vu-Topper RM


In C++ the subscript operator must be overloaded as a ___ of the class, with one parameter of
___ type.
Member function, int

Question No:83 (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:84 (Marks:1) Vu-Topper RM


How can we differentiate between constructor and destructors?
Destructor are preceded by a tilde(~) symbol and constructor are not preceded with any
symbol.

Question No:85 (Marks:1) Vu-Topper RM


If you do not initialize static variable of int type then it is automatically initialized with ____
0

Question No:86 (Marks:1) Vu-Topper RM


___ associates the objects of the exact two classes. Binary
association

Question No:87 (Marks:1) Vu-Topper RM


Which of the following is the advantage of inheritance?

Reusability
Question No:88 (Marks:1) Vu-Topper RM

Member function defined inside a class declaration are __ by default

Public

Question No:89 (Marks:1) Vu-Topper RM


In Object Oriented programming objects communicate with each other through ____
Messages

Question No:90 (Marks:1) Vu-Topper RM


____ associates the objects of the exact three classes. Ternary
Association

Question No:91 (Marks:1) Vu-Topper RM


An objects has attributes, operations and _____ Unique
identity

Question No:92 (Marks:1) Vu-Topper RM


In C++ which of the following keywords works only with constructors? Explicit

Question No:93 (Marks:1) Vu-Topper RM


Which of the following allows to reuse characteristics of more than one parent class?
Multiple Inheritance

Question No:94 (Marks:1) Vu-Topper RM


How many objects are involved in the Binary association?
2

Question No:95 (Marks:1) Vu-Topper RM


Which of the following features of OOP is used to deal with only relevant details?
Abstraction

Question No:96 (Marks:1) Vu-Topper RM

The overloaded ‘-‘ operator for complex class will be called with reference to ___ in the
following statement
Complex C3 = C1 – C2
Complex

Question No:97 (Marks:1) Vu-Topper RM


Static data member is declared __
Inside the class

Question No:98 (Marks:1) Vu-Topper RM


Which of the following will happen when a constant function tries to change the value of data
members of the class? Complex time error will occur

Question No:99 (Marks:1) Vu-Topper RM


_____ is set of functions of an objects exposed to other objects. Interface

Question No:100 (Marks:1) Vu-Topper RM


How many objects are involved in the Ternary association? 3

Question No:101 (Marks:1) Vu-Topper RM


Mermaid is an example of
Multiple inheritance

Question No:102 (Marks:1) Vu-Topper RM

Which of the following is the correct syntax of declaring static variable ‘count’ of type int?
static int count

Question No:103 (Marks:1) Vu-Topper RM


Which of the following operators operate on one operand? Unary
Operators

Question No:104 (Marks:1) Vu-Topper RM


Object Data includes ___
Both static and attributes of an objects

Question No:105 (Marks:1) Vu-Topper RM


In case when we define the function outside the class then we must use the keyword ___ to
make function inline. Inline

Question No:106 (Marks:1) Vu-Topper RM


A function call is resolved at run time in a)Non virtual members function
Virtual member function

Question No:107 (Marks:1) Vu-Topper RM


If the user does not specify the type if inheritance, then the default type of inheritance is
Private inheritance
Question No:108 (Marks:1) Vu-Topper RM
In case of private inheritance, private members of base class will be in derived class? Hidden

Question No:109 (Marks:1) Vu-Topper RM


Then int member i of base class is accessible in class, a)derived 1 only
derived 2 only

Question No:110 (Marks:1) Vu-Topper RM


In case of public inheritance, protected members of base class will be in derived class?
Protected

Question No:111 (Marks:1) Vu-Topper RM


Friend’s functions of class are _ members of that class.

Private

Question No:112 (Marks:1) Vu-Topper RM


Methodologies to the development of reusable software relate to .
Generic programming

Question No:113 (Marks:1) Vu-Topper RM


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

Question No:114 (Marks:1) Vu-Topper RM


Which of the following is not type of inheritance in c++?
Restricted

Question No:115 (Marks:1) Vu-Topper RM


In public inheritance the public members of base class become in derived class
Public

Question No:116 (Marks:1) Vu-Topper RM


When we want to implement one class in terms of another class then we use Public
inheritance

Question No:117 (Marks:1) Vu-Topper RM


In c++ generic programming is done using
Templates

Question No:118 (Marks:1) Vu-Topper RM


Friend’s functions of class are _ members of that class.
Private

Question No:119 (Marks:1) Vu-Topper RM


Methodologies to the development of reusable software relate to . a)Structure
programming Generic programming

Question No:120 (Marks:1) Vu-Topper RM


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

Question No:121 (Marks:1) Vu-Topper RM


the following constructors?
Implicit Default Constructor

Question No:122 (Marks:1) Vu-Topper RM


Suppose we have defined derived class copy constructor but have not defined base class
copy constructor then compiler will,
Generate base class copy constructor itself

Question No:123 (Marks:1) Vu-Topper RM


Child class can call constructor of its
Direct base class

Question No:124 (Marks:1) Vu-Topper RM


A child class can call constructor ofthe parent call through
Its constructor initialization list

Question No:125 (Marks:1) Vu-Topper RM


memory allocation in or class we should use
User defined assignment operator

Question No:126 (Marks:1) Vu-Topper RM


By default, the vector data items are initialized to
0 google

Question No:127 (Marks:1) Vu-Topper RM


In Private ---- only member functions and friend classes or functions of a derived class can
convert pointer or reference of derived object to that of parent object inheritance

Question No:128 (Marks:1) Vu-Topper RM


Template functions use __ than ordinary functions.
Lesser Memory

Question No:129 (Marks:1) Vu-Topper RM


Non-Template Friend functions of a class are friends of instance/s of that class.
All google

Question No:130 (Marks:1) Vu-Topper RM


Which one of the following terms must relate to polymorphism? a)Static allocation
Dynamic binding

Question No:131 (Marks:1) Vu-Topper RM


Assume a class Derv that is privately derived from class Base. An object of class
Derv locatedinmain() can access public
members of Derv

Question No:132 (Marks:1) Vu-Topper RM


A function call is resolved at run-time in a)non-virtual member function.
virtual member function.

Question No:133 (Marks:1) Vu-Topper RM


Two important STL associative containers are and set,map

Question No:134 (Marks:1) Vu-Topper RM


An abstract class is useful when,
We do not want to instantiate its object

Question No:135 (Marks:1) Vu-Topper RM


In order to define a class template, the first line of definition must be:

template <typename T> (Page 257)

Question No:136 (Marks:1) Vu-Topper RM


Identify the correct way of declaring an object of user defined template class A for char
typemembers? A< char > obj;

Question No:137 (Marks:1) Vu-Topper RM


The user must define the operation of the copy constructor.
True

Question No:138 (Marks:1) Vu-Topper RM


The find() algorithm
takes iterators as its first two arguments. (Object-Oriented Programming in C++)

Question No:139 (Marks:1) Vu-Topper RM

Compiler performs type checking to diagnose type errors,


Static

Question No:140 (Marks:1) Vu-Topper RM


Vectors contain contiguous elements stored as a[an] . a)variable array

Question No:141 (Marks:1) Vu-Topper RM


In a de-queue, (chose the best option) data can be inserted or deleted at any arbitrary
location, but the process is relatively slow.

Question No:142 (Marks:1) Vu-Topper RM


When a virtual function is called by referencing a specific object by name and using the dot
member selection operator (e.g.,squareObject.draw()), the reference is resolved at compile time.
False

Question No:143 (Marks:1) Vu-Topper RM


Considering the resolution order in which considering the resolution order in which compiler
search for functions in a program; the first priority is given to; the first priority is given to,
ordinary function

Question No:144 (Marks:1) Vu-Topper RM


One purpose of an iterator in the STL is to connect algorithms and containers.
True

Question No:145 (Marks:1) Vu-Topper RM


In , a base class can be replaced by its derived class,
Sub-typing

Question No:146 (Marks:1) Vu-Topper RM


What is a class?
A class is a description of a kind of object.
Question No:147 (Marks:1) Vu-Topper RM
Inheritance is a way to a)organize data.
add features to existing classes without rewriting them.

Question No:148 (Marks:1) Vu-Topper RM


We can use "this" pointer in the constructor in the body and even in the initialization list of any
classif we are careful,
True

Question No:149 (Marks:1) Vu-Topper RM


----- and------- methods may not be declared abstract.
private,static

Question No:150 (Marks:1) Vu-Topper RM


Which of the following operator(s) take(s) one or no argument if overloaded?

++(Page 162)

Question No:151 (Marks:1) Vu-Topper RM


Which of the following operators cannot be overloaded?
Scope resolution operator ( :: )

Question No:152 (Marks:1) Vu-Topper RM


Virtual functions allow you to
use the same function call to execute member functions of objects from different classes

Question No:153 (Marks:1) Vu-Topper RM


The copy () algorithm returns an iterator to the element one past the last element copied to.

Question No:154 (Marks:1) Vu-Topper RM


If you define a vector v with the default constructor, and define another vector w with aone-
argument constructor to a size of 11, and insert 3 elements into each of these vectors with
push_back(), then the size() member function will return for v and for w. 3 for v and 11
for w.

Question No:155 (Marks:1) Vu-Topper RM


Which of the following may not be an integral part of an object?
Protected data members

Question No:156 (Marks:1) Vu-Topper RM


A static member function can be called, even when a class is not __________.
Instantiated

Question No:157 (Marks:1) Vu-Topper RM


__________ provide the facility to access the data member.
accesser function
Question No:158 (Marks:1) Vu-Topper RM

A generalization-specialization relation between classes are implemented using inheritance

Question No:159 (Marks:1) Vu-Topper RM


Which of the following is not an example of multiple inheritances?
Woman

Question No:160 (Marks:1) Vu-Topper RM


A generic class showing all the common attributes and a behavior of other classes represents a
very important feature in oop called --- Inheritance

Question No:161 (Marks:1) Vu-Topper RM


The parameters given in temple definition other than those used for mentioning templates types
are called
Non Type parameters

Question No:162 (Marks:1) Vu-Topper RM


Which of the following is the correct way to define a template class X?
Template <typename T>classX{}

Question No:163 (Marks:1) Vu-Topper RM


In resolution order of function template, compiler searches for in the end Generic
template

Question No:164 (Marks:1) Vu-Topper RM


When we specialize a function template, it is called
Function template overloading

Question No:165 (Marks:1) Vu-Topper RM


Which of the following can be passed as type argument to template?
Both primitive type and user defined types

Question No:166 (Marks:1) Vu-Topper RM


Which of the following is known as Dereference operator inC++? *

Question No:167 (Marks:1) Vu-Topper RM


Which of the following represents partial specialization?
Template<class T, Class U, int>

Question No:168 (Marks:1) Vu-Topper RM


Which of the following statement is true about partial specialization?
Both class templates and function template can have partial specialization.

Question No:169 (Marks:1) Vu-Topper RM


Which of the following is correct code portion to initialize static datamember
“value”of int type for class X?
Template<class T> int X < T >::value = 0;

Question No:170 (Marks:1) Vu-Topper RM


When we want to have exactly identical operations on different data type, are
____used
Function Template

Question No:171 (Marks:1) Vu-Topper RM


In case of template specialization, if compiler cannot find required complete specialization then
it searches for some Partial specialization

Question No:172 (Marks:1) Vu-Topper RM


Which of the following is a constrained version of some first-class container?
Container Adapter

Question No:173 (Marks:1) Vu-Topper RM


In resolution order, highest priority is given to in template specialization.
Complete specialization

Question No:174 (Marks:1) Vu-Topper RM


Which of the following is not a sequence container?

Map

Question No:175 (Marks:1) Vu-Topper RM


STL stands for:
Standard Template Library

Question No:176 (Marks:1) Vu-Topper RM


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

Question No:177 (Marks:1) Vu-Topper RM


In C++, Composition is a relationship between ________ and ________ objects.
Parent, child

Question No:178 (Marks:1) Vu-Topper RM


A pure virtual function is a virtual function that causes its class to be abstract.

Question No:179 (Marks:1) Vu-Topper RM


If class B inherits from class A then it contains all characteristics of ________
Polymorphism

Question No:180 (Marks:1) Vu-Topper RM


________ is represented by a line with an unfilled diamond head towards the container.
Aggregation

Question No:181 (Marks:1) Vu-Topper RM


Subtyping means that derived class is behaviorally ________ with the base class.
Compatible

Question No:182 (Marks:1) Vu-Topper RM


In operator overloading, which of the following operator takes one or no argument. <<

Question No:183 (Marks:1) Vu-Topper RM


In C++ generic programming is done using 148. 149. 150. 151. 152. 153.
Packages

Question No:184 (Marks:1) Vu-Topper RM


In polymorphism, messages can be interpreted in different ways depending upon the ________
class. receiver

Question No:185 (Marks:1) Vu-Topper RM


Information hiding can be achieved through__________.
Encapsulation, Abstraction

Question No:186 (Marks:1) Vu-Topper RM


A good model is ................ related to a real life problem. Closely

Question No:187 (Marks:1) Vu-Topper RM


Which of the following features of OOP is used to derive a class from another?
Inheritance

Question No:188 (Marks:1) Vu-Topper RM


Which of the following is a weak relationship between two objects?
Aggregation

Question No:189 (Marks:1) Vu-Topper RM


Data items in a class must be private. False

Question No:190 (Marks:1) Vu-Topper RM


Memory is allocated to non-static members only, when:
Object is created

Question No:191 (Marks:1) Vu-Topper RM


The sub-object's life is not dependent on the life of master class in ___.
Aggregation

Question No:192 (Marks:1) Vu-Topper RM


Unary operators and assignment operator are right associative. true

Question No:193 (Marks:1) Vu-Topper RM


The >= operator can't be overloaded. false

Question No:194 (Marks:1) Vu-Topper RM


This pointer does not pass implicitly to __________ functions.
Static Member

Question No:195 (Marks:1) Vu-Topper RM


Operator overloading is giving C++ operators more than they can handle.

Question No:196 (Marks:1) Vu-Topper RM


Which of the following is TRUE,
Derived class pointer can be used as Base class pointer

Question No:197 (Marks:1) Vu-Topper RM


___________ Binding means that target function for a call is selected at run time
Dynamic

Question No:198 (Marks:1) Vu-Topper RM


Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 :

public c2 { }; Then c2 is

Direct base class of c3

Question No:199 (Marks:1) Vu-Topper RM


A parent class can call constructor of its child class through

Can not call the constructor of its child class

Question No:200 (Marks:1) Vu-Topper RM


_______________ is automatically called when the object is created.
Constructor

Question No:201 (Marks:1) Vu-Topper RM


Inheritance is a way to
Add features to existing classes without rewriting them

Question No:202 (Marks:1) Vu-Topper RM


Through interface we access object_____________.
Behaviour

Question No:203 (Marks:1) Vu-Topper RM


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?
Sub-typing

Question No:204 (Marks:1) Vu-Topper RM


A class has ________ destructor

One

Question No:205 (Marks:1) Vu-Topper RM


A class has ________ constructor
Four

Question No:206 (Marks:1) Vu-Topper RM


Behaviors of a type of objects are represented through Operations
There is/are ____ way(s) to create user defined types for objects in
C++.?cs304
2

Abstraction provides information according to __________.


User perspective

“Student registers Course and Teacher teaches the Course.” is an example


of:

Binary Association.

How many interactions are there in the following scenario? Imran has the
car. He drives the car and car has four wheels and doors.

4
5

In generalization, general class represents the __________ behavior of the


classes.
Common

____________means that different objects can behave in different ways for


the same message.

Polymorphism
How many objects can be created once a class is defined?

No limit

Which of the following best defines the abstraction?

Hide the implementation and show current perspective


How many objects are involved in the Binary association?

___________ is the reverse process of Generalization.


Specialization

All objects of same class has ——–attributes

Same

How the information hidden within an object can be accessed?


setter and getter
Through its interface
by member functions
Through its private member functions

In inheritance, a child class is a sub-type of base class.


True
False

Aggregation is implemented using pointer.


True
False

Main characteristic of information hiding is:


Limited access
Unlimited access
Keep the model interesting
Keep the model simple

Suppose "Cat" is a real world object that you want to transform


into programming entity. For this, which of the following
concepts would you use?
Class
Function
State
Behavior
Which of the following is/are the integral part of an object?
State
Behavior
Unique identity
All of given

When we create objects, then space is allocated to:


Member functions
Access specifier
Data members
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

We can choose any arbitrary name for a constructor.


True
False

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

A class can have only ___________ destructor.

Minimum classes required in a program for implementing multiple


inheritance:

3
4

Which of the following is true about accessor functions?

All of the given option

Generalization is implemented through

Inheritance

Constructors have _____ return type.

No

Consider the statement” room has chair” which of the following type of
Association exists between whom and chair?

Aggregation

A/An ____________ class implements the abstract concept.

Abstract classes
Which of the following is NOT an access specifier in C++?

Hidden

How can we identify classes from a given problem statement?

by extracting nouns from problem statement

Class is a blue print of

Object

A fan has wings, which type of relation exists between fan and Wings in
this sentence

Composition

Composition is a strong relationship because:

Composed object cannot exist independently

Which of the following statement best describes the Constructor?

Constructor is used to initialize the data members of a class


Data member(s) of a class "Student" can be:

All of the given option

The process of extracting common characteristics from two or more


classes and combining them into a generalized superclass is called
___________.

Generalization

Object oriented programming is better than procedural programming


because:

It is more close to reality

The feature by which one object can interact with another object is
_____________.

Message passing
In _____________sender of a message does not need to know exact class
of the receiver.

Polymorphism

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
In which of the following, different forms of a single entity exist?
Polymorphism

Main characteristic of information hiding is:


Keep the model simple

Which of the following best describe(s) the properties of constructor?


Composition

If we extend our model, and the rest of model is not affected, then it is
called__________.
Flexibility

Which of the following is not an example of multiple inheritance?

Car
Which one is not the main feature of object-oriented programming?
Classes and Objects
Exception handling
Inheritance
Polymorphism

You might also like