Question 1 5 pts (TCO 7) What is an abstract class? A generalized class used onl
ID: 2246652 • Letter: Q
Question
Question 1
5 pts
(TCO 7) What is an abstract class?
A generalized class used only to create related derived classes
A class without any superclasses
A class from which we create many instances
Any subclass with more than one superclass
Question 2
5 pts
(TCO 7) Programmers may be forced to adhere to a contract or a specification defined by a framework due to the use of _____.
abstract classes
base classes
is-a relationships
None of the above
Question 3
5 pts
(TCO 4) If you have a complete, working Employee class that has been thoroughly tested, and you wish to add an overloaded getSalary() method that can calculate the salary of a Manager which is the total of salary and bonus, how should this be accomplished?
Make a brand new class.
Add the method to your existing Employee class.
Add the method in the same class as the main.
Derive a new Manager class from the first Employee class.
Question 4
5 pts
(TCO 3) An Order class and RushOrder class have what type of relationships?
The Order has-a RushOrder.
The Order is-a RushOrder.
The RushOrder has-an Order.
The RushOrder is-an Order.
Question 5
5 pts
(TCO 4) In what type(s) of situation(s) would it be best to make a new derived class from a base class?
When your current class is a general form of what your new class should be
When you need to create a specialized class from an existing class
A and B
None of the above
Question 6
5 pts
(TCO 4) Suppose class Child is derived from class Parent which in turn is derived from class GrandParent. When we destroy an object of class Child, three destructors are called: i) Child, ii) Parent, iii) GrandParent. What is the order?
Child, Parent, GrandParent
Parent, GrandParent, Child
GrandParent, Child, Parent
GrandParent, Parent, Child
Question 7
5 pts
(TCO 6) What is the result of overusing inheritance?
System dependencies are created
Unnecessary relationships are created
Code is harder to understand
All of the above
Question 8
5 pts
(TCO 4) Which of the following is not a good example of a hierarchy that could be modeled with inheritance?
Order
Dog
Animals
Odd numbers
Question 9
5 pts
(TCO 1) Examine the class definition. How many members does it contain?
class clockType
{
public:
void setTime(int, int, int);
void getTime()const;
void printTime() const;
void icrementSeconds();
void incrementMinutes();
void incrementHours();
bool equalTime(const clockType&) const;
private:
int hr;
int min;
int sec;
};
7
3
An average of 5 because (7 + 3) / 2 = 5
10
Question 10
5 pts
(TCO 7) Which of the following declares a pure virtual function in an abstract C++ class?
public void cookIngredients() {}
public void cookIngredients()
public void cookIngredients()=0;
public cookIngredients();
Question 11
5 pts
(TCO 4) Suppose that bClass is a class. Which of the following statements correctly derives the class dClass from bClass?
class dClass:: public bClass
{
//classMembersList
};
class dClass: private bClass
{
//classMembersList
};
class dClass:: protected bClass
{
//classMembersList
};
class bClass: public dClass
{
//classMembersList
};
Question 12
5 pts
(TCO 8) Data/information hiding and encapsulation improves construction and maintenance because:
programs become more self-documenting.
procedural programming practices are supported.
adding additional details is isolated to a single class.
All of the above
None of the above
Question 13
5 pts
(TCO 8) What are some of the characteristics of "self-documenting" code?
Detailed comments, addressing all aspects of the code
Deep levels of nesting to ensure all situations are addressed
Straightforward algorithms
All of the above
None of the above
Question 14
5 pts
(TCO 9) Which of the following allow a programmer to reduce the complexity of an object-oriented program?
Create each class in a separate file
Using namespaces as a container for logically related items
Using namespace to create global types
All of the above
None of the above
Explanation / Answer
Q.What is an abstract class?
Answer. A generalized class used only to create related derived classes
Q. What is the result of overusing inheritance?
Answer: All of the above(System dependencies are created, Unnecessary relationships are created, Code is harder to understand)
Q. An Order class and RushOrder class have what type of relationships?
Answer.The Order has-a RushOrder.
Q. Which of the following declares a pure virtual function in an abstract C++ class?
Answer: public void cookIngredients()=0;
Q. Suppose that bClass is a class. Which of the following statements correctly derives the class dClass from bClass?
Answer:
class dClass:: public bClass
{
//classMembersList
};
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.