Question 1 Which of the following should usually be private? A. Methods B. Const
ID: 3758360 • Letter: Q
Question
Question 1
Which of the following should usually be private?
A. Methods
B. Constructors
C. Variables
D. All of the above
Question 2
Which of the following statements is TRUE?
A. Methods and instance variables can be public, protected, or private.
B. Information hiding is achieved by restricting access to class members via keyword public.
C. The public members of a class are not directly accessible to the client of a class.
D. None of the above is true.
Question 3
A __________ can be defined in a class to perform termination housekeeping on an object before the garbage collector reclaims the object’s memory.
A. destructor
B. property
C. garbage collector
D. None of the above
Question 4
Which statement is FALSE?
A. The actual data representation used within the class is of no concern to
the class’s clients.
B. Clients generally care about what the class does but not how the class
does it.
C. Clients are usually involved in a class’s implementation.
D. Hiding the implementation reduces the possibility that other program
parts will become dependent on class-implementation details.
Question 5
Which statement is FALSE?
A. The actual data representation used within the class is of no concern to
the class’s clients.
B. Clients generally care about what the class does but not how the class
does it.
C. Clients are usually involved in a class’s implementation.
D. Hiding the implementation reduces the possibility that other program
parts will become dependent on class-implementation details.
Question 6
Composition is:
A. a form of software reuse.
B. using an object reference as a class member.
C. a good design practice.
D. All of the above.
Question 7
Constructors:
A. initialize instance variables.
B. when overloaded, can have identical argument lists.
C. when overloaded, are selected by number and types of parameters.
D. a and c
Question 8
Instance variables or methods declared with the __________ modifier are accessible only in that class definition.
A. protected
B. static
C. private
D. None of the above.
Explanation / Answer
Question 1
Which of the following should usually be private?
A. Methods
B. Constructors
C. Variables
D. All of the above
Ans: C. Variables
Question 2
Which of the following statements is TRUE?
A. Methods and instance variables can be public, protected, or private.
B. Information hiding is achieved by restricting access to class members via keyword public.
C. The public members of a class are not directly accessible to the client of a class.
D. None of the above is true.
Ans: A. Methods and instance variables can be public, protected, or private.
Question 3
A __________ can be defined in a class to perform termination housekeeping on an object before the garbage collector reclaims the object’s memory.
A. destructor
B. property
C. garbage collector
D. None of the above
Ans: A. destructor
Question 4
Which statement is FALSE?
A. The actual data representation used within the class is of no concern to
the class’s clients.
B. Clients generally care about what the class does but not how the class
does it.
C. Clients are usually involved in a class’s implementation.
D. Hiding the implementation reduces the possibility that other program
parts will become dependent on class-implementation details.
Ans: C. Clients are usually involved in a class’s implementation.
Question 5
Which statement is FALSE?
A. The actual data representation used within the class is of no concern to
the class’s clients.
B. Clients generally care about what the class does but not how the class
does it.
C. Clients are usually involved in a class’s implementation.
D. Hiding the implementation reduces the possibility that other program
parts will become dependent on class-implementation details.
Ans: C. Clients are usually involved in a class’s implementation.
Question 6
Composition is:
A. a form of software reuse.
B. using an object reference as a class member.
C. a good design practice.
D. All of the above.
Ans: D. All of the above.
Question 7
Constructors:
A. initialize instance variables.
B. when overloaded, can have identical argument lists.
C. when overloaded, are selected by number and types of parameters.
D. a and c
Ans: D. a and c
Question 8
Instance variables or methods declared with the __________ modifier are accessible only in that class definition.
A. protected
B. static
C. private
D. None of the above.
Ans: C. private
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.