MCIT 591 FINAL EXAM WITH QUESTIONS AND
WELL VERIFIED ANSWERS [GRADED A+]
ACTUAL 100%
What is the method signature for the main method of a Java
... [Show More] program? -
ANS✔✔---main(String[] args)
What is overriding? - ANS✔✔---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
True or False, assertEquals uses .Equals() - ANS✔✔---True
What is overloading? - ANS✔✔---two methods that have the same name but
different method signatures
What is cohesion? - ANS✔✔---similar tasks should be in the same class
What does DRY mean? - ANS✔✔---Do not repeat yourself !
Method Signature - ANS✔✔---name of the method and the method
parameters along with their data types
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? -
ANS✔✔---Yes! the only time it couldn't ( as far as I know) is when the
method is private
Polymorphism - ANS✔✔---principle that allows the same method to exist in
different forms
Why do we utilize polymorphism? - ANS✔✔----Because it allows us to
provide similar code in two or more similar forms
-It is important to make code DRY
What is coupling? - ANS✔✔---interaction between two classes should be
kept low
What is an Interface? - ANS✔✔---a collection of methods
Why would you use an interface? - ANS✔✔----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
What is the syntax of Inheritance? - ANS✔✔---class extends
Liskov Substitution Principle - ANS✔✔---in any line of code, a class can
always be replaced by one of its subclasses. An interface can always be
replaced by some implementation of that interface
How would we tell if a class is a child or parent? - ANS✔✔----If it has an "is
a" relationship
-Example) Goalkeeper "is a" Player
What is the syntax to call an instance variable from the parent class, in the
child class? - ANS✔✔---Do "super.nameOfVariable"
Which type of casting is legal? - ANS✔✔---Upcasting is legal
True or False; The return of a method is part of its signature? - ANS✔✔---
FALSE
True or False; When you use an interface, all methods in said interface have
to be implemented. - ANS✔✔---TRUE
How does the default .sort() method sort objects? - ANS✔✔---From least to
greatest
True or False; System.out.println() automatically calls an objects toString()
method - ANS✔✔---TRUE
What are two methods that are commonly overridden? - ANS✔✔---toString();
.equals()
What type of casting is always illegal? - ANS✔✔---Ill call it crosscasting, but
an example is casting a dog as a cat
Wha [Show Less]