ITSC 1213 EXAM #2 QUESTIONS AND CORRECT
ANSWERS
E - Answers - A Java class...
A. May inherit from only one superclass
B. May implement only one interface.
C. May implement multiple interfaces.
D. A and B
E. A and C
D - Answers - What is contained in an interface?
A. Methods
B. Constants
C. Constructors
D. A and B
E. A and C
F. All of the above
C - Answers - Provide an implementation for each method declaration when a class
does what?
A. Define a variable for each constant
B. Redefine each constant
C. Provide an implementation for each method declaration
D. All of the above
A - Answers - Which access specifiers can be used in an interface?
A. Public
B. Private
C. Protected
D. All of the above
False - Answers - Exceptions cause programs to fail to compile. (T/F)
A - Answers - Which of the following surrounds code that may throw an exception?
A. Try {...}
B. Catch {...}
C. Throw {...}
D. If {...}
B - Answers - What statement would cause a catch-block to execute?
A. Exception e = new Exception("my exception");
B. throws new Exception("my exception");
C. try new Exception("my exception");
ANSWERS
E - Answers - A Java class...
A. May inherit from only one superclass
B. May implement only one interface.
C. May implement multiple interfaces.
D. A and B
E. A and C
D - Answers - What is contained in an interface?
A. Methods
B. Constants
C. Constructors
D. A and B
E. A and C
F. All of the above
C - Answers - Provide an implementation for each method declaration when a class
does what?
A. Define a variable for each constant
B. Redefine each constant
C. Provide an implementation for each method declaration
D. All of the above
A - Answers - Which access specifiers can be used in an interface?
A. Public
B. Private
C. Protected
D. All of the above
False - Answers - Exceptions cause programs to fail to compile. (T/F)
A - Answers - Which of the following surrounds code that may throw an exception?
A. Try {...}
B. Catch {...}
C. Throw {...}
D. If {...}
B - Answers - What statement would cause a catch-block to execute?
A. Exception e = new Exception("my exception");
B. throws new Exception("my exception");
C. try new Exception("my exception");