MCIT 591 Final Exam | Questions with 100% Correct Answers | Verified | Latest Update
Question : Select all that are correct. Why don't we just upcast
everything to Objects?
- You lose the methods and properties that give Object-
- No reason, I am going to do this in all of my code now!
- You then need to worry about ClassCastExceptions when
Oriented Programming its power
downcasting D)You need to downcast to regain these methods and properties
Correct answer: A,C,D
Question : What is the method signature for the main method
of a Java program?
Correct answer: main(String[] args)
Question : What is overloading?
Correct answer: two methods that have the same name but
different method signatures
Question : What is overriding?
Correct answer: Declaring a method in a sub class which is
already present in the parent class in order to make the method more specialized to that sub class
Question : True or False, assertEquals uses .Equals()
Correct answer: True
Question : If you have a child class that is extended a parent
class, and that parent class has a protected method, can the child class utilize that method?
Correct answer: Yes! the only time it couldn't ( as far as I
know) is when the method is private
Question : What is cohesion?
Correct answer: similar tasks should be in the same class
Question : What is coupling?
Correct answer: interaction between two classes should be
kept low
Question : What does DRY mean?
Correct answer: Do not repeat yourself !
Question : Method Signature
Correct answer: name of the method and the method
parameters along with their data types
Question : Polymorphism
Correct answer: principle that allows the same method to exist
in different forms
Question : Why do we utilize polymorphism?
Correct answer: -Because it allows us to provide similar code
in two or more similar forms -It is important to make code DRY
Question : What is an Interface?
Correct answer: a collection of methods
Question : Why would you use an interface?
Correct answer: -you write an interface when you want
classes of various types to all have a certain set of capabilities -it helps keep your code DRY
Question : What is Inheritance?
Correct answer: -When a subclass receives its methods and
instance variables from a larger parent class -This results in the code being even more DRY