COP 3330 Exam 2: Java Programming Concepts with Solutions, Exams of
Computer Science
What is NOT a reason to develop interfaces? - ANSWERThere is always a
single programmer who defines everything so they are in charge of the
interfaces as well
Interfaces can be instantiated. - ANSWERFalse
Interfaces can contain only: - ANSWERdefault methods
static methods
constants
nested types
method signatures
Interfaces can be implemented by other classes. - ANSWERTrue
Interfaces cannot be extended by other interfaces. - ANSWERFalse
When defining a method interface, it MUST be specified public, otherwise it
is only accessible where in a project? - ANSWERpackage
, In a public interface body what are automatically considered public even if
the programmer doesn't put the public access modifier on the associated
method or member? - ANSWERstatic methods
Constant declarations
default methods
abstract methods
If an interface is declared public then a programmer can omit the public
access modifier for all abstract, default, and static methods. - ANSWERTrue
A programmer can define a reference variable with an interface as its data
type if the constructor call to the left of the equals sign (=) is a class instance
that implements that interface. - ANSWERTrue
If a class implements an interface and extends a class, the resulting class can
be an instance of:
1. The interface
2. The superclass
3. The subclass - ANSWERTrue
What is NOT a benefit of default methods in an interface? - ANSWERDefining
what the method should do when implemented
Computer Science
What is NOT a reason to develop interfaces? - ANSWERThere is always a
single programmer who defines everything so they are in charge of the
interfaces as well
Interfaces can be instantiated. - ANSWERFalse
Interfaces can contain only: - ANSWERdefault methods
static methods
constants
nested types
method signatures
Interfaces can be implemented by other classes. - ANSWERTrue
Interfaces cannot be extended by other interfaces. - ANSWERFalse
When defining a method interface, it MUST be specified public, otherwise it
is only accessible where in a project? - ANSWERpackage
, In a public interface body what are automatically considered public even if
the programmer doesn't put the public access modifier on the associated
method or member? - ANSWERstatic methods
Constant declarations
default methods
abstract methods
If an interface is declared public then a programmer can omit the public
access modifier for all abstract, default, and static methods. - ANSWERTrue
A programmer can define a reference variable with an interface as its data
type if the constructor call to the left of the equals sign (=) is a class instance
that implements that interface. - ANSWERTrue
If a class implements an interface and extends a class, the resulting class can
be an instance of:
1. The interface
2. The superclass
3. The subclass - ANSWERTrue
What is NOT a benefit of default methods in an interface? - ANSWERDefining
what the method should do when implemented