COMPREHENSIVE QUESTIONS AND
VERIFIED ANSWERS
◉In java, a two dimensional array in Java is really an "array of
arrays.". Answer: True
◉In Java, arrays are reference types. Answer: True
◉Which methods can be used to replace an element in an
ArrayList?. Answer: set
◉Which method can be called to remove all elements from an
ArrayList at once?. Answer: clear
◉Which method can be used to remove an element from an
ArrayList?. Answer: remove
◉Java ArrayLists are like re-sizable arrays. Answer: True
◉Which method can be used to insert an element into an ArrayList?.
Answer: add
, ◉Only an enhanced for loop can be used to iterate over an ArrayList.
Answer: False
◉Which object oriented element is used to define "is a"
relationships?. Answer: Answered: Encapsulation, Message Passing,
Polymorphism, Composition
◉Which object oriented element is used to define "has a"
relationship?. Answer: Answered: Data Hiding
◉Which object oriented element is best defined as "an object should
have complete authority over its responsibilities"?. Answer:
Answered: Inheritance, Encapsulation
◉We can more easily debug a program when the responsibilities are
well encapsulated. Answer: True
◉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
◉Data hiding can allow us to separate the information from its
representation.. Answer: True