1/61
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
This type of method does not return a value.
a. null
b. void
c. empty
d. anonymous
b. void
This appears at the beginning of a method definition.
a. semicolon
b. parenthesis
c. body
d. header
d. header
The body of a method is enclosed in ______________.
a. curly braces { }
b. square brackets [ ]
c. parenthesis ( )
d. quotation marks " "
a. curly braces { }
A method header can contain ___________.
a. method modifiers
b. the method return type
c. the method name
d. a list of parameter declarations
e. all of these
f. none of these
e. all of these
A value that is passed into a method when it is called is known as a(n) ___________.
a. parameter
b. argument
c. signal
d. return value
b. argument
A variable that receives a value that is passed into a method is known as a(n) ___________.
a. parameter
b. argument
c. signal
d. return value
a. parameter
This statement causes a method to end and sends a value back to the statement that called the method.
a. end
b. send
c. exit
d. return
d. return
T/F You terminate a method header with a semicolon.
False
T/F When passing an argument to a method, Java will automatically perform a widening conversion (convert the argument to a higher-ranking data type), if necessary.
True
T/F When passing an argument to a method, Java will automatically perform a narrowing conversion (convert the argument to a lower-ranking data type), if necessary.
False
T/F A parameter variable's scope is the entire program that contains the method in which the parameter is declared.
False
T/F When code in a method changes the value of a parameter, it also changes the value of the argument that was passed into the parameter.
False
T/F When an object, such as a String, is passed as an argument, it is actually a reference to the object that is passed.
True
T/F The contents of a String object cannot be changed.
True
T/F When passing multiple arguments to a method, the order in which the arguments are passed is not important.
False
T/F No two methods in the same program can have a local variable with the same name.
False
T/F It is possible for one method to access a local variable that is declared in another method.
False
T/F You must have a return statement in a value-returning method.
True
This is a collection of programming statements that specify the fields and methods that a particular type of object may have.
a. class
b. method
c. parameter
d. instance
a. class
A class is analogous to a(n) ____________.
a. house
b. blueprint
c. drafting table
d. architect
b. blueprint
An object is a(n) _______________.
a. blueprint
b. primitive data type
c. variable
d. instance of a class
d. instance of a class
This is a class member that holds data.
a. method
b. instance
c. field
d. constructor
c. field
This key word causes an object to be created in memory.
a. create
b. new
c. object
d. construct
b. new
This is a method that gets a value from a class's field, but does not change it.
a. accessor
b. constructor
c. void
d. mutator
a. accessor
This is a method that stores a value in a field or in some other way changes the value of a field.
a. accessor
b. constructor
c. void
d. mutator
d. mutator
When the value of an item is dependent on other data, and that item is not updated when the other data is changed, what has the value become?
a. bitter
b. stale
c. asynchronous
d. moldy
b. stale
This is a method that is automatically called when an instance of a class is created.
a. accessor
b. constructor
c. void
d. mutator
b. constructor
When a local variable has the same name as a field, the local variable's name does this to the field's name.
a. shadows
b. complements
c. deletes
d. merges with
a. shadows
This is automatically provided for a class if you do not write one yourself.
a. accessor method
b. default instance
c. default constructor
d. variable declaration
c. default constructor
Two or more methods in a class may have same name, as long as this is different.
a. their return values
b. their access specifier
c. their parameter lists
d. their memory address
c. their parameter lists
The process of matching a method call with the correct method is known as __________.
a. matching
b. binding
c. linking
d. connecting
b. binding
A class's responsibilities are ____________.
a. the objects created from the class
b. things the class knows
c. actions the class performs
d. both b and c
d. both b and c
T/F The new operator creates an instance of a class.
True
T/F Each instance of a class has its own set of instance fields.
True
T/F When you write a constructor for a class, it still has the default constructor that Java automatically provides.
False
T/F A class may not have more than one constructor.
False
T/F To find the classes needed for an object-oriented application, you identify all of the verbs in a description of the problem domain.
False
In an array declaration, this indicates the number of elements that the array will have.
a. subscript
b. size declaration
c. element sum
d. reference variable
b. size declaration
Each element of an array is accessed by a number known as a(n) _____________.
a. subscript
b. size declaration
c. address
d. specifier
a. subscript
The first subscript in an array is always ___________.
a. 1
b. 0
c. -1
d. 1 less than the number of elements
b. 0
The last subscript in an array is always ___________.
a. 100
b. 0
c. -1
d. 1 less than the number of elements
d. 1 less than the number of elements
Array bounds checking happens __________.
a. when the program is compiled
b. when the program is saved
c. when the program runs
d. when the program is loaded into memory
c. when the program runs
This array field holds the number of elements that the array has.
a. size
b. elements
c. length
d. width
c. length
To insert an item at a specific location in an ArrayList object, you use this method.
a. store
b. insert
c. add
d. get
c. add
To delete an item from an ArrayList object, you use this method.
a. remove
b. delete
c. erase
d. get
a. remove
To determine the number of items stored in an ArrayList object, you use this method.
a. size
b. capacity
c. items
d. length
a. size
T/F Java does not allow a statement to use a subscript that is outside the range of valid subscripts for an array.
True
T/F an array's size declarator can be a negative integer expression.
False
T/F both of the following declarations are legal and equivalent:
int[] numbers;
int numbers[];
True
T/F the subscript of the last element in a single-dimensional array is one less than the total number of elements in the array
True
T/F the values in an initialization list are stored in the array in the order that they appear in the list.
True
T/F the java compiler does not display an error message when it processes a statement that uses an invalid subscript.
True
T/F when an array is passed to a method, the method has access to the original array.
True
T/F an ArrayList automatically expands in size to accommodate the items stored in it.
True
This type of method cannot access any non-static member variables in its own class.
a. instance
b. void
c. static
d. non-static
c. static
When an object is passed as an argument to a method, this is actually passed.
a. a copy of the object
b. the name of the object
c. a reference to the object
d. none of these; you cannot pass an object
c. a reference to the object
If you write this method for a class, Java will automatically call it any time you concatenate an object of the class with a string.
a. toString
b. plusString
c. stringConvert
d. concatString
a. toString
Making an instance of one class a field in another class is called __________.
a. nesting
b. class fielding
c. aggregation
d. concatenation
c. aggregation
T/F A static member method may refer to non-static member variables of the same class, but only after an instance of the class has been defined.
False
T/F All static member variables are initialized to -1 by default.
False
T/F When an object is passed as an argument to a method, the method can access the argument.
True
T/F A method cannot return a reference to an object.
False