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
A member function having the same name as that of a class and a ~ sign with it is called,
Choose an answer
Constructor
Getter
Setter
Destructor
Previous
Skip
Next
Question # 2
Vectors contain contiguous elements stored as a[an] ___.
Choose an answer
variable
array
function
datatype
Previous
Skip
Next
Question # 3
Default constructor is such constructor which either has no ---------or if it has some parameters these have -------- values
Choose an answer
Parameter, temporary
Null, Parameter
Parameter, default
non of the given
Previous
Skip
Next
Question # 4
Algorithms can only be implemented using STL containers.
Choose an answer
True
False
Not Sure
Previous
Skip
Next
Question # 5
Which of the following is the best approach to implement generic algorithms with minimum number of coding lines?
Choose an answer
Templates
Overloading
Overriding
Friend function/class
Previous
Skip
Next
Question # 6
Consider the code below, class Fred { public: Fred(); ... }; int main() { Fred a[10]; Fred* p = new Fred[10]; ... } Select the best option
Choose an answer
Fred a[10]; calls the default constructor 09 times Fred* p = new Fred[10]; calls the default constructor 10 times
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
Previous
Skip
Next
Question # 7
The statement objA=objB; will cause a compiler error if the objects are of different classes.
Choose an answer
True
False
Not Sure
Previous
Skip
Next
Question # 8
For classes with common behavior, you can save effort by placing the common behavior in a __________.
Choose an answer
Derived Class
Base class
Deprived Class
Named class
Previous
Skip
Next
Question # 9
We can use "this" pointer in the constructor in the body and even in the initialization list of any class if we are careful
Choose an answer
True
False
Not Sure
Previous
Skip
Next
Question # 10
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?
Choose an answer
The automatic assignment operator is used
The copy constructor is used
Compiler error
Run-time error
Previous
Skip
Next
Question # 11
The user must define the operation of the copy constructor.
Choose an answer
True
False
Not Sure
Previous
Skip
Next
Back