QUESTIONS WITH COMPLETE SOLUTION
●● An advantage of composition is the fact that we can sometimes reuse
classes that we have already written, instead of having to design and
write new classes.
Answer: True
●● In Java a variable must be ____ before it can be used
Answer: declared
●● In Java class members are declared with the keyword
Answer: static
●● Method overloading distinguishes between methods based on
Answer: both number of arguments and data types of arguments
●● During what activity do we directly analyze the language of the
problem to identify objects, their attributes and their behaviors
Answer: noun/verb analysis
●● Immediately after the object's variables are initialized
,Answer: a constructor is called
●● Every Java program consists of at least one
Answer: class definition
●● Which of the following is/are true about arrays? Choose all that
apply.
a) the elements of an array are accessed by an integer index
b) the elements of an array all located contiguously in memory
c) the elements of an array all have the same data type
d) an array is a set of variables
e) none of these
Answer: Answer: a, b, c, d
●● In Java an expression like the one below will evaluate to
new Bunny("Flopsy", 8)
Answer: an object reference
●● Which object oriented element is used to define "has a"
relationships?
Answer: Composition
, ●● Which object oriented element is best defined as "objects best
viewed as packages of responsibility"?
Answer: Encapsulation
●● Operations are things an object
Answer: does
●● The object oriented element that allows us to build more complex
objects out of simpler objects is.
Answer: Composition
●● The differences between value types and reference types applies to
parameters
Answer: True
●● Encapsulation is about assigning responsibilities to objects
Answer: True
●● Which object oriented element is best defined as "an object should
have complete authority over its responsibilities"?
Answer: Data Hiding
●● An object is an instance of a class.