.A class is analogous to a(n) __________.
a. house
b. blueprint
c. strategy
d. table
Front
b. Blueprint
Back
This section of a switch statement is branched to if none of the case expressions match
the switch expression.
a. else
b. default
c. case
d. otherwise
Front
b. Default
Back
To determine the number of items stored in an ArrayList object or a HashMap, you
use this method.
a. size
b. capacity
c. items
d. length
Front
a.Size
Back
This type of expression has a value of either true or false.
a. binary expression
b. conditional expression
c. unconditional expression
d. boolean expression
Front
d.Boolean expression
Back
This type of loop always executes at least once.
a. while
b. do-while
c. for
Front
b.Do-while
Back
.This type of loop has no way of ending and repeats until the program is interrupted or
crashes.
a. indeterminate
b. interminable
c. infinite
d. timeless
Front
c.Infinite
Back
Which Scanner class method would you use to read the following:
a. A string
b. An int
c. A double
Front
a. next line
b. next int
c. next double
Back
.To open a file for writing, you use the following class.
a. PrintWriter
b. FileOpen
c. OutputFile
d. FileReader
Front
a.Printwriter
Back
This statement causes a method to end and sends a value back to the statement that
called the method.
a. end
b. exit
c. return
Front
c.Return
Back
An if statement that appears inside another if statement is called:
a. nested if statement
b. tiered if statement
c. dislodged if statement
d. structured if statement
Front
a. Nested if statement
Back
What kind of comments are the following:
a. // ...
b. / ... /
c. /* ... /
Front
a. single line
b. multi line
c. documentation comments
Back
The if statement is an example of a(n) __________.
a. input structure
b. decision structure
c. looping structure
d. class structure
Front
b. decision structure
Back
.This keyword indicates that a class inherits from another class.
a. Derived
b. specialized
c. Based
d. extends
Front
d.Extends
Back
This is a method that is automatically called when an instance of a class is created.
a. accessor
b. constructor
c. void
d. mutator
Front
b.Constructor
Back
The first index or subscript in an array is always what? Similarly, the last index or
subscript in an array is always what?
Front
always 0
array.length-1
Back
. You can use this class to display dialog boxes.
a. JOptionPane
b. Scene
c. PrimaryStage
Front
a. JOptionPane
Back
.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 the above
f. none of the above
Front
e. All of the above
Back
What are the three sections of a UML class diagram? How are the following class
relationships depicted in UML?
a. Association
b. Aggregation
c. Composition
d. Generalization
Front
aggregation-not filled in diamond
composition-colored in diamond
generalization-triangle
Back
&&, ||, and ! are __________.
a. relational operators
b. logical operators
c. conditional operators
d. ternary operators
Front
b. Logical operators
Back
This is a method that returns a value from a class's field, but does not change it.
a. accessor
b. constructor
c. void
d. mutator
Front
a. Accesor
Back
This determines whether two different String objects contain the same string.
a. the == operator
b. the = operator
c. the equals method
Front
c.Equals method
Back
.Indicate which of the for, while, and do-while loops is a pretest and which is a posttest?
Front
while, for are pretest
do-while is posttest
Back
This is a class member that holds data.
a. method
b. instance
c. attribute
d. constructor
Front
c.Attribute
Back
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
Front
a. Class
Back
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
Front
a.Parameter
Back
This expression is executed by the for loop only once, regardless of the number of
iterations.
a. initialization
b. test
c. update
d. pre-increment
Front
a. Initilization
Back
If you write this method for a class, Java will automatically call it anytime you
concatenate an object of the class with a string.
a. toString
b. plusString
c. stringConvert
Front
a.ToString
Back
The negation operator is __________.
a. unary
b. binary
c. ternary
Front
a. Unary
Back
Indicate which of the following is not a valid assignment statement?
a. num = 9;
b. 177 = amount;
c. amount = 129;
d. letter = "W" ;
Front
b
Back
This is a method that stores a value in a field or changes its value.
a. accessor
b. constructor
c. void
d. mutator
Front
d.Mutator
Back
The = and the == operators perform the same operation.
Front
T
Back
A group of statements, such as those in a class or a method, are enclosed in _________.
a. braces {}
b. parentheses ()
c. brackets []
d. any of the above
Front
a. Braces {}
Back
In an inheritance relationship, the parent class is also called _________ while the
child class is also called ____________.
a. Superclass, subclass
b. Base, derived
c. General, specific
d. All the above
e. None of the above
Front
a.Superclass,subclass
Back
Each element of an array is accessed by a number known as a(n) __________.
a. subscript or index
b. size declarator
c. address
d. specifier
Front
a. Subscript or index
Back
The conditional expression takes how many operands?
Front
3
Back
What will the following statements display?
int x = 5; System.out.println(x++);
Front
5, because of the x++
Back
This array field holds the number of elements that the array has.
a. size
b. elements
c. length
d. length()
Front
c. length
Back
A subclass does not inherit the following from to its superclass members (Select
all that apply)
a. Public members (attributes and methods)
b. Private members
c. Constructors
Front
a. Public members
c. Constructors
Back
>, <, and == are __________.
a. relational operators
b. logical operators
c. conditional operators
d. ternary operators
Front
a. Relational operators
Back
This type of method does not return a value.
a. null
b. void
c. empty
d. Anonymous
Front
b.Void
Back
This keyword causes an object to be created in memory.
a. create
b. New
c. object
d. construct
Front
b.New
Back
. By itself, a semicolon is considered a _________;
a. An empty statement
b. An empty expression
c. An empty operator
Front
a. An empty statement
Back
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
Front
b. Argument
Back
These are automatically provided for a class:
a. toString()
b. default constructor
c. this reference
d. none of the above
e. all of the above
Front
d. none of the above
Back
What is each repetition of a loop known as?
a. cycle
b. revolution
c. orbit
d. iteration
Front
d. Iteration
Back
.To open a file for reading, you use the following classes.
a. File and PrintWriter
b. File and Output
c. File and Input
d. File and Scanner
Front
d.File and scanner
Back
.You can use this method to print formatted output to the console.
a. Format.out.println
b. Console.format
c. System.out.printf
d. System.out.formatted
Front
c. System.out.printf
Back
The data 'G', "Hello World!", and 1.414 are all examples of __________.
a. variables
b. literals
c. strings
d. none of the above
Front
b. Literals
Back
.This class allows you to read a line from a file.
a. FillReader
b. Scanner
c. PrintWriter
d. FileWriter
Front
b.Scanner
Back
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
Front
a.Shadows
Back
Section 2
(25 cards)
When you write a constructor for a class, it still has the default constructor that
Java automatically provides.
Front
F
Back
When code in a method changes the value of an integer parameter, it also
changes the value of the argument that was passed into the parameter.
Front
F
Back
The scope of a variable is limited to the block in which it is defined.
Front
T
Back
All classes in Java inherit directly or indirectly from the Object class
Front
T
Back
Both ArrayLists and HashMaps are dynamic and expand and shrink as needed.
Front
T
Back
Comments that begin with // can be processed by javadoc.
Front
F
Back
A subclass can extends (inherit from) only a single superclass.
Front
T
Back
If one of an operator's operands is a double, and the other operand is an int,
Java will automatically convert the value of the double to an int.
Front
F
Back
When an object, such as a String, is passed as an argument, it is actually a
reference to the object that is passed.
Front
T
Back
You cannot catch the same exception two more than one catch block of the
same try block.
Front
T
Back
Both of the following declarations are legal and equivalent: int[] numbers;
int numbers[];
Front
T
Back
You cannot have a catch block without a try block
Front
T
Back
A class may not have more than one constructor.
Front
F
Back
When an if statement is nested in the if clause of another statement, the only
time the inner if statement is executed is when the boolean expression of the
outer if statement is true. Similarly, when an if statement is nested in the else
clause of another statement, the only time the inner if statement is executed is
when the boolean expression of the outer if statement is false
Front
T
Back
You cannot change the value of a variable whose declaration uses the final
keyword.
Front
T
Back
Only the finally-block on the try-catch-finally is optional.
Front
T
Back
Each instance of a class has its own set of instance fields
Front
T
Back
Variable names may begin with a number.
Front
T
Back
It is not necessary to initialize loop variable.
Front
F
Back
A left brace in a Java program is always followed by a right brace later in the
program
Front
T
Back
When a program is finished using a file, it should close the file.
Front
T
Back
In a nested loop, the inner loop goes through all of its iterations for every
iteration of the outer loop
Front
T
Back
When passing multiple arguments to a method, the order in which the
arguments are passed is not important.