CPP MCQ PART – 7



PAGES: 1    2     3     4     6     7 


126. When a base class is privately inherited by derived class
a) the public members of the base class becomes the private members of the derived class
b) the private members are not inherited
c) the protected members of the base class becomes the private members of the derived class
d) All of the above

127. Only one copy of the class is inherited, when it is defined as
a) virtual
b) static
c) public
d) none of the above

128. A class that acts only as a base class and is not used to create objects is
a) parent class
b) super class
c) abstract class
d) none of the above

129. The version of a virtual function actually gets called during runtime is based solely up in the type of the object that is
a) being instantiated and processed by the function
b) in the derived class
c) being pointed to by a base class pointer
d) being passed to the function

130. In multiple inheritance, the base classes are constructed
a) in the order of declaration in the derived class
b) in the order of declaration in the program.
c) in the order of definition of a class
d) none of the above

131. When an object of a derived class is created
a) derived class constructor is called followed by base class constructor
b) base class constructor is called followed by derived class constructor
c) base class constructor is not called at all
d) none of the above

132. The derived class constructor
a) never passes any values to base class constructor
b) is responsible for passing the entire test of arguments needed by base class constructors
c) can pass arguments only to one base class constructor function
d) none of the above

133. A virtual base class
a) allows to inherit more than one copy of the base class members
b) strict the path of inheritance
c) is qualified as virtual in base class definition
d) none of the above

134. When a base class is inherited publicly
a) the private members of the base class are not accessible
b) the derived class can directly access the private members of the base class
c) the derived class can access the private members only through the member function of the base class
d) none of the above

135. When two or more classes are used within another class definition, it is
a) inheritance
b) aggregation
c) both (a) & (b)
d) none of the above

136. Composition is referred to as
a) “is a” relationship
b) “has a” relationship
c) both (a) & (b)
d) none of the above

137. Inheritance is referred to as
a) “is a” relationship
b) “has a” relationship
c) Both (a) & (b)
d) none of the above

138. An explicitly defined destructor function
a) may be virtual
b) may not be virtual
c) both (a) & (b)
d) None of the above

139. The copy operation by a simple assignment causes in some cases
a) no effect
b) hollow copy
c) copy exactly the same as original
d) creates new

140. Public data members can be accessed
a) only from the base class itself
b) both form the base class and from its derived class
c) from the class which is a friend of the base class
d) none of the above

141. A static automatic variable is used to
a) make a variable visible to several function
b) make a variable visible only to one function
c) converse memory when a function is not executing
d) retain a value when a function is not executing

142. The stacks data structure are based on
a) LIFO
b) FILO
c) FIFO
d) None of the above

143. Queues are based on
a) LIFO
b) FILO
c) FIFO
d) None of the above

144. & operator is
a) indirection operator
b) Logical AND
c) address operator
d) none of the above

145. int *ptr[10]; is
a) an array of 10 int pointers
b) a pointer of 10 int elements
c) an array of 10 elements returning an int value
d) none of the above

146. A structure that refers to itself is a
a) nested structure
b) recursive structure
c) self-referential structure
d) none of the above

147. With in …….scope class member may be referenced simply by their names
a) class’s
b) object’s
c) program
d) none of the above

148. To point to the address of any pointer variable cast the pointer to
a) char *
b) int *
c) void *
d) none of the above

149. Destructors are called
a) in the same order of constructor calls
b) in the reverse order of constructor calls
c) in any random order
d) none of the above

150. The advantage of declaring a virtual function as pure is
a) you can avoid making the class an abstract class
b) you force any derived class to define its own implementation
c) programs runs faster
d) early binding can be achieved

CHECK ANSWERS


PAGES: 1    2     3     4     6     7