1. (TCO 7) An abstract class can contain _____. (Points : 2)
pure virtual functions
ordinary functions
Both A and B
None of the above
2. (TCO 7) What is an abstract class? (Points : 2)
Any class which can be instantiated
A class without any subclasses
A conceptually vague or generalized class
Any superclass with more than one subclass
3. (TCO 7) Which of the following statements is true? (Points : 2)
A pure virtual function is a function without function implementation and ends with =0;
An actual object can be created from an abstract class.
A pure virtual function is a function that cannot be inherited and therefore must be overloaded.
A pure virtual function cannot be overridden.
4. (TCO 7) Which of the following classes is most likely an abstract class? (Points : 2)
BlackWidow
Dime
Aspirin
Tree
5. (TCO 7) _____ and _____ can be used to implement a contract in an object-oriented
application. (Points : 2)
base class; method
abstract class; interface
abstract method; interface
abstract class; method
None of the above
6. (TCO 7) Which is the prototype for a pure virtual function in class TVGame called
StartGame which has no inputs and returns a bool? (Points : 2)
bool virtual StartGame()
virtual bool StartGame() = 0;
virtual bool TVGame::StartGame() {}
bool virtual TVGame::StartGame(string) = 0;
7. (TCO 7) Multiple inheritance is defined as the ability to do what? (Points : 2)
Identify multiple superclasses for a single class
Create multiple subclasses from a single superclass
Override multiple methods in a base class
Overload multiple superclasses for a single class
8. (TCO 7) Which of the following classes represent an abstract class? (Points : 2)
class Plant {
virtual void grow()=0;
}
class Plant {
virtual void grow ();
}
class Plant {
virtual void grow (){}
}
class Plant {
virtual void grow (){}
}
9. (TCO 7) Which of the following declares an abstract method in an
abstract C++ class? (Points : 2)
public: virtual calc();
public: virtual void calc()=0;
public: void calc() {}
public: void calc()=0;
10. (TCO 7) What is the coding requirement(s) that a programmer must follow
when writing virtual functions? (Points : 2)
The programmer must use a "virtual" keyword in the parent class.
The parent class must have specific implementation coded in the .cpp file.
The base class must use a different name for the function than the parent class.
There are no specific coding requirements for using the "virtual" keyword.
Tags: Multiple choice question, MCQ, c++, cpp, object oriented programming, oop