Question 1.1. (TCO 1) Which of the following would be a more appropriate choice for a method in a Fork class? (Points : 5)
Color()
Bend()
Eat()
Material()
Color()
Bend()
Eat()
Material()
Question 2.2. (TCO 1) Object-oriented programming generally focuses on _____. (Points : 5)
A. separating the interface from the implementation.
B. client side access to implementation details.
C. creating as many classes as possible.
D. code reuse with methods.
All of the above
None of the above
Only A, B, and D
A. separating the interface from the implementation.
B. client side access to implementation details.
C. creating as many classes as possible.
D. code reuse with methods.
All of the above
None of the above
Only A, B, and D
Question 3.3. (TCO 2) Which of the following components of a class definition do not have an access modifier? (Points : 5)
State variables
Data members
Member methods
Destructor
None of the above
State variables
Data members
Member methods
Destructor
None of the above
Question 4.4. (TCO 2) Which of the following statements is/are true? (Points : 5)
A. A private (helper) method can only be used inside the class. It cannot be called through an object of the class.
B. The programmer can control the scope of a data member of a class using access specifiers.
C. The state of an object must be hidden and therefore protected by unauthorized use.
All of the above
Only A and C
A. A private (helper) method can only be used inside the class. It cannot be called through an object of the class.
B. The programmer can control the scope of a data member of a class using access specifiers.
C. The state of an object must be hidden and therefore protected by unauthorized use.
All of the above
Only A and C
Question 5.5. (TCO 5) Which of the following method pairs are examples of method overloading? (Points : 5)
public void Bake() ; public int Bake(int x)
public int Mix(int x, int y, int z) ; public int Mix(int y, int x, int z)
public int Shake(int x, int y) ; public int Shake(int x, int y, int z)
All of the above
Only A and C
public void Bake() ; public int Bake(int x)
public int Mix(int x, int y, int z) ; public int Mix(int y, int x, int z)
public int Shake(int x, int y) ; public int Shake(int x, int y, int z)
All of the above
Only A and C
Question 6.6. (TCO 1) Which of the following statements is/are false? (Points : 5)
Member methods are the means by which you implement the behavior of a class.
By using the keyword class in your program, memory is allocated for the object being defined.
Objects are created during program execution and eventually destroyed.
None of the above
Member methods are the means by which you implement the behavior of a class.
By using the keyword class in your program, memory is allocated for the object being defined.
Objects are created during program execution and eventually destroyed.
None of the above
Question 7.7. (TCO 2) You have been tasked to create an Automobile class and your boss wants you to consider the concept of encapsulation as you design your class. Which of the following actions will you take? (Points : 5)
Declare as many class attributes public as you can, creating accessor/mutators for each one.
Package attributes and behaviors specific to an Automobile together.
Make sure to include a specific implementation for a drive method that all subclasses can inherit.
Declare the class as private.
All of the above
Declare as many class attributes public as you can, creating accessor/mutators for each one.
Package attributes and behaviors specific to an Automobile together.
Make sure to include a specific implementation for a drive method that all subclasses can inherit.
Declare the class as private.
All of the above
Question 8.8. (TCO 2) You need to utilize an Item class in your own object-oriented class using composition. Luckily, one of your fellow students just finished writing their own version of an Item class. If the Item class was properly designed as a(n) _____, you do not need to know the specific details of how the class was implemented. Instead, you only need to become familiar with its _____. (Points : 5)
abstract class; abstract methods
object-oriented instance; method implementations
black box system; interface
interface; inheritance hierarchy
abstract class; abstract methods
object-oriented instance; method implementations
black box system; interface
interface; inheritance hierarchy
Question 9.9. (TCO 2) A class is designed with two public attributes: attributeOne and attributeTwo. attributeOne is an integer data type while attributeTwo is a string data type. Which pseudocode representation(s) of setters would be appropriate for this class? (Points : 5)
int setAttributeOne(int newAttributeOne)
{
return attributeOne
}
void setAttributeOne(int newAttributeOne)
{
attributeOne = newAttributeOne
}
string setAttributeTwo (int newAttributeTwo)
{
attributeTwo = newAttributeTwo
}
void setAttributeTwo ()
{
attributeTwo = " "
}
Both A and C
None of the above
int setAttributeOne(int newAttributeOne)
{
return attributeOne
}
void setAttributeOne(int newAttributeOne)
{
attributeOne = newAttributeOne
}
string setAttributeTwo (int newAttributeTwo)
{
attributeTwo = newAttributeTwo
}
void setAttributeTwo ()
{
attributeTwo = " "
}
Both A and C
None of the above
Question 10.10. (TCO 7) Which of the following statements is false? (Points : 5)
A pure virtual function is a function without function implementation and can be found in an abstract class.
If a derived class extends an abstract base class, the derived class must implement the pure virtual functions declared in the abstract base class.
Any method in an abstract class is considered a pure virtual function.
Pure virtual functions are inherited.
A pure virtual function is a function without function implementation and can be found in an abstract class.
If a derived class extends an abstract base class, the derived class must implement the pure virtual functions declared in the abstract base class.
Any method in an abstract class is considered a pure virtual function.
Pure virtual functions are inherited.
Question 11.11. (TCO 7) What is an abstract class? (Points : 5)
Any class which can be instantiated
A class without any subclasses
A conceptually vague or generalized class
Any superclass with more than one subclass
Any class which can be instantiated
A class without any subclasses
A conceptually vague or generalized class
Any superclass with more than one subclass
Question 12.12. (TCO 7) In terms of object-oriented programming, rules for the use of an application programming interface or framework can be enforced through the use of a(n) _____. (Points : 5)
contract
inheritance hierarchy
has-a relationship
object constructed with a multi-arg constructor
All of the above
contract
inheritance hierarchy
has-a relationship
object constructed with a multi-arg constructor
All of the above
Комментариев нет:
Отправить комментарий