CS-304 Final Term Exams Preparation Virtual University With Answers

image
image
image

CS-304 Final Term Exams Preparation Virtual University

Sr. # Questions Answers Choice
1 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? A operator + ( A &obj); int + operator(); int operator (plus) (); A operator(A &obj3);
2 Which operator can not be overloaded? The relation operator ( >= ) Assignment operator ( = ) Script operator ( [] ) Conditional operator (? : )
3 A normal C++ operator that acts in special ways on newly defined data types is said to be glorified encapsulated classified overloaded
4 Associativity can be changed in operator overloading. True False Not Sure
5 When is a constructor called? Each time the constructor identifier is used in a program statement During the instantiation of a new object During the construction of a new class At the beginning of any program execution
6 The main function of scope resolution operator (::) is, To define an object To define a data member To link the definition of an identifier to its declaration To make a class private
7 Algorithms can only be implemented using STL containers. True False Not Sure
8 An STL container can not be used to hold objects of class employee. store elements in a way that makes them quickly accessible compile c++ programs. organize the way objects are stored in memory
9 Suppose you create an uninitialized vector as follows: vector evec; After adding the statment, evec.push_back(21); what will happen? 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.
10 Which one of the following functions returns the total number of elements in a vector. length(); size(); ele(); veclen();
Download This Set