Monday, June 24, 2013

C++ MCQ Test - 2

Que.1 .  What is shallow copy?



A:            A shallow copy creates a copy of the dynamically allocated objects too.

B:            A shallow copy just copies the values of the data as they are.

C:            A shallow copy creates a copy of the statically allocated objects too

D:            Both b and c above



Right Answer: B



Que.2 .  An abstract class can be instantiated.



A:            True

B:            False



Right Answer: B



Que.3 .  Which of the following below can perform conversions between pointers to related classes?



A:            cast_static

B:            dynamic_cast

C:            static_cast

D:            cast_dynamic



Right Answer: C



Que.4 .  Can #define accept parameters?



A:            Yes

B:            No



Right Answer: A



Que.5 .  What is the difference between overloaded functions and overridden functions?



A:            Overloading is a dynamic or run-time binding and Overriding is static or compile-time binding

B:            Redefining a function in a friend class is called function overriding while Redefining a function in a derived class is called a overloaded fucntion.

C:            Overloading is a static or compile-time binding and Overriding is dynamic or run-time binding

D:            Redefining a function in a friend class is called function overloading while Redefining a function in a derived class is called as overridden fucnion.



Right Answer: C



Que.6 .  How do we define a destructor?



A:            X~() {}

B:            X() {}~

C:            X() ~{}

D:            ~X() {}



Right Answer: D



Que.7 .  Which classes allow primitive types to be accessed as objects?



A:            Storage

B:            Virtual

C:            Friend

D:            Wrapper



Right Answer: D



Que.8 .  Can constructors be overloaded?



A:            No

B:            Yes



Right Answer: B



Que.9 .  #if or #elif can be used to evaluate



A:            Constant expressions

B:            Macro expressions

C:            Both a and b

D:            All expressions



Right Answer: C



Que.10 .  The default access level assigned to members of a class is ___________



A:            Private

B:            Public

C:            Protected

D:            Needs to be assigned



Right Answer: A



Que.11 .  Which type of casting can be used only with pointers and references to objects?



A:            Dynamic_cast

B:            cast

C:            Static_cast

D:            Pointer_Cast



Right Answer: A

Que.12 .  Which of the following below is /are a valid iterator type?



A:            Input Iterator

B:            Backward Iterator

C:            Forward Iterator

D:            Both a and c above



Right Answer: D



Que.13 .  Which of the following is not a standard exception built in C++.



A:            std::bad_creat

B:            std::bad_alloc

C:            std::bad_cast

D:            std::bad_typeid



Right Answer: A



Que.14 .  Every class has at least one constructor function, even when none is declared.

A:            True

B:            False

Right Answer: A

Que.15 .  Which of the following is not a valid conditional inclusions in preprocessor directives

A:            #ifdef

B:            #ifundef

C:            #endif

D:            #elif

Right Answer: B

Que.16 .  In C++ two different functions can have the same name if their parameter types are same.

A:            True

B:            False

Right Answer: B

Que.17 .  Which of the following operators below allow to define the member functions of a class outside the class?

A:            ::

B:            ?

C:            :?

D:            %



Right Answer: A

Que.18 .  Inline functions are invoked at the time of


A:            Run time

B:            Compile time

C:            Depends on how it is invoked

D:            Both b and c above



Right Answer: B



Que.19 .  For which type of class private and protected members of the class can be accessed from outside the same class in which they are declared



A:            No such class exist

B:            Friend

C:            Static

D:            Virtual



Right Answer: B


Que.20 .  What is reinterpret_cast used for?


A:            converts integer pointer type to any other integer pointer type

B:            Converts any pointer type to any other pointer type

C:            converts any pointer type to only integer pointer type

D:            Both a and b


Right Answer: D


No comments:

Post a Comment