QUESTION 1
1. Which one of the following keywords causes a program to exit inside a loop, and continue execution after the
end of the loop?
a. continue
b. goto
c. break
d. while
e. none of the above
1 points
QUESTION 2
1. @Override has the effect of
a. checking that the method following @Override has an identical method in the superclass
b. checking that the spelling of the subclass method identifier is correct
c. checking that the identifier of the method that follow @Override is identical to an identifier in the
subclass
d. checking that the subclass method following @Override has the same parameter list as a method in
the superclass
e. forcing methods in the superclass to be overridden by methods in the subclass
1 points
QUESTION 3
1. When two methods have the same name but different signatures, they are said to be
a. overridden
b. static
c. overloaded
d. chained
e. recursive
1 points
QUESTION 4
1. Which one of the following is not true of the relationship between an interface and an abstract class:
a. an interface acts like an abstract class that must contain only abstract methods
b. an interface, like an abstract class, cannot be instantiated
, c. an interface acts just like an abstract class except that there are no restrictions on the number of
interfaces a class may implement
d. unlike an abstract class, an interface cannot be used as a parameter type in an argument list
e. none of the above
1 points
QUESTION 5
1. In debug mode, which one of the following allows you to resume execution in debug
||>
1 points
QUESTION 6
1. True or False: a concrete class that implements a marker interface will not need to override any methods
True
False
1 points
QUESTION 7
1. In file IO, the term 'output' means that information is input into a file from a program
True
False
1 points
QUESTION 8
1. True or False: a lambda expression can only be used with a class that contains a single method
True
False
1 points
QUESTION 9
1. Assume each of the following classes are correctly defined in appropriately-
named files in the same package:
public class MySuperClass {
private int x;
public int getX(){return x;}
public void setX(int x){this.x = x;}
public int getTwiceAsMuch(){return 2*x;}
}
public class MySubClass extends MySuperClass {
public MySubClass(){setX(2);}
// …assume other subclass methods go here
}
public class TestSubClass {
public static void main (String[] args){
MySubClass msc = new MySubClass();
int Y = getX()/2;