Chapter 3
(Objects & Classes)
Chapter 4
(Conditionals)
Chapter 7
(Arrays)
Fix this Code
100

The code used to get the next integer input from the user.

What is a "scan.nextInt();"?

100

This logical operator is used to check if two values are not equal.

What is a "!="?

100

An ordered list of values.

What is an Array?

100

Random = Random(); // seed nanoTime
int valInt = 0;
double valDbl = 0.0;

Random rand = new Random(); // seed nanoTime
int valInt = 0;
double valDbl = 0.0;

200

This holds the address for an object.

What is a reference?

200

This truth table defines the operator


T T - T
T F - T
F T - T
F F - F

What is a "||" or "or"?

200

It is used to process an array in a decreasing or increasing order.

What is a loop?

200

while (int count=1; count <= 5; count++) // condition
{
   System.out.println (count); // body
}

int count = 1; // initialisation
while (count <= 5) // condition
{
   System.out.println (count); // body
   count++; // change
}

300

The method used to find the first occurrence of a String in another String.

What is a ".indexOf(String_to_Find)"?

300

A conditional statement that parses through multiple values of a condition and runs the block of code on the matching one.

What is a switch statement?

300

This is the error that is thrown when the index value being manipulated on is outside 0 to N-1.

What is an ArrayIndexOutOfBoundsException?

300

System.out.printf ("Score %d: %d \n", i, scores(i) );

System.out.printf ("Score %d: %d \n", i, scores[i] );

400

The action of periodically returning the memory allocated to an object back to the system.

What is Garbage Collection?

400

The conditional statement which runs a block of code if the condition is true.

What is an if statement?

400

An example of this type of initialization is:
int[] units = new int[] {147, 323, 89, 933, 540, 269, 97, 114, 298, 476};

What is an Initializer List Initialization/Declaration?

400

if (name1.compareTo(name2) < 0)
   System.out.println(name1 + "comes first");
elseif {
   if (name1.compareTo(name2) == 0)
      System.out.println("Same name");
   elseif
      System.out.println(name2 + "comes first");
}

if (name1.compareTo(name2) < 0)
   System.out.println(name1 + "comes first");
else {
   if (name1.compareTo(name2) == 0)
      System.out.println("Same name");
   else
      System.out.println(name2 + "comes first");
}

500

The term used to refer to a String for not being able to make change its data.

What is Immutable?

500

A programming construct that allows a block of code to be executed repeatedly until a certain condition is met or it has executed a set number of time.

What is a For Loop?

500

The concept of tracking common data across more than one array, in order to store more than one data type.

What are Parallel Arrays?

500

for (int i=0; i<scores.length-1; i++) // traditional loop
System.out.println ( scores[i] );

for (int i=0; i<scores.length; i++) // traditional loop
System.out.println ( scores[i] );