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
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
Question # 2
In case of multiple inheritance a derived class inherits,
Choose an answer
Only the public member functions of its base classes
Only the public data members of its base classes
Both public data members and member functions of all its base classes
Data members and member functions of any two base classes
Previous
Skip
Next
Question # 3
Two important STL associative containers are _______ and _______.
Choose an answer
set,map
sequence,mapping
setmet,multipule
sit,mat
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
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 # 6
A template provides a convenient way to make a family of
Choose an answer
variables and data members
functions and classes
classes and exceptions
programs and algorithms
Previous
Skip
Next
Question # 7
What is true about function templates?
Choose an answer
The compiler generates only one copy of the function template
The compiler generates a copy of function respective to each type of data
The compiler can only generate copy for the int type data
non of the given
Previous
Skip
Next
Question # 8
Assume a class Derv that is privately derived from class Base. An object of class Derv located in main() can access
Choose an answer
public members of Derv.
protected members of Derv
private members of Derv.
protected members of Base.
Previous
Skip
Next
Question # 9
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,
Choose an answer
general template
partial specialization
complete specialization
ordinary function
Previous
Skip
Next
Question # 10
Suppose there is an object of type Person, which of the following can be considered as one of its attributes
Choose an answer
Name
Age
Work()
Both Name and Age
Previous
Skip
Next
Question # 11
What is true about function templates?
Choose an answer
The compiler generates only one copy of the function template
The compiler generates a copy of function respective to each type of data
The compiler can only generate copy for the int type data
None of the given.
Previous
Skip
Next
Back