In Java, what is the outer index value on the first iteration of the outer loop when running a nested iteration statement?
what is "Zero."
How do you add 1 to the index each time the loop is run.
What is "i++"
A _________________________ is an error caused by a grammatical error in the code, stopped by the compiler
What is "a syntax error?"
Which method would you use to find the length of a string?
what is "len()"
In Java, how do you declare a 2D array of integers named matrix?
what is "declare it with two sets of square brackets."
this kind of loop executes as long as the condition is met.
What is a "While" loop
A _________________________ is an error caused by a program trying to make to computer do something it cannot, such as dividing by zero.
What is "a run time error?"
Which method would you use to replace all occurrences of "cat" with "dog" in a string?
what is "replace()"
In Java, how do you access the value 6 in a 2D array?
using this code
int[][] arr = {{1, 2, 3}, {4, 5, 6}}; // Accessing the value 6 int value = arr[1][2]; System.out.println("The value is: " + value);
What is "access it using row 1, column 2."
This keyword ends a loop no matter if the condition is met or not.
what is a "Break" keyword
A ________________________ is an error when the program functions but does not give the desired output.
What is "a logic error?"
returns the string value converted to uppercase?
What is "toUpperCase()"
In Java, how do you modify the element in the third row and third column of a 2D array to 100.5?
What is "set the value at row 2, column 2 to 100.5."
This loop executes one loop for a specific number of times.
What is a "For" loop
A ___________/____________ can be used to handle exceptions.
What is "a try/catch statement"
returns the string value converted to lowercase?
what is "toLowerCase()"
In Java, how do you write a nested loop to traverse a 2D array in column-major order?
What is "use a loop for columns on the outside and a loop for rows on the inside."
This loop makes sure at least one execution of the loop body before checking the condition.
What is a "Do-While" loop.
This code should print out multiples of two between 1 and 100, what is wrong?
public class Main{
public static void main(String[] args){
for(int i = 2; i <= 100; i++){
System.out.println(i);
}
}
}
What is "Change the i ++ to i = i + 2"
This method concatenates one string to the end of another string?
what is "concat()"