Intro to Java Programming Chapter 2
In Java, a comment on a line begins with which characters? A. '' B. // C. () D. " "
//
Assume the class Circle has an accessor called getRadius and a mutator called setRadius. What is the output of the following code? Circle c1 = new Circle(3); Circle c2 = c1; c1.setRadius(4); System.out.println(c2.getRadius()); A. 4 B. 3 C. 6 D. 8
4
What is the purpose of a test program? A. The test program confirms that the Java compiler is correct. B. The test program verifies that methods have been implemented correctly. C. The test program checks the syntax of each object's methods. D. The test program enforces that the types between arguments match correctly.
The test program verifies that methods have been implemented correctly.
What terminology describes a method that returns information about an object and does not change the object's internal data? A. mutator B. accessor C. void D. public
accessor
Input to a method, enclosed in parentheses after the method name, is known as ______________. A. implicit parameters B. interfaces C. arguments D. return values
arguments
In Java, objects within the same class share common ___________ ? A. behavior B. data C. instructions D. comments
behavior
The type of an object is given by its ______ ? A. variable B. method C. reference D. class
class
What term is used to refer to text in a program that is an explanation for human readers of the code? A. methods B. comments C. constants D. [* and *]
comments
What is the name of the type that denotes floating-point numbers that can have fractional parts? A. double B. floatingPoint C. int D. integer
double
What is the name of the type that denotes whole numbers? A. double B. int C. whole D. integer
int
By convention among Java programmers, variables begin with a(n) _____________. A. uppercase letter B. digit C. lowercase letter D. dollar sign
lowercase letter
What terminology describes a method of an object that modifies that object's internal data? A. public B. void C. mutator D. accessor
mutator
Which operator constructs object instances? A. new B. instanceof C. void D. construct
new
What do object variables store? A. objects B. classes C. object references D. numbers
object references
The "building blocks" that Java programmers use to write computer programs are called _______. A. windows B. objects C. internal data D. entities
objects
Which is not a method of the String class? A. length B. toUpperCase C. toLowerCase D. println
println
The value calculated by a method is called its _____ value. A. implicit B. explicit C. argument D. return
return
What is the purpose of the assignment operator? A. to check for inequality B. to check for identity C. to check for equality D. to change the value of a variable
to change the value of a variable
By convention among Java programmers, class names begin with a(n) _____________. A. lowercase letter B. dollar sign C. digit D. uppercase letter
uppercase letter
The camel case naming convention uses _________ at intervals in the middle of the variable name. A. uppercase letters B. digits C. dollar signs D. the underscore character
uppercase letters
What is a storage location in the computer's memory called that has a type, name, and contents? A. identifier B. literal C. label D. variable
variable