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
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 # 2
C++ compiler does not allow to dynamically allocate memory for object
Choose an answer
False
True
Not sure
Previous
Skip
Next
Question # 3
Which of the following are an advantage of OOP?
Choose an answer
OOP makes it easy to re-use the code
It provides an ability to create one user defined data type by extending the other
It provides the facility of defining Abstract data types through which real world entities can be defined better
All of the given options
Previous
Skip
Next
Question # 4
Which part of an object exhibits its state?
Choose an answer
Data
Operations
Any public part
Any private part
Previous
Skip
Next
Question # 5
Encapsulation means
Choose an answer
Extending the behaviour of class in another class
Data and behaviour are tightly coupled within an entity
One entity takes all the attributes and operations of the other
Taking out the common features and put those in a separate class
Previous
Skip
Next
Question # 6
Which of the following operators can not be overloaded?
Choose an answer
Scope resolution operator ( :: )
Insertion operator ( << )
Extraction operator ( >> )
The relation operator ( > )
Previous
Skip
Next
Question # 7
Which sentence clearly defines an object?
Choose an answer
one instance of a class
another word for a class.
a class with static methods.
a method that accesses class attributes.
Previous
Skip
Next
Question # 8
To convert from a user-defined class to a basic type, you would most likely use
Choose an answer
a built-in conversion operator
a one-argument constructor.
an overloaded = operator.
a conversion operator that’s a member of the class.
Previous
Skip
Next
Question # 9
Vectors contain contiguous elements stored as a[an] ___.
Choose an answer
variable
array
function
datatype
Previous
Skip
Next
Question # 10
Which of the following is/are advantage[s] of generic programming?
Choose an answer
Reusability
Writability
Maintainability
All of given
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