C++ Test Questions Set 6

1)   We can prevent a function from throwing any exceptions.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


2)   Functions called from within a try block may also throw exception.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


3)   The explicit keyword is an optional decoration for the constructors that takes exactly_____argument.

a. No argument
b. Two
c. Three
d. One
Answer  Explanation 

ANSWER: One

Explanation:
No explanation is available for this question!


4)   A class can contain objects of other classes and this phenomenon is called_________ .

a. Relationship
b. Object Association
c. Containership
d. None of these
Answer  Explanation 

ANSWER: Containership

Explanation:
No explanation is available for this question!


5)   Can we alter/modify the values of data members of a class inside const member function?

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
No explanation is available for this question!


6)    If a class contains pure virtual function, then it is termed as____________________ .

a. Virtual class
b. Sealed class
c. Pure Local class
d. Abstract Class
Answer  Explanation 

ANSWER: Abstract Class

Explanation:
No explanation is available for this question!


7)   If inner catch handler is not able to handle the exception then__________ .

a. Compiler will look for outer try handler
b. Program terminates abnormally
c. Compiler will check for appropriate catch handler of outer try block
d. None of these
Answer  Explanation 

ANSWER: Compiler will check for appropriate catch handler of outer try block

Explanation:
No explanation is available for this question!


8)   Generic catch handler is represented by ______________ .

a. catch(..,)
b. catch(---)
c. catch(…)
d. catch( void x)
Answer  Explanation 

ANSWER: catch(…)

Explanation:
No explanation is available for this question!


9)   Which one is suitable syntax for function template?

a. template< class T> return_type Function_Name(parameters)
b. template< typename T> return_type Function_Name(parameters)
c. both a and b
d. None of these
Answer  Explanation 

ANSWER: both a and b

Explanation:
No explanation is available for this question!


10)   It is not possible to combine two or more file opening mode in open () method.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


11)   Private members of the class are not inheritable.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


12)   While overloading binary operators using member function, it requires ___ argument/s.

a. Zero
b. One
c. Two
d. Three
Answer  Explanation 

ANSWER: One

Explanation:
No explanation is available for this question!


13)   If abstract class is inherited by derived class, then_______________ .

a. Derived class should provide definition for all the pure virtual functions
b. Derived class also become abstract if fails to implement pure virtual functions
c. Objects of derived class can’t be created if it fails to implement pure virtual functions
d. All of these
Answer  Explanation 

ANSWER: All of these

Explanation:
No explanation is available for this question!


14)    By default, all the files are opened in ___________mode .

a. Binary
b. Text
c. Can’t say

Answer  Explanation 

ANSWER: Text

Explanation:
No explanation is available for this question!


15)   Generic catch handler must be placed at the end of all the catch handlers.

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


16)   An exception can be of only built-In type.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


17)   The CPP compiler supports automatic type conversions for the user defined datatypes.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


18)   Can a class be declared/defined inside another class ?

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
No explanation is available for this question!


19)   Can we pass parameters to base class constructor though derived class or derived class constructor?

a. Yes
b. No


Answer  Explanation 

ANSWER: Yes

Explanation:
No explanation is available for this question!


20)   _________________are used for generic programming.

a. Inheritance
b. Virtual Functions
c. Templates
d. None of these
Answer  Explanation 

ANSWER: Templates

Explanation:
No explanation is available for this question!


21)   Irrespective of exception occurrence, catch handler will always get executed.

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


22)   In CPP, cin and cout are the predefined stream __________ .

a. Operator
b. Functions
c. Objects
d. Data types
Answer  Explanation 

ANSWER: Objects

Explanation:
No explanation is available for this question!


23)   Object oriented programming employs_________ programming approach.

a. top-down
b. procedural
c. bottom-up
d. all of these.
Answer  Explanation 

ANSWER: bottom-up

Explanation:
No explanation is available for this question!


24)   Constant variables can be created in CPP by using ________ .

a. enum
b. const
c. #define
d. All of these
e. None of these
Answer  Explanation 

ANSWER: All of these

Explanation:
No explanation is available for this question!


25)   A virtual function that has no definition within the base class is called____________.

a. Pure virtual function
b. Pure static function
c. Pure Const function
d. Friend function
Answer  Explanation 

ANSWER: Pure virtual function

Explanation:
No explanation is available for this question!