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
his pointers are not accessible for static member functions.
Choose an answer
True
False
Not Sure
Previous
Skip
Next
Question # 2
One purpose of an iterator in the STL is to connect algorithms and containers.
Choose an answer
True
False
Not Sure
Previous
Skip
Next
Question # 3
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 # 4
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 # 5
Which construct is the source for the creation of an object?
Choose an answer
Destructor of the class
New operator
Delete operator
Constructor of the class
Previous
Skip
Next
Question # 6
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 # 7
_______ “is a” relationship
Choose an answer
Inheritance
Polymarphism
abstraction
encapsulation
Previous
Skip
Next
Question # 8
__________, 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.
Choose an answer
Friendship is one way only
Friendship is two way only
NO Friendship between classes
Any kind of friendship
Previous
Skip
Next
Question # 9
A function call is resolved at run-time in___________
Choose an answer
non-virtual member function.
virtual member function.
Both non-virtual member and virtual member function.
None of given
Previous
Skip
Next
Question # 10
Algorithms can only be implemented using STL containers.
Choose an answer
True
False
Not Sure
Previous
Skip
Next
Question # 11
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
Back