1) When a virtual function is redefined by the derived class, it is called___________. a. Overloading b. Overriding c. Rewriting d. All of these
|
||||
2) In any ways, Non-member function cannot have access to the private data of the class. a. True b. False
|
||||
3) In CPP, dynamic memory allocation is done using ______________ operator. a. calloc() b. malloc() c. allocate d. New
|
||||
4) Can we allocate memory for the objects dynamically in CPP? a. Yes b. No
|
||||
5) If the derived class is struct, then default visibility mode is _______ . a. public b. protected c. private d. struct can’t inherit class
|
||||
6) Which of the following manipulator is used for the representing octal equivalent of a given decimal number? a. oct b. setbase(8) c. tobase(8) d. both a and b e. all a, b, c
|
||||
7) Which of the following is not a casting operator in CPP? a. explicit_cast b. static_cast c. dynamic_cast d. reinterpret_cast
|
||||
8) ___________ header file is used for manipulators. a. < iomanipulator.h> b. < stdiomanip.h> c. < stdmanip.h> d. < iomanip.h>
|
||||
9) While redefining a virtual function in the derived class, if its prototype is changed then ___________________ . a. It will be overloaded by the compiler b. Its virtual nature will be lost c. both a and b d. Compiler will generate “Prototype mismatch error”
|
||||
10) const member function does not allow to modify/alter value of any data member of the class. a. True b. False
|
||||
11) In a program, If there exists a function template with two parameters and normal function say void add(int , int), so add(3,4) will _____________________ . a. Invoke function template body as it is generic one b. Invokes normal function as it exactly matches with its prototype c. Not be called and Compiler issues warning d. Not be called and Compiler issues ambiguity in calling add()
|
||||
12) Can struct be used as Base class for inheritance ? a. Yes b. No
|
||||
13) In case of inheritance where both base and derived class are having constructors, when an object of derived class is created then___________ . a. constructor of derived class will be invoked first b. constructor of base class will be invoked first c. constructor of derived class will be executed first followed by base class d. constructor of base class will be executed first followed by derived class
|
||||
14) Which of the following is not a file opening mode ____ . a. ios::ate b. ios::nocreate c. ios::noreplace d. ios::truncate
|
||||
15) Attempting to throw an exception that is not supported by a function call results in calling _____________ library function. a. indeterminate() b. unutilized() c. unexpected() d. unpredicted()
|
||||
16) How can we restrict a function to throw certain exceptions? a. Defining multiple try and catch block inside a function b. Defining generic function within try block c. Defining function with throw clause d. It is not possible in CPP to restrict a function
|
||||
17) Is it possible to define a constructor with default arguments? a. Yes b. No
|
||||
18) The purpose of explicit keyword is to tell the compiler that a certain constructor may not be used to implicitly cast an expression to its class type. a. True b. False
|
||||
19) Scope resolution operator is used______ . a. to resolve the scope of global variables only b. to resolve the scope of functions of the classes only c. to resolve scope of global variables as well as functions of the classes d. None of these
|
||||
20) In case of operator overloading, operator function must be ______ . 1. Static member functions 2. Non- static member functions 3. Friend Functions a. Only 2 b. Only 1, 3 c. Only 2 , 3 d. All 1 , 2, 3
|