More Classes
5th Class
6th Class
7th Class
8th Class
9th Class
10th Class
11th Class
12th Class
NAT I
NAT II
CSS
IQ
General Knowledge
MDCAT
ECAT
GAT General
GAT Subject
Other Links
Go to Home
Online Tests
CS-304 Final Term Exams Preparation Virtual University MCQs With Answers
Question # 1
Non Template Friend functions of a class are friends of ________instance/s of that class.
Choose an answer
All
One specific
All instances of one date type
None of the given options
Previous
Skip
Next
Question # 2
The >= operator can be overloaded.
Choose an answer
True
False
Not Sure
Previous
Skip
Next
Question # 3
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?
Choose an answer
A operator + ( A &obj);
int + operator();
int operator (plus) ();
A operator(A &obj3);
Previous
Skip
Next
Question # 4
Given the following class class Base{ int Age=33; } How you can improve above class with respect to accessing the field Age?
Choose an answer
Define the variable Age as private
Define the variable Age as protected
Define the variable Age as private and create a get method that returns it and a set method that updates it
Define the variable Age as protected and create a set method that returns it and a get method that updates it
Previous
Skip
Next
Question # 5
When we write a class template the first line must be:
Choose an answer
template < class class_name>
template < class data_type>
templete< class T >
Here T can be replaced with any name but it is preferable
class class-name() class template
Previous
Skip
Next
Question # 6
Suppose you create an uninitialized vector as follows:
vector
evec; After adding the statment, evec.push_back(21); what will happen?
Choose an answer
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
Previous
Skip
Next
Question # 7
dentify the correct way of declaring an object of user defined template class A for char type members?
Choose an answer
A< char > obj;
< char > A obj
;
Obj < char >
A;
Previous
Skip
Next
Question # 8
Which one of the following terms must relate to polymorphism?
Choose an answer
Static allocation
Static typing
Dynamic binding
Dynamic allocation
Previous
Skip
Next
Question # 9
Algorithms can only be implemented using STL containers.
Choose an answer
True
False
Not Sure
Previous
Skip
Next
Question # 10
A C++ class is similar to --------------------
Choose an answer
Structure
Header File
Library File
None of the given
Previous
Skip
Next
Question # 11
An abstract class is useful when,
Choose an answer
We do not derive any class from it.
There are multiple paths from one derived class to another
We do not want to instantiate its object.
You want to defer the declaration of the class
Previous
Skip
Next
Back