CS304 Mega MCQS
CS304 Mega MCQS
48. Consider the following two lines of code written for class student
1. Student sobj1;
2. Student sobj2(sobj1)
57. Which of the following is the best approach if it is required to have more than one functions
having exactly same functionality and implemented on different data types?
59. Like template functions, a class template may not handle all the types successfully.
`
AL-JUNAID INSTITUTE GROUP
► True (Page 258)
► False
►specialization
► inheritance (Page 216)
► abstraction
► composition
► Greater Memory
► Lesser Memory
► Equal Memory
► None of the given options
65. Non Template Friend functions of a class are friends of ________instance/s of that class.
► All google
► One specific
► All instances of one date type
► None of the given options
66. A pointer to a base class can point to objects of a derived class.
► True google
► False
`
AL-JUNAID INSTITUTE GROUP
67. A template argument is preceded by the keyword ________.
► vector
► class
► template
► type*
68. Which one of the following terms must relate to
polymorphism?
► Static allocation
► Static typing
► Dynamic binding (Page 239)
► Dynamic allocation
► Public
► Private
► Protected
► All of the given
70. Assume a class Derv that is privately derived from class Base. An object of class Derv located in
main() can access
► public members of Derv
► protected members of Derv.
► private members of Derv.
► protected members of Base.
72. Two important STL associative containers are _______ and _______.
► set,map
► sequence,mapping
► setmet,multipule
► sit,mat
`
AL-JUNAID INSTITUTE GROUP
74. Suppose you create an uninitialized vector as follows:
vector<int> evec;
After adding the statment,
evec.push_back(21);
what will happen?
► The following statement will add an element to the start (the back) of evec and will initialize it
with the value 21.
► The following statement will add an element to the center of evec and will reinitialize it with the
value
21.
► The following statement will delete an element to the end (the back) of evec and will
reinitialize it with the value 21.
► The following statement will add an element to the end (the back) of evec and initialize it with the
value 21.
75. Default constructor is such constructor which either has no ---------or if it has some parameters these
have -----
--- values
► Parameter, temporary
► Null, Parameter
► Parameter, default (Page 75)
► non of the given
► True
`
AL-JUNAID INSTITUTE GROUP
► False
79. Identify the correct way of declaring an object of user defined template class A for char type members?
► True
► False
► variable
► array (Page 306)
► function
► datatype
`
AL-JUNAID INSTITUTE GROUP
► True
► False(Object-Oriented Programming in C++)
► organize data.
► pass arguments to objects of classes.
► add features to existing classes without rewriting them. (Page 27)
► improve data-hiding and encapsulation.
88. We can use "this" pointer in the constructor in the body and even in the initialization list of any class if
we are careful,
► True
► False
90. ------------- members are somewhere between public and private members. They are used in
inheritance
► protected
► public
► private
► global (Page 187)
`
AL-JUNAID INSTITUTE GROUP
91. Which of these are examples of error handling techniques?
► Abnormal Termination
► Graceful Termination
► Return the illegal
► all of the given (Page 329)
93. Graphical representation of the classes and objects is called object model it shows -------
► True
► False(Page 92)
95. Which of the following is the best approach to implement generic algorithms with minimum number of
coding lines?
`
AL-JUNAID INSTITUTE GROUP
96. Each try block can have ______ no. of catch blocks.
►1
►2
►3
► As many as necessary.
`
AL-JUNAID INSTITUTE GROUP
p->Print();
}
98. When you run this program, it will print out a single line to the console output.
► Generic element ►
Heading element
► Paragraph element
► Nothing will be printed.
99. Suppose we have two derived classes from a single class, can we write a method with same name in
both these derived classes? Choose the best option.
► No
► Only if the two classes have the same name (Page 204)
► Only if the main program does not declare both kinds
► Yes
100. 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.
► True
► False
101. 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,
► general template
► partial specialization
► complete specialization
► ordinary function (Page 287)
102. One purpose of an iterator in the STL is to connect algorithms and containers.
►True
► False
`
AL-JUNAID INSTITUTE GROUP
104. one this pointer does not point to current object
of any class,
► True
► False
► ++(Page 162)
►-
►+
► All of the given
`
AL-JUNAID INSTITUTE GROUP
► Polymarphism
► abstraction
► encapsulation
► create an array of type pointer-to-base class that can hold pointers to derived classes.
► create functions that can never be accessed.
► group objects of different classes so they can all be accessed by the same function code.
► use the same function call to execute member functions of objects from different classes
111. If you define a vector v with the default constructor, and define another vector w with a one-
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.
113. Which type of inheritance is being represented by the following statement, class
X : public A, public B { ... ... };
► Single inheritance
► Multiple inheritance (Page 41)
`
AL-JUNAID INSTITUTE GROUP
► Double inheritance
► None of the given options
114. When we write a class template the first line must be:
115. Function templates should be used where code and behavior must be identical.
► True (Page 262)
► False
116. The specialization pattern <T*> after the name says that this specialization is to be used for
every,
► data type
► meta type
► virtual type
► pointer type (Page 286)
► State
► Behavior
► Unique identity
► All of the given (Page 12)
► Composition
► Aggregation
► Inheritance
► None of the given options
`
AL-JUNAID INSTITUTE GROUP
► another word for a class.
► a class with static methods.
► a method that accesses class attributes.
121. ___________, which means if A declares B as its friend it does NOT mean that A can
access private
data of B. It only means that B can access all data of A.
122. The statement objA=objB; will cause a compiler error if the objects are of different classes.
► True
► False
► Rational_number_1
► Rational_number_2
► Both Rational_number_1 & Rational_number_2
► any of the two objects, randomly
124. If a class D has been derived using protected inheritance from class B (If B is a protected
base and D is derived class) then public and protected members of B -------- accessed by
member functions and friends of class D and classes derived from D
► can be
► cannot be
► does restirct to be
► not given
`
AL-JUNAID INSTITUTE GROUP
The type that is used to declare a reference or pointer is called its___________
► abstract type
► reference type
► ► static type
► defaulttype
126. The sub-object’s life is not dependant on the life of master class in __________.
► Separation
► Composition
`
AL-JUNAID INSTITUTE GROUP
131. What is true about function templates?
► The compiler generates only one copy of the function template
► The compiler generates a copy of function respective to each type of data (Page
256)
► The compiler can only generate copy for the int type data
► None of the given.
132. When the base class and the derived class have a member function with the same name,
you must be more specific which function you want to call (using ___________).
► scope resolution operator
► dot operator
► null operator
► Operator overloading
133. A template provides a convenient way to make a family of
► variables and data members
► functions and classes(Object-Oriented Programming in C++)
► classes and exceptions
► programs and algorithms
134. A non-virtual member function is defined in a base class and overridden in a derived
class; if that function is called through a base-class pointer to a derived class object, the
derived-class version is used.
► True
► False
135. 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 nonvirtual member function, ding(), then the
statement p->ding(); will cause the version of ding() in the _____ class to be executed.
`
AL-JUNAID INSTITUTE GROUP
137. Which of the following is incorrect line regarding function template?
► template<class T>
► template <typename U>
► Class<template T> (Page 257)
► template < class T, class U>
138. Consider a class named Vehicle, which of the following can be the instance of class Vehicle?
i. Car
ii. Computer
iii. Desk
iv. Ahmed
v. Bicycle
vi. Truck
1,4,5
2,5,6
1,2,3,6
1, 5, 6 Conceptual
`
AL-JUNAID INSTITUTE GROUP
► Fred a[10]; calls the default constructor 11 times
Fred* p = new Fred[10]; calls the default constructor 11
times
► Fred a[10]; calls the default constructor 10 times
Fred* p = new Fred[10]; calls the default constructor 10 times
140. When a variable is define as static in a class then all object of this class,
142. It is sometimes useful to specify a class from which no objects will ever be created.
► True(Object-Oriented Programming in C++)
► False
143. When a subclass specifies an alternative definition for an attribute or method of its superclass, it
is _______ the definition in the superclass.
► overload
► overriding (Page 34)
► copy riding
► none of given
144. The mechanism of selecting function at run time according to the nature of calling object is
called,
► late binding
► static binding
► virtual binding
► None of the given options (Page 227)
145. Dynamic binding means that target function for a call is selected at run time
Which one of the following functions returns the total number of elements in a vector.
► length();
► size(); (Page 318)
► ele();
► veclen();
`
AL-JUNAID INSTITUTE GROUP
146. The main function of scope resolution operator (::) is,
► To define an object
► To define a data member
► To link the definition of an identifier to its declaration Google
► To make a class private
► True
► False (Page 141)
149. A normal C++ operator that acts in special ways on newly defined data types is said to be
► glorified.
► encapsulated.
► classified.
► overloaded.
151. Suppose obj1 and obj2 are two objects of a user defined class A. An + operator is overloaded to add
obj1 and obj2 using the function call obj1+obj2.
Identify the correct function prototype against the given call?
► A operator + ( A &obj);
► int + operator(); (Page 143)
► int operator (plus) ();
► A operator(A &obj3);
`
AL-JUNAID INSTITUTE GROUP
152. Suppose that the Test class does not have an overloaded assignment operator. What happens
when an assignment a=b; is given for two Test objects a and b?
► The automatic assignment operator is used
► The copy constructor is used
► Compiler error
► Run-time error
153. A static member function can be called, even when a class is not __________.
► Declared
► Define
► Instantiated
► Called
154. Identify which of the following overloaded operator function’s declaration is appropriate for
the given call?
Rational_number_1 + 2.325
Where Rational_number_1 is an object of user defined class Rational_number.
► Rational_number operator+( Rational_number & obj);
► Rational_number operator+(double& obj);
► Rational_number operator+(Rational_number &obj, double& num);
► operator+(double& obj);
155. What problem(s) may occur when we copy objects without using deep copy constructor?
► Dangling pointer
► Memory Leakage
► All of the given
► System crash
156. __________ provide the facility to access the data member.
► accesser function
► private function
► inline function
► None of the given
157. Constant objects cannot change their state,
`
AL-JUNAID INSTITUTE GROUP
► True
► False
158. The ________ relationship indicates that an object contains other objects.
► None of given
► ‘has-a’
► ‘is-a’
► ‘be-
159. Which one of the following features of OOP is used to derive a class from another?
► Encapsulation
► Polymorphism
► Data hiding
► Inheritance
163. In order to free the memory occupied by the object, we use -------------
`
AL-JUNAID INSTITUTE GROUP
► Constructor
► Destructor
► Shallow Copy
► Deep Copy
164. Which of the following is not an example of multiple inheritances?
► Mermaid
► Woman
► None of the given
► Amphibious Vehicle
166. A generic class showing all the common attributes and a behavior of other classes represents a
very important feature in oop called --------
► Inheritance
► Encapsulation
► Polymarphism
► Abstraction
167. The parameters given in temple definition other than those used for
mentioning templates types are called
a. Type Parameters
b. Non Type parameters
c. Default Type Parameters
d. None of the given option
168. Which of the following is the correct way to define a template class X?
e. Class < typename T>class X{}
f. Template class C{}
g. Template < typename T> classX{}
h. Typename<class T > class X{}
169. In resolution order of function template, compiler searches for in the end
a. Complete specialization
b. Partial specialization
c. Ordinary function
`
AL-JUNAID INSTITUTE GROUP
d. Generic template
170. may inherit from a complete specialization
a. Partial specialization
b. Complete specialization
c. Ordinary class
d. All of given options
171. Which of the following may inherit form the ordinary class?
a. Class template
b. Partial specialization
c. Complete specialization
d. All of given option
a. Class T
b. Class U
c. int I
d. All of the given option
185. Which of the following is the correct syntax for passing two type argument to
atemplate?
`
AL-JUNAID INSTITUTE GROUP
a. template < type T, type U>
b. template < typename T, typename U>
c. template <type T,U>
d. template Typename < T,U >
186. Which of the following represents complete
specialization?a. Template < int, char >
b. Template < class T, float>
c. Template<class T, Class U , int>
d. Template< class , class W>
187. Which of the following is/are the key component of standard template library?
a. Containers
b. Iterators
c. Algorithm
d. All of the given option
188. Which of the following statement is true about partial specialization?
a. Function templates cannot have partial specialization
b. Class template cannot have partial specialization
c. Both class templates and function template can have partial specialization.
d. None of the given
189. Which of the following is correct code portion to initialize static data member
“value”of int type for class X?
a. Template <class T> X::value =0;
b. Template<class T>int X::value =0;
c. Template<class T> int X < T >::value = 0;
d. Template<class T> X < T >::value =0;
190. When we want to have exactly identical operations on different data type,
are used
a. Function Template
b. Function Overloading
c. Function Overriding
d. None of the given option
191. In order to define a class template the first line of definition must
be:a. Template <typename T>
b. typename < template T>
c. Template class <ClassName>
d. Class <Template T>
192. In case of template specialization, if compiler cannot find required
completespecialization then it searches for some
a. General template
b. Complete template
c. Partial specialization
`
AL-JUNAID INSTITUTE GROUP
d. None of the given
193. Which of the following is the correct code to instantiate the object of given
templatevector class of int type?
Template <class T>
class vector
{
};
a. Vector obj <int>;
b. Vector obj <> int;
c. Vector <int>obj;
c. Vector int obj;
`
AL-JUNAID INSTITUTE GROUP
`
AL-JUNAID INSTITUTE GROUP
`
CS304- Object Oriented Programming
LATEST SOLVED MCQS JAN 28,2011
FROM FINALTERM PAPERS
FINALTERM EXAMINATION
14 Feb, 2011
CS304- Object Oriented Programming (Session - 3)
1
Question No: 6 ( Marks: 1 ) - Please choose one
A class template may inherit from another class template.
► specialization
► inheritance (Page 216)
► abstraction
► composition
► Greater Memory
► Lesser Memory
► Equal Memory
► None of the given options
► Public
► Private
► Protected
► All of the given Click here for detail
3
Question No: 18 ( Marks: 1 ) - Please choose one
A copy constructor is invoked when
► a function do not returns by value.
► an argument is passed by value. (Page 78) (rep)
► a function returns by reference.
► an argument is passed by reference.
► Reusability
► Writability
► Maintainability
► All of given (Page 256) rep
vector<int> evec;
After adding the statment,
evec.push_back(21);
what will happen?
► The following statement will add an element to the start (the back) of evec and will initialize it with the
value 21.
► The following statement will add an element to the center of evec and will reinitialize it with the value
21.
► The following statement will delete an element to the end (the back) of evec and will reinitialize it with
the value 21.
► The following statement will add an element to the end (the back) of evec and initialize it with the
value 21. Click here for detail
► Parameter, temporary
► Null, Parameter
► Parameter, default (Page 75)
► non of the given
5
Question No: 29 ( Marks: 1 )
In order to define a class template, the first line of definition must be:
► specialization
► inheritance (Page 216) rep
► abstraction
► composition
6
FINALTERM EXAMINATION
Spring 2010
CS304- Object Oriented Programming
► vector
► class (Object-Oriented Programming in C++)
► template
► type*
► Greater Memory
► Lesser Memory
► Equal Memory
► None of the given options
► Reusability
► Writability
► Maintainability
► All of given (Page 256) rep
► variable
► array (Page 306)
► function
► datatype
8
Question No: 12 ( Marks: 1 ) - Please choose one
Suppose you create an uninitialized vector as follows:
vector<int> evec;
After adding the statment,
evec.push_back(21);
what will happen?
► The following statement will add an element to the start (the back) of evec and will initialize it with the
value 21.
► The following statement will add an element to the center of evec and will reinitialize it with the value
21.
► The following statement will delete an element to the end (the back) of evec and will reinitialize it with
the value 21.
► The following statement will add an element to the end (the back) of evec and initialize it with the
value 21. Click here for detail
► True
► False (Object-Oriented Programming in C++)
9
Question No: 16 ( Marks: 1 ) - Please choose one
Inheritance is a way to
► organize data.
► pass arguments to objects of classes.
► add features to existing classes without rewriting them. (Page 27)
► improve data-hiding and encapsulation.
► Parameter, temporary
► Null, Parameter
► Parameter, default (Page 75) rep
► non of the given
► default type
► static type (Page 185)
► abstract type
► reference type
10
Question No: 22 ( Marks: 1 ) - Please choose one
------------- members are somewhere between public and private members. They are used in inheritance
► Abnormal Termination
► Graceful Termination
► Return the illegal
► all of the given (Page 329)
► True
► False (Page 92)
FINALTERM EXAMINATION
Spring 2010
CS304- Object Oriented Programming (Session - 3)
11
Question No: 1 ( Marks: 1 ) - Please choose one
Which one of the following terms must relate to polymorphism?
► Static allocation
► Static typing
► Dynamic binding (Page 239)
► Dynamic allocation
12
Question No: 7 ( Marks: 1 ) - Please choose one
Assume a class Derv that is privately derived from class Base. An object of class Derv located in main() can access
►1
►2
►3
► As many as necessary. Click here for detail
A single try block can have multiple catch blocks but only one finally block.
13
p->Print();
}
When you run this program, it will print out a single line to the console output.
► Generic element
► Heading element
► Paragraph element
► Nothing will be printed.
► True
► False (Object-Oriented Programming in C++)
(the function invocation is resolved at compile time)
► general template
► partial specialization
► complete specialization
► ordinary function (Page 287)
► variable
► array (Page 306) rep
► function
► datatype
14
Question No: 15 ( Marks: 1 ) - Please choose one
By default the vector data items are initialized to ____
► True
► False (Object-Oriented Programming in C++) rep
► ++ (Page 162)
►-
►+
► All of the given
15
Question No: 21 ( Marks: 1 ) - Please choose one
Which of the following operators can not be overloaded?
► default type
► static type (Page 185) rep
► abstract type
► reference type
► create an array of type pointer-to-base class that can hold pointers to derived classes.
► create functions that can never be accessed.
► group objects of different classes so they can all be accessed by the same function code.
► use the same function call to execute member functions of objects from different
classes (Object-Oriented Programming in C++)
►1
►2
►3
► As many as necessary. Click here for detail rep
17
Question No: 6 ( Marks: 1 ) - Please choose one
Non Template Friend functions of a class are friends of ________instance/s of
► Greater Memory
► Lesser Memory
► Equal Memory
► None of the given options
18
Question No: 11 ( Marks: 1 ) - Please choose one
Which is not the Advantage of inheritance?
p->Print();
}
When you run this program, it will print out a single line to the console output.
► Generic element
► Heading element
► Paragraph element
► Nothing will be printed.
19
Question No: 13 ( Marks: 1 ) - Please choose one
Which type of inheritance is being represented by the following statement,
class X : public A, public B { ... ... };
► Single inheritance
► Multiple inheritance (Page 41)
► Double inheritance
► None of the given options
► Reusability
► Writability
► Maintainability
► All of given (Page 256) rep
► State
► Behavior
► Unique identity
► All of the given (Page 12)
► Composition
► Aggregation
► Inheritance
► None of the given options
► True
► False (Object-Oriented Programming in C++)
21
Question No: 24 ( Marks: 1 ) - Please choose one
Consider the call given below of an overloaded operator "+",
Rational_number_1 + Rational_number_2
Where Rational_number_1 and Rational_number_2 are the two objects of Rational_number class (a
user defined class). Identify which of the above two objects will be passed as an argument to the
overloaded operator function?
► Rational_number_1
► Rational_number_2
► Both Rational_number_1 & Rational_number_2
► any of the two objects, randomly
► specialization
► inheritance (Page 216) rep
► abstraction
► composition
22
Question No: 2 ( Marks: 1 ) - Please choose one
Each try block can have ______ no. of catch blocks.
►1
►2
►3
► As many as necessary. Click here detail
► True
► False (Object-Oriented Programming in C++) rep
24
Question No: 15 ( Marks: 1 ) - Please choose one
___________, which means if A declares B as its friend it does NOT mean that A can access private data
of B. It only means that B can access all data of A.
► Friendship is one way only Click here for detail
► Friendship is two way only
► NO Friendship between classes
► Any kind of friendship
25
Question No: 21 ( Marks: 1 ) - Please choose one
When the base class and the derived class have a member function with the same name, you must be
more specific which function you want to call (using ___________).
► scope resolution operator
► dot operator
► null operator
► Operator overloading Click here for detail
FINALTERM EXAMINATION
Fall 2009
CS304- Object Oriented Programming (Session - 4)
► Static allocation
► Static typing
► Dynamic binding (Page 239) rep
► Dynamic allocation
► True
► False
27
Question No: 10 ( Marks: 1 ) - Please choose one
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 nonvirtual member function, ding(), then the statement p->ding(); will
cause the version of ding() in the _____ class to be executed.
► State
► Behavior
► Protected data members (Page 12)
► All of given
void main()
{
DocElement * p = new Paragraph();
p->Print();
}
When you run this program, it will print out a single line to the console output.
29
What will be in that line?
► Generic element
► Heading element
► Paragraph element
► Nothing will be printed.
► True
► False (Object-Oriented Programming in C++)
(the function invocation is resolved at compile time)
Question No: 19 ( Marks: 1 ) - Please choose one
In case of multiple inheritance a derived class inherits,
► template<class T>
► template <typename U>
► Class<template T> (Page 257)
► template < class T, class U>
30
Question No: 22 ( Marks: 1 ) - Please choose one
An STL container can not be used to,
► True
► False (Object-Oriented Programming in C++) rep
► Separation
► Composition (Page 53)
► Aggregation
► None of the given
► specialization
► inheritance (Page 216) rep
► abstraction
► composition
32
FINALTERM EXAMINATION
Fall 2009
CS304- Object Oriented Programming (Session - 1)
►1
►2
►3
► As many as necessary. Click here for detail rep
34
Question No: 13 ( Marks: 1 ) - Please choose one
The mechanism of selecting function at run time according to the nature of calling object is called,
► late binding
► static binding
► virtual binding
► None of the given options (Page 227)
Dynamic binding means that target function for a call is selected at run time
35
Question No: 19 ( Marks: 1 ) - Please choose one
Suppose you create an uninitialized vector as follows:
vector<int> evec;
After adding the statment,
evec.push_back(21);
what will happen?
► The following statement will add an element to the start (the back) of evec and will initialize it with the
value 21.
► The following statement will add an element to the center of evec and will reinitialize it with the value
21.
► The following statement will delete an element to the end (the back) of evec and will reinitialize it with
the value 21.
► The following statement will add an element to the end (the back) of evec and initialize it with the
value 21. Click here for detail
36
Question No: 24 ( Marks: 1 ) - Please choose one
Consider the code below,
class Fred {
public:
Fred();
...
};
int main()
{
Fred a[10];
Fred* p = new Fred[10];
...
}
Select the best option,
► Fred a[10]; calls the default constructor 09 times
Fred* p = new Fred[10];
► Produce an error
► Fred a[10]; calls the default constructor 11 times
Fred* p = new Fred[10]; calls the default constructor 11 times
► Fred a[10]; calls the default constructor 10 times
Fred* p = new Fred[10]; calls the default constructor 10 times Click here for detail
► True
► False (Page 141)
► glorified.
► encapsulated.
► classified.
► overloaded. (Object-Oriented Programming in C++)
37
Question No: 28 ( Marks: 1 ) - Please choose one
Suppose obj1 and obj2 are two objects of a user defined class A. An + operator is overloaded to add obj1 and
obj2 using the function call obj1+obj2.
Identify the correct function prototype against the given call?
► A operator + ( A &obj);
► int + operator(); (Page 143)
► int operator (plus) ();
► A operator(A &obj3);
38
Cs304 Important Mcq’s For Final Term
Solve By Vu_Toper RM
What’s app 03224021365
Paid Tasks = LMS Handling + Online Classes + Project
A template provides a convenient way to make a family of.
variables and data members
functions and classes
classes and exceptions
programs and algorithms
A class template may inherit from another class template.
True
False
Target of a _____ function call is determined at run time.
instance
virtual
operator
none of given
A class hierarchy .
shows the same relationships as an organization chart.
describes “has a” relationships.
describes “is a kind of” relationships.
shows the same relationships as a family tree.
Sender of the message does not need to know the exact class of receiver
in______.
Abstraction
Polymorphism
Inheritance
none of the given
A function call is resolved at run-time in_________ .
non-virtual member function
virtual member function
Both non-virtual member and virtual member function.
None of given
Adding a derived class to a base class requires fundamental changes to the
base class.
True
False
User can make virtual table explicitly.
True
False
Binding means that target function for a call is selected at compile time.
Static
Dynamic
Automatic
None of given
Target of a _____ function call is determined at run time.
instance
virtual
operator
none of given
Which line will produce error. Class phone: private Transmit, private Receiver { }
1. int main() 2. { 3. phone obj; 4. Tranmit* obj1 = &obj; 5. Received obj2 = &obj; 6.
}.
3rd line will produce error
4th line will produce error
3rd and 4th line will produce error.
5th line will produce error
Function overriding is done in context of,
Single class
Single derived class
Single base class
Derived and base classes
Consider the code below, class class1{ public: void func1(); }; class class2 :
protected class1 { }; Function func1 of class1 is ____ in class2,
public
protected
private
none of the given options
The following statements: 1) int iArray[5]; 2) int *pArr = iArray;
These statements will compile successfully
Error in first statement
Error in second statement
None of given options
Methodologies to the development of reusable software relate to________.
Structure programming
procedural programming
generic programming
None of the given
Function template must have a parameter.
True
False
The default inheritance mode is,
Public inheritance
Protected inheritance
Private inheritance
None of these options
Two functions with same names, parameters and return type can exist in,
Function overloading
Function overriding
Operator overloading
None of these options
Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 : public c2
{ }; Then c2 is,
Direct base class of c3
Direct child class of c3
Direct base class of c1
None of these
Virtual functions allow you to
create an array of type pointer-to-base class that can hold pointers to derived classes.
create functions that can never be accessed.
group objects of different classes so they can all be accessed by the same
function code.
use the same function call to execute member functions of objects from different
classes.
User can make virtual table explicitly.
True
False
In order to define a class template the first line of definition must be:
template <typename T>
typename <template T>
Template Class <ClassName>
Class <Template T>
Consider the following statements: 1) int iArray[5]; 2) int *pArr = iArray;
These statements will compile successfully
Error in first statement
Error in second statement
None of given options
In c++ dynamic binding and polymorphism will be achieved when member
function will be __.
private
public
virtual
inline
In type in depended function template should be use where code and behavior
must be identical.
True
False
Consider the code below, class class1{ protected: int i; }; class class2 : private
class1 { }; Then int member i of class1 is ____ in class2,
public
protected
private
none of the given options
In specialization we can,
Replace child class with its base class
Replace base class with its child class (Not Sure)
Replace both child and base classes interchangeably
None of the given options
Consider the code below, class class1{ public: void func1(); }; class class2 :
public class1 { }; Function func1 of class1 is ____ in class2,
public
protected
private
none of the given options
It is illegal to make objects of one class members of another class.
True
False
An abstract class is useful when
no classes should be derived from it.
there are multiple paths from one derived class to another.
no objects should be instantiated from its.
you want to defer the declaration of the class.
In resolution order compiler search firstly _______.
Generic Template
Partial Specialization
Complete Specialization
Ordinary function
template<> class Vector{ void** p; //.... void*& operator[] ((int i); };
This specialization can then be used as the common implementation for all Vectors of
pointers.
This specialization can then be used as the all type implementation for one type
classes.
This specialization can then be used double type pointers.
This specialization should be used for Vectors of all type int types.
In private inheritance derived class pointer can be assigned to base class
pointer in.
Main function
In derived class member and friend functions
In base class member and friend functions
None of the given options
Which statement will be true for concrete class?
it implements an virtual concept.
it can be instantiated
it cannot be instantiated
none of given
Target of a _____ function call is determined at run time.
instance
virtual
operator
none of given
The Specialization pattern after the name says that this specialization is to be
used for every___.
data types
meta types
virtual types
pointers type
c++ dynamic binding and polymorphism will be achieved when member function
will be __.
private
public
virtual
inline
Consider the code below, class class1{ protected: void func1(); }; class class2 :
public class1 { }; Function func1 of class1 is ____ in class2,
public
protected
private
none of the given options
Consider the code below, class class1{ protected: int i; }; class class2 :
protected class1 { }; Then int member i of class1 is ____ in class2,
public
protected
private
none of the given options
Consider the code below, class class1{ private: void func1(); }; class class2 :
private class1 { }; Function func1 of class1 is ____ in class2,
public
protected
private
none of the given options
Target of a _____ function call is determined at run time.
instance
virtual
operator
none of given
Consider the following statements: 1) int iArray[5]; 2) int *pArr = iArray;
These statements will compile successfully
Error in first statement
Error in second statement
None of given options
Consider the code below, class class1{ private: int i; }; class class2 : private
class1 { }; Then int member i of class1 is ____ in class2,
public
protected
private
none of the given options
If there is a pointer, p, to objects of a base class, and it contains the address of
an object of a derived class, and both classes contain a virtual member function,
ding(), then the statement p->ding(); will cause the version of ding() in
the ___ class to be executed.
base
derived
virtual
implemented
A class template may inherit from another class template.
True
False
Derived class can inherit from public base class as well as private and protected
base classes
True
False
Two functions with same names, parameters and return type can exist in,
Function overloading
Function overriding
Operator overloading
None of these options
Consider the code below, class class1{ private: int i; }; class class2 : public
class1 { }; Then int member i of class1 is ____ in class2,
public
protected
private
none of the given options
Target of a _____ function call is determined at run time.
instance
virtual
operator
none of given
A class template may inherit from another class template.
True
False
A function call is resolved at run-time in_________
non-virtual member function
virtual member function
Both non-virtual member and virtual member function.
None of given
A class hierarchy
shows the same relationships as an organization chart.
describes “has a” relationships.
describes “is a kind of” relationships.
shows the same relationships as a family tree.
Consider the code below, class class1{ public: int i; }; class class2 : public
class1 { }; Then int member i of class1 is ____ in class2,
public
protected
private
none of the given options
Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 : public c2
{ }; Then c1 is,
Direct base class of c3
Direct child class of c3
Direct base class of c2
Direct child class of c2
A class can inherit from more then one class is called.
Simple inheritance
Multiple inheritances
Single inheritance
Double inheritance
template<> class Vector{ void** p; //.... void*& operator[] ((int i); };
This specialization can then be used as the common implimentation for all Vectors of
pointers.
This spcialization can then be used as the all type implimentation for one type classes.
This specialization can then be used double type pointers.
This specialization should be used for Vectors of all type int types.
Consider the code below, class class1{ public: int i; }; class class2 : protected
class1 { }; Then int member i of class1 is ____ in class2,
public
protected
private
none of the given options
Consider the code below, class class1{ private: void func1(); }; class class2 :
public class1 { }; Function func1 of class1 is ____ in class2,
public
protected
private
none of the given options
Templates automatically create different versions of a function, depending on
user input.
True
False
________ Binding means that target function for a call is selected at run time
Automatic
Dynamic
Static
Dramatic
When we create objects, then space is allocated to:
Member function
Access specifier
Data member
None of given
There is only one form of copy constructor.
True
False
Which of the following features of OOP is used to deal with only relevant
details?
Abstraction
Information hiding
Object
___________ Binding means that targets function for a call is selected at compile
time.
Static
Dynamic
Automatic
None of given
A Class hierarchy
Shows the same relationships as an organization chart
Describes “has a” relationships.
Describes “is a kind of” relationships.
Shows the same relationships as a family tree
In C++, we declare a function virtual by preceding the function header with
keyword “Inline”.
True
False
It is illegal to make objects of one class members of another class.
True
False
In Resolution order compiler search firstly____________.
Generic Template
Partial Specification
Complete Specification
Ordinary function
Derived class can inherit from public base class as well as private and protected
base classes
True
False
Which line will produce error. Class phone: Private Transmit, private Receiver { }
1.int main () 2. { 3.phone obj; 4.Tranmit*obj1 = &obj; 5.Received obj2 = &obj; 6.}
3rd line will produce error
4th line will produce error
3rd and 4th line will produce error.
5th line will produce error.
Methodologies to the development of reusable software relate to ____________.
Structure programming
Procedural programming
Generic programming
None of the given
A template argument is preceded by the keyword__________.
Vector
Class
Template
Type*
Friends are used exactly the same for template and non-template classes.
True
False
A function template must have a parameter
True
False
A class D can be derived from a class C, which is derived froma class B, which
is derived from a class A
True
False
Adding a derived class to a base class requires fundamental changes to the
base class.
True
False
A Class or class template can have member ___________ that are themselves
templates.
Variable
Function
Objects
None of given
Sender of the message does not need to know the exact class of receiver
in________.
Abstraction
Polymorphism
Inheritance
none of the given
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
A Class or class template can have member ___________ that are themselves templates.
Variable
Function
Objects
None of 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
Sender of the message does not need to know the exact class of receiver in________.
Abstraction
Polymorphism
Inheritance
none of the given
Question # 1 of 20 ( Start time: 08:20:11 PM ) Total Marks: 1
A Child class can call constructor of its parent class through,
Select correct option:
Its constructor initialization list (Correct)
Its constructor body
Both from its constructor initialization list or body
Can not call the constructor of its parent classQuestion # 2 of 20 ( Start time: 08:21:46 PM
) Total Marks: 1
A class template may inherit from another class template.
Select correct option:True
False (False)
Question # 3 of 20 ( Start time: 08:22:17 PM ) Total Marks: 1
Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 : public c2 { }; Then
c2 is,
Select correct option:
public
protected
private (Correct)
none of the given options
True (Correct)
False
public
protected (Correct)
private
none of the given options
create an array of type pointer-to-base class that can hold pointers to derived classes.
create functions that can never be accessed.
group objects of different classes so they can all be accessed by the same function
code. (Correct)
use the same function call to execute member functions of objects from different classes.
Question # 13 of 20 ( Start time: 08:30:05 PM ) Total Marks: 1
A class or class template can have member _________ that are themselves templates.
Select correct option:
Variable
Function
Objects
None of given (Correct)
instance
virtual (Correct)
operator
none of given
True (Correct)
False
public
protected
private (Correct)
none of the given options
Quiz No. 02 of the subject Object Oriented Programming (CS304) is going to upload in a
couple of days, before submitting the Quiz, please read all instructions thoroughly.
Quiz No. 02 of the subject Object Oriented Programming (CS304) is going to upload in a
couple of days, before submitting the Quiz, please read all instructions thoroughly.
Solved Today Quiz
Defualt Constructor
Overloaded Constructor
Default Object
None of the above
Let Suppose a class Student with objects std1, std2, and std3. For the statement std3 = std1 –
std2 to work correctly, if the overloaded – operator must
Select correct option:
/
–
+
None of the given choices
True
False
Always make pointer to null, whenever dynamic memory is deleted.
Select correct option:
True
False
__________ provide the facility to access the data member.
Select correct option:
accesser function
private function
inline function
None of the given
Question # 1 of 10 ( Start time: 02:16:16 PM ) Total Marks: 1
Friend Functions of a class are _________ members of that class.
Select correct option:
Public
Private
Protected
None of the given options.
Question # 2 of 10 ( Start time: 02:17:30 PM ) Total Marks: 1
Consider the code below, class class1{ protected: int i; }; class class2 : protected class1 { };
Then int member i of class1 is ______ in class2,
Select correct option:
public
protected
private
none of the given options
Question # 3 of 10 ( Start time: 02:17:56 PM ) Total Marks: 1
A Child class can call constructor of its parent class through,
Select correct option:
public
protected
private
none of the given options
Question # 9 of 10 ( Start time: 02:22:00 PM ) Total Marks: 1
Static casting is,
Select correct option:
None of these
Both of these
Question # 10 of 10 ( Start time: 02:23:15 PM ) Total Marks: 1
Consider the code below, class class1{ protected: void func1(); }; class class2 : public class1 { };
Function func1 of class1 is ______ in class2,
Select correct option:
public
protected
private
New
int
object
True
False
True
False
True
False
Defualt Constructor
Overloaded Constructor
Default Object
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
accesser function
private function
inline function
False
Association
Composition
Aggregation
Inheritance
++
A class hierarchy
Select correct option:
shows the same relationships as an organization chart.
describes “has a” relationships.
describes “is a kind of” relationships.
shows the same relationships as a family tree.
Sender of the message does not need to know the exact class of receiver in______.
Select correct option:
Abstraction
Polymorphism
Inheritance
none of the given
Adding a derived class to a base class requires fundamental changes to the base class.
Select correct option:
True
False
Binding means that target function for a call is selected at compile time.
Select correct option:
Static
Dynamic
Automatic
None of given
Which line will produce error. Class phone: private Transmit, private Receiver { } 1. int
main() 2. { 3. phone obj; 4. Tranmit* obj1 = &obj; 5. Received obj2 = &obj; 6. }
Select correct option:
3rd line will produce error
4th line will produce error
3rd and 4th line will produce error.
5th line will produce error
Consider the code below, class class1{ public: void func1(); }; class class2 : protected
class1 { }; Function func1 of class1 is ____ in class2,
www.vuplanet.com
Two functions with same names, parameters and return type can exist in,
Select correct option:
Function overloading
Function overriding
Operator overloading
None of these options
Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 : public c2 { }; Then
c2 is,
Select correct option:
In order to define a class template the first line of definition must be:
Select correct option:
template <typename T>
typename <template T>
Template Class <ClassName>
Class <Template T>
In c++ dynamic binding and polymorphism will be achieved when member function will
be __.
Select correct option:
private
public
virtual
inline
In type in depended function template should be use where code and behavior must be
identical.
Select correct option:
www.vuplanet.com
True
False
Consider the code below, class class1{ protected: int i; }; class class2 : private class1 { };
Then int member i of class1 is ____ in class2,
Select correct option:
public
protected
private
none of the given options
In specialization we can,
Select correct option:
Replace child class with its base class
Replace base class with its child class (Not Sure)
Replace both child and base classes interchangeably
None of the given options
Consider the code below, class class1{ public: void func1(); }; class class2 : public class1 {
}; Function func1 of class1 is ____ in class2,
Select correct option:
public
protected
private
none of the given options
Complete Specialization
Ordinary function
In private inheritance derived class pointer can be assigned to base class pointer in,
Select correct option:
Main function
In derived class member and friend functions
In base class member and friend functions
None of the given options
The Specialization pattern after the name says that this specialization is to be used for
every___.
Select correct option:
data types
meta types
virtual types
pointers type
c++ dynamic binding and polymorphism will be achieved when member function will be
__.
Select correct option:
www.vuplanet.com
private
public
virtual
inline
Consider the code below, class class1{ protected: void func1(); }; class class2 : public
class1 { }; Function func1 of class1 is ____ in class2,
Select correct option:
public
protected
private
none of the given options
Consider the code below, class class1{ protected: int i; }; class class2 : protected class1 {
}; Then int member i of class1 is ____ in class2,
Select correct option:
public
protected
private
none of the given options
Consider the code below, class class1{ private: void func1(); }; class class2 : private class1
{ }; Function func1 of class1 is ____ in class2,
Select correct option:
public
protected
private
none of the given options
Consider the code below, class class1{ private: int i; }; class class2 : private class1 { };
Then int member i of class1 is ____ in class2,
Select correct option:
public
protected
private
none of the given options
If there is a pointer, p, to objects of a base class, and it contains the address of an object
of a derived class, and both classes contain a virtual member function, ding(), then the
statement p->ding(); will cause the version of ding() in the ___ class to be executed.
Select correct option:
base
derived
virtual
implemented
Derived class can inherit from public base class as well as private and protected base
classes
Select correct option:
True
False
Two functions with same names, parameters and return type can exist in,
Select correct option:
Function overloading
Function overriding
Operator overloading
None of these options
Consider the code below, class class1{ private: int i; }; class class2 : public class1 { }; Then
int member i of class1 is ______ in class2,
A class hierarchy
Select correct option:
shows the same relationships as an organization chart.
describes “has a” relationships.
describes “is a kind of” relationships.
shows the same relationships as a family tree.
Consider the code below, class class1{ public: int i; }; class class2 : public class1 { }; Then
int member i of class1 is ____ in class2,
Select correct option:
public
protected
private
none of the given options
Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 : public c2 { }; Then
c1 is,
Select correct option:
Direct base class of c3
Direct child class of c3
Direct base class of c2
Direct child class of c2
www.vuplanet.com
This specialization can then be used as the common implimentation for all Vectors of
pointers.
This spcialization can then be used as the all type implimentation for one type classes.
This specialization can then be used double type pointers.
This specialization should be used for Vectors of all type int types.
Consider the code below, class class1{ public: int i; }; class class2 : protected class1 { };
Then int member i of class1 is ____ in class2,
Select correct option:
public
protected
private
none of the given options
Consider the code below, class class1{ private: void func1(); }; class class2 : public class1
{ }; Function func1 of class1 is ____ in class2,
Select correct option:
public
protected
private
none of the given options
_________ Binding means that target function for a call is selected at run time
Select correct option:
Automatic
Dynamic
Static
Dramatic
www.vuplanet.com
Which of the following features of OOP is used to deal with only relevant details?
Abstraction
Information hiding
Object
____________ Binding means that targets function for a call is selected at compile time.
Static
Dynamic
Automatic
None of given
A Class hierarchy
Shows the same relationships as an organization chart
Describes “has a” relationships.
Describes “is a kind of” relationships.
Shows the same relationships as a family tree
In C++, we declare a function virtual by preceding the function header with keyword
“Inline”
True
False
Derived class can inherit from public base class as well as private and protected base
classes
True
False
Which line will produce error. Class phone: Private Transmit, private Receiver { } 1.int
main () 2. { 3.phone obj; 4.Tranmit*obj1 = &obj; 5.Received obj2 = &obj; 6.}
Friends are used exactly the same for template and non-template classes.
True
False
It can be instantiated
It cannot be instantiated
None of given
A class D can be derived from a class C, which is derived froma class B, which is derived
from a class A
True
False
Adding a derived class to a base class requires fundamental changes to the base class.
True
False
A Class or class template can have member ___________ that are themselves
templates.
Variable
Function
Objects
None of given
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
Sender of the message does not need to know the exact class of receiver in________.
Abstraction
Polymorphism
Inheritance
none of the given
Consider the code below, class class1{ protected: int i; }; class class2 : protected class1 {
}; Then int member i of class1 is ______ in class2,
Select correct option:
public
protected
private
none of the given options
We can access private members of the class from outside the class using ______
operator with its object pointer.
Select correct option:
->
.
&
None of the given options
It is sometimes useful to specify a class from which no objects will ever be created.
Select correct option:
True
False
Consider the code below, class class1{ public: void func1(); }; class class2 : private class1
{ }; Function func1 of class1 is ______ in class2,
Select correct option:
public
protected
private
none of the given options
Consider the code below, class class1{ public: int i; }; class class2 : protected class1 { };
Then int member i of class1 is ______ in class2,
Select correct option:
public
protected
private
none of the given options
Consider the code below, class class1{ protected: void func1(); }; class class2 : public
class1 { }; Function func1 of class1 is ______ in class2,
Select correct option:
public
protected
private
none of the given options
Consider the code below, class class1{ public: void func1(); }; class class2 : public class1 {
}; Function func1 of class1 is ______ in class2
Public
www.vuplanet.com
Protected
Private
none of the given options
Consider the code below, class class1{ protected: int i; }; class class2 : public class1 { };
Then int member i of class1 is ______ in class2,
public
protected
private
none of the given options
In Private Inheritance the public members of base class become __________ in derived
class.
Public
Private
Protected
None of the given options.
Consider the following two lines of code written for a class Student, 1. Student sobj1; 2.
Student sobj2(sobj1); In line No.2 what constructor of Student class will be called,
Default constructor of Student class
Copy constructor of student class
Both default and copy constructer of Student class
No constructor will be called
Cs-304 Important Macq’s For Final Term:
Solve By Vu_Toper-RM
protected
Deep copy
copy constructor
class
Explicit way of calling base class functions from derived
class
6: In case of dynamic memory allocation in a class we should
use,
User defined default constructor
user defined copy constructor (true)
7: Which of the following types of Inheritance is used to model
“Implemented in terms of” relationship?
Public
private (true)
F
class
None of these
both 1 and 2
2.In order to define a class template the first line of definition must be:
a. template <typename T>
b. typename <template T>
c Template Class <Class Name>
d Class <Template T>