COMP 401 Midterm Exam 2. Spring 2021. University of North Carolina.I have not received nor given any unauthorized assistance in completing this
... [Show More] exam.
Signature:
Name:
PID:
This page intentionally left blank.
Part I: True or False
30 questions, 1 points each, 30 points total.
The for (Object o : iterable) construct only works for built-in arrays and ArrayLists.
Subinterfaces are an example of inheritance.
A subinterface can override methods specified in its parent interface.
A class that implements a subinterface has an "is-a" relationship with the parent interface.
A class must explicitly specify that it is implementing both a subinterface and its parent interface.
All methods in the parent interface must also be specified in the subinterface.
A class that implements a subinterface must be extended from a class that implements the parent interface.
Only subclasses can implement subinterfaces.
A subclass inherits both public and protected instance variables from the parent class.
A subclass can directly access private instance variables declared in the parent class.
A method defined by a subclass is unable to invoke a private method defined in the parent class.
A subclass can not specify methods not already specified in the parent class.
Subclassing is useful for extending existing classes with new behavior.
The implementation of an overriding method in the subclass must have the same method signature as a method defined in the parent class.
A subclass constructor can use super to explicitly invoke a constructor of its parent class.
A call to super can be invoked anywhere within a subclass constructor.
A subclass constructor can invoke any method of the parent class by using super.
In an overriding method, super can be used to invoke the same method as specified in the parent class.
All overriding methods in Java are virtual.
A finally block will not be called unless an exception occurs.
Within a try-catch-finally construct, the finally block will execute even if a return statement is encountered. [Show Less]