Quiz: Classes & Objects

To View Tricks: Login Required

Number of Questions: 25

Question: 21 -

Which of the following statements about virtual base classes is correct?

Options:
  1. It is used to provide multiple inheritance.

  2. It is used to allow multiple copies of base class in a derived class.

  3. It is used to avoid multiple copies of base class in derived class.

  4. It allows private members of the base class to be inherited in the derived class.

  5. Answer:

    It is used to avoid multiple copies of base class in derived class.

    Solution not available.

Question: 22 -

What does the class definitions in following code represent?

class Bike
{
    Engine objEng;
};
class Engine
{
    float CC;
};

Options:
  1. Both A and B

  2. has a relationship

  3. kind of relationship

  4. Inheritance

  5. Answer:

    has a relationship

    Solution not available.

Question: 23 -

Constructor is executed when _____.

Options:
  1. an object is used

  2. an object goes out of scope.

  3. an object is created

  4. a class is declared

  5. Answer:

    an object is created

    Solution not available.

Question: 24 -

How many objects can be created from an abstract class?

Options:
  1. As many as we want

  2. 1

  3. 0

  4. 2

  5. Answer:

    0

    Solution not available.

Question: 25 -

Which of the following means "The use of an object of one class in definition of another class"?

Options:
  1. Inheritance

  2. Encapsulation

  3. Abstraction

  4. Composition

  5. Answer:

    Composition

    Solution not available.