1) Can we define our exceptions in CPP?
a. Yes
b. No
Answer
Explanation
|
ANSWER: Yes
Explanation: No explanation is available for this question!
|
|
2) The code of statements which may cause abnormal termination of the program should be written under_________ block.
a. Try
b. catch
c. Finally
d. None of these
Answer
Explanation
|
ANSWER: Try
Explanation: No explanation is available for this question!
|
|
3) Object based language differs from object oriented language as it does not support features _____ .
1. Encapsulation 2. Inheritance 3. Dynamic Binding 4. Abstraction 5. Polymorphism
a. only 3 ,4
b. only 1,3,5
c. 2,4,5
d. Only 2,3
Answer
Explanation
|
ANSWER: Only 2,3
Explanation: No explanation is available for this question!
|
|
4) When a virtual function is redefined by the derived class, it is called___________.
a. Overloading
b. Overriding
c. Rewriting
d. All of these
Answer
Explanation
|
ANSWER: Overriding
Explanation: No explanation is available for this question!
|
|
5) In any ways, Non-member function cannot have access to the private data of the class.
a. True
b. False
Answer
Explanation
|
ANSWER: False
Explanation: No explanation is available for this question!
|
|
6) In CPP, dynamic memory allocation is done using ______________ operator.
a. calloc()
b. malloc()
c. allocate
d. New
Answer
Explanation
|
ANSWER: New
Explanation: No explanation is available for this question!
|
|
7) Can we allocate memory for the objects dynamically in CPP?
a. Yes
b. No
Answer
Explanation
|
ANSWER: Yes
Explanation: No explanation is available for this question!
|
|
8) If the derived class is struct, then default visibility mode is _______ .
a. public
b. protected
c. private
d. struct can’t inherit class
Answer
Explanation
|
ANSWER: public
Explanation: No explanation is available for this question!
|
|
9) 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
Answer
Explanation
|
ANSWER: both a and b
Explanation: No explanation is available for this question!
|
|
10) Which of the following is not a casting operator in CPP?
a. explicit_cast
b. static_cast
c. dynamic_cast
d. reinterpret_cast
Answer
Explanation
|
ANSWER: explicit_cast
Explanation: No explanation is available for this question!
|
|
11) ___________ header file is used for manipulators.
a. < iomanipulator.h>
b. < stdiomanip.h>
c. < stdmanip.h>
d. < iomanip.h>
Answer
Explanation
|
ANSWER: < iomanip.h>
Explanation: No explanation is available for this question!
|
|
12) 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”
Answer
Explanation
|
ANSWER: both a and b
Explanation: No explanation is available for this question!
|
|
13) const member function does not allow to modify/alter value of any data member of the class.
a. True
b. False
Answer
Explanation
|
ANSWER: True
Explanation: No explanation is available for this question!
|
|
14) 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()
Answer
Explanation
|
ANSWER: Invokes normal function as it exactly matches with its prototype
Explanation: No explanation is available for this question!
|
|
15) Can struct be used as Base class for inheritance ?
a. Yes
b. No
Answer
Explanation
|
ANSWER: Yes
Explanation: No explanation is available for this question!
|
|
16) 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
Answer
Explanation
|
ANSWER: constructor of base class will be executed first followed by derived class
Explanation: No explanation is available for this question!
|
|
17) Which of the following is not a file opening mode ____ .
a. ios::ate
b. ios::nocreate
c. ios::noreplace
d. ios::truncate
Answer
Explanation
|
ANSWER: ios::truncate
Explanation: No explanation is available for this question!
|
|
18) 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()
Answer
Explanation
|
ANSWER: unexpected()
Explanation: No explanation is available for this question!
|
|
19) 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
Answer
Explanation
|
ANSWER: Defining function with throw clause
Explanation: No explanation is available for this question!
|
|
20) Is it possible to define a constructor with default arguments?
a. Yes
b. No
Answer
Explanation
|
ANSWER: Yes
Explanation: No explanation is available for this question!
|
|
21) 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
Answer
Explanation
|
ANSWER: True
Explanation: No explanation is available for this question!
|
|
22) 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
Answer
Explanation
|
ANSWER: to resolve scope of global variables as well as functions of the classes
Explanation: No explanation is available for this question!
|
|
23) 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
Answer
Explanation
|
ANSWER: Only 2 , 3
Explanation: No explanation is available for this question!
|
|
24) A try block can be nested under another try block.
a. True
b. False
Answer
Explanation
|
ANSWER: True
Explanation: No explanation is available for this question!
|
|
25) In nested try blocks, there is no need to specify catch handler for inner try block. Outer catch handler is sufficient for the program.
a. True
b. False
Answer
Explanation
|
ANSWER: False
Explanation: No explanation is available for this question!
|
|