CMSC 132 MIDTERM 1
Provide an example that illustrates procedural abstraction - answer One example: a
function that sorts data, but we don't indicate how to sort it.
the private access specified - answer Mention one Java language feature that allow us
to implement encapsulation.
Yes, as finalize() is called when an object is garbage collected - answer You would like
to generate a message when an object is garbage collected. Would you be able to
generate that message using the finalize() method? Briefly explain
When you have a fixed number of instances (e.g., phases of the moon). - answer
should you use an enumerated type vs. a class? Briefly explain.
Both the View and Controller. - answer For our first project (Clear CellGame) which
component (of the Model-View-Controller) was provided?
Using static defines a single constant for the whole class, whereas non-static defines a
constant per object. - answerWhat is difference between making a variable final static
vs. just final? In other words, what is the difference between the following two
declarations? Briefly explain.
Throw illegal argument exception with a string "Invalid Argument" - answerthrow new
IllegalArgumentException("Invalid Argument");
true - answerIs it possible to define enumerated types that have private constructors?
false - answerWhen designing object-oriented systems verbs in a problem statement
may represent classes/variables needed in the design.
Shallow copy - answerWhich kind of copying (reference, shallow or deep) is performed
by the default clone method every class has?
Procedural abstraction - answerDescribes operation without indicating how to
implement it.
Initializer - answerThe word that best describes what a constructor method does is:
When the class is loaded - answerA static initialization block is executed:
Never - answerWe can override a final method
Provide an example that illustrates procedural abstraction - answer One example: a
function that sorts data, but we don't indicate how to sort it.
the private access specified - answer Mention one Java language feature that allow us
to implement encapsulation.
Yes, as finalize() is called when an object is garbage collected - answer You would like
to generate a message when an object is garbage collected. Would you be able to
generate that message using the finalize() method? Briefly explain
When you have a fixed number of instances (e.g., phases of the moon). - answer
should you use an enumerated type vs. a class? Briefly explain.
Both the View and Controller. - answer For our first project (Clear CellGame) which
component (of the Model-View-Controller) was provided?
Using static defines a single constant for the whole class, whereas non-static defines a
constant per object. - answerWhat is difference between making a variable final static
vs. just final? In other words, what is the difference between the following two
declarations? Briefly explain.
Throw illegal argument exception with a string "Invalid Argument" - answerthrow new
IllegalArgumentException("Invalid Argument");
true - answerIs it possible to define enumerated types that have private constructors?
false - answerWhen designing object-oriented systems verbs in a problem statement
may represent classes/variables needed in the design.
Shallow copy - answerWhich kind of copying (reference, shallow or deep) is performed
by the default clone method every class has?
Procedural abstraction - answerDescribes operation without indicating how to
implement it.
Initializer - answerThe word that best describes what a constructor method does is:
When the class is loaded - answerA static initialization block is executed:
Never - answerWe can override a final method