CPSC 1110 Final Exam
with correct answers
2025/2026
All of its features are related to the concept that the class represents. - correct answersUnder
which of the following conditions would the public interface of a class be considered cohesive?
a) All of its features are public and none of its features are static.
b) All of its features are related to the concept that the class represents.
c) The quality of the public interface is related as moderate to high.
d) It is obvious that the public interface refers to multiple concepts.
A method and its caller. - correct answersPre- and postconditions may be viewed as a contract
between which of the following parties?
a) A method and its caller.
b) a class and its interface.
c) A method signature and its implementation.
d) An object and its class.
,If it is not met, the method is not responsible for computing the correct result. - correct
answersWhich of the following statements is true regarding the precondition of a method?
a) It is a suggestion to the caller of the method regarding method input values.
b) It guarantees the object will be in a certain state after the method call is completed.
c) If it is not met, the method is not responsible for computing the correct result.
d) It limits the potential data type of the parameter variables.
Dependency between classes. - correct answersWhat is coupling?
a) Coupling is an inconsistent design pattern
b) For every subclass, we have at most one superclass.
c) Dependency between classes.
d) Coupling suggests that a class will run slowly.
A guarantee that the object is in a certain state after the method call is complete. - correct
answersWhich of the following statements describes one aspect of a postcondition?
a) A logical condition in a program that you believe to be true.
b) A requirement that the caller of a method must meet.
c) A set of criteria defined by the caller of a method.
d) A guarantee that the object is in a certain state after the method call is complete.
A subclass may inherit methods and instances variables from its superclass, and may also
implement its own instance variables. - correct answersWhich of the following is true regarding
subclasses?
, a) A subclass that inherits methods from its superclass may not override the methods.
b) A subclass that inherits instance variables from its superclass may not declare additional
instance variables.
c) A subclass may inherit methods or instance variables from its superclass but not both.
d) A subclass may inherit methods and instances variables from its superclass, and may also
implement its own instance variables.
The subclass must simply use the name of the superclass instance variable. - correct
answersWhat must a subclass do to modify a protected superclass instance variable?
a) The subclass must simply use the name of the superclass instance variable.
b) The subclass must declare its own instance variable with the same name as the superclass
instance variable.
c) The subclass must use a public method of the superclass to update the superclass;s private
instance variable.
d) The subclass must have its own public method to update the superclass's protected instance
variable.
A subclass has no access to private instance variables of its superclass. - correct answersWhich
of the following is true regarding subclasses?
a) A subclass has access to private instance variables of its superclass.
b) A subclass has no access to private instance variables of its superclass.
c) A subclass does have access to public instance variables of its superclass.
d) A subclass must specify the implicit parameter to use methods inherited from its superclass.
The subclass's instance variable is said to shadow the superclass's variable. - correct answersIf a
superclass and a subclass both have an instance variable with the same name, which statement
is true?
with correct answers
2025/2026
All of its features are related to the concept that the class represents. - correct answersUnder
which of the following conditions would the public interface of a class be considered cohesive?
a) All of its features are public and none of its features are static.
b) All of its features are related to the concept that the class represents.
c) The quality of the public interface is related as moderate to high.
d) It is obvious that the public interface refers to multiple concepts.
A method and its caller. - correct answersPre- and postconditions may be viewed as a contract
between which of the following parties?
a) A method and its caller.
b) a class and its interface.
c) A method signature and its implementation.
d) An object and its class.
,If it is not met, the method is not responsible for computing the correct result. - correct
answersWhich of the following statements is true regarding the precondition of a method?
a) It is a suggestion to the caller of the method regarding method input values.
b) It guarantees the object will be in a certain state after the method call is completed.
c) If it is not met, the method is not responsible for computing the correct result.
d) It limits the potential data type of the parameter variables.
Dependency between classes. - correct answersWhat is coupling?
a) Coupling is an inconsistent design pattern
b) For every subclass, we have at most one superclass.
c) Dependency between classes.
d) Coupling suggests that a class will run slowly.
A guarantee that the object is in a certain state after the method call is complete. - correct
answersWhich of the following statements describes one aspect of a postcondition?
a) A logical condition in a program that you believe to be true.
b) A requirement that the caller of a method must meet.
c) A set of criteria defined by the caller of a method.
d) A guarantee that the object is in a certain state after the method call is complete.
A subclass may inherit methods and instances variables from its superclass, and may also
implement its own instance variables. - correct answersWhich of the following is true regarding
subclasses?
, a) A subclass that inherits methods from its superclass may not override the methods.
b) A subclass that inherits instance variables from its superclass may not declare additional
instance variables.
c) A subclass may inherit methods or instance variables from its superclass but not both.
d) A subclass may inherit methods and instances variables from its superclass, and may also
implement its own instance variables.
The subclass must simply use the name of the superclass instance variable. - correct
answersWhat must a subclass do to modify a protected superclass instance variable?
a) The subclass must simply use the name of the superclass instance variable.
b) The subclass must declare its own instance variable with the same name as the superclass
instance variable.
c) The subclass must use a public method of the superclass to update the superclass;s private
instance variable.
d) The subclass must have its own public method to update the superclass's protected instance
variable.
A subclass has no access to private instance variables of its superclass. - correct answersWhich
of the following is true regarding subclasses?
a) A subclass has access to private instance variables of its superclass.
b) A subclass has no access to private instance variables of its superclass.
c) A subclass does have access to public instance variables of its superclass.
d) A subclass must specify the implicit parameter to use methods inherited from its superclass.
The subclass's instance variable is said to shadow the superclass's variable. - correct answersIf a
superclass and a subclass both have an instance variable with the same name, which statement
is true?