COP 3330 Exam 1 Graded A+
A secondary path of execution when an "if" clause evaluates to false - ANSWER-An
if/else provides what?
Access level modifier - ANSWER-Given the class definition
public class KeyTerminology{}
what is "public" called?
An operator - ANSWER-instanceof is __________.
Anywhere in the body of the method - ANSWER-If a method is declared with a return
type other than void, where in the method bocy is the data returned?
class
void
primitive data type (e.g. int, float, boolean)
interface
a subclass of the specified class return type - ANSWER-Regarding the return type of a
method, which of the following would be valid?
class body - ANSWER-What is the area in a class called that is surrounded by
open/close curly braces?
class variables - ANSWER-Static fields in a class are also know as __________.
Concatenation
Addition - ANSWER-The + (plus sign) has two purposes in the Java programming
languages, select the two that are correct.
) Division
) Modulus
) Subtraction
) Concatenation
) Multiplication
) Addition
Constructor - ANSWER-In the following statement, Dog puppy = new Dog();, what is
"Dog()" called?
Control jumps to the end of the if statement - ANSWER-If the condition being evaluated
in the source code below evaluates false, what happens?
if(age >= 18)
, System.out.println("You are old enough to vote! Please register to vote, elections are
this
year!");
controller - ANSWER-Which of the following is NOT one of the three expressions of the
for statement?
data type
variable name
access modifier - ANSWER-What are the three components to declare a variable?
default methods
static methods
constants
nested types
method signatures - ANSWER-Interfaces can contain only:
Defining a method - ANSWER-Parameters are used when?
Defining what the method should do when implemented - ANSWER-Which of the
following is NOT a benefit of default methods in an interface?
Defining what the method should do when implemented
Specify the method definition in an interface is a default method with the default
keyword at the beginning of the method signature
Allows for binary compatibility with code written for older versions of those interfaces
Adding new functionality to the existing interfaces
Dog puppy = new Dog(); - ANSWER-Which of the following is the correct code for
instantiating an instance of class Dog?
encounters a continue statement - ANSWER-Regarding methods of classes, which of
the following is NOT one of the the three ways a method returns to the code that
invoked it?
enhanced for - ANSWER-What is the looping statement below referred to as?
int[] numbers = {1,2,3,4,5,6,7,8,9,10};
for (int item : numbers)
{
A secondary path of execution when an "if" clause evaluates to false - ANSWER-An
if/else provides what?
Access level modifier - ANSWER-Given the class definition
public class KeyTerminology{}
what is "public" called?
An operator - ANSWER-instanceof is __________.
Anywhere in the body of the method - ANSWER-If a method is declared with a return
type other than void, where in the method bocy is the data returned?
class
void
primitive data type (e.g. int, float, boolean)
interface
a subclass of the specified class return type - ANSWER-Regarding the return type of a
method, which of the following would be valid?
class body - ANSWER-What is the area in a class called that is surrounded by
open/close curly braces?
class variables - ANSWER-Static fields in a class are also know as __________.
Concatenation
Addition - ANSWER-The + (plus sign) has two purposes in the Java programming
languages, select the two that are correct.
) Division
) Modulus
) Subtraction
) Concatenation
) Multiplication
) Addition
Constructor - ANSWER-In the following statement, Dog puppy = new Dog();, what is
"Dog()" called?
Control jumps to the end of the if statement - ANSWER-If the condition being evaluated
in the source code below evaluates false, what happens?
if(age >= 18)
, System.out.println("You are old enough to vote! Please register to vote, elections are
this
year!");
controller - ANSWER-Which of the following is NOT one of the three expressions of the
for statement?
data type
variable name
access modifier - ANSWER-What are the three components to declare a variable?
default methods
static methods
constants
nested types
method signatures - ANSWER-Interfaces can contain only:
Defining a method - ANSWER-Parameters are used when?
Defining what the method should do when implemented - ANSWER-Which of the
following is NOT a benefit of default methods in an interface?
Defining what the method should do when implemented
Specify the method definition in an interface is a default method with the default
keyword at the beginning of the method signature
Allows for binary compatibility with code written for older versions of those interfaces
Adding new functionality to the existing interfaces
Dog puppy = new Dog(); - ANSWER-Which of the following is the correct code for
instantiating an instance of class Dog?
encounters a continue statement - ANSWER-Regarding methods of classes, which of
the following is NOT one of the the three ways a method returns to the code that
invoked it?
enhanced for - ANSWER-What is the looping statement below referred to as?
int[] numbers = {1,2,3,4,5,6,7,8,9,10};
for (int item : numbers)
{