2D Arrays
Loops
Conditional and Control Flow
String Method
Variables
100

What is a 2D array?

A 2D array, also known as a matrix, is an array of arrays. It can be thought of as a grid or table with rows and columns, where each cell holds an element of the same data type.

100

What is a WHILE statement?

A WHILE statement executes code x number of times until a certain condition is met. 

Ex: while (wishes < 3) {
   wishes++; 

100

What is an if statement?

Executes a block of code when a specified boolean expression is evaluated as true.

100

What is the purpose of string methods and what is an example how to write one?

The purpose of string methods is so programmers are allowed to share words through code and not just instructions of how to do something. 

String str = "Correct!"; 

100

Can Booleans only be True or false?

Yes

200

How do you declare a 2D array in Java?

int[][] matrix = new int[3][4]; // A 2D array with 3 rows and 4 columns

200

What is an increment?

When a counter/iterator is used and you can add an increment that increases or decreases the value. You can use a for loop for this. 

Ex: // counter
int wishes = 0;
while (wishes < 3) {
  System.out.println("Wish granted.");
  //incremented
  wishes++;

200

What is an else statement?

This statement executes a block of code when the if statement is evaluated as false.

200

What does the indexOf method return, what is supposed to be returned in the parentheses and what is returned if there is no found character?

The indexOf returns the first occurrence of a character or substring. In the parentheses the code should return the character that you want the index of and if cannot find a character, a -1 will return in the parentheses

200

What type of variable can’t be changed?

The Final variable  

300

What does modifying a 2D array do?

Modifying a 2D array means changing the values of its elements. This can involve updating, adding, or removing elements at specific positions within the array. Any changes made to a 2D array will affect its structure and the data it contains.

300

What can cause an infinite loop?

When the condition never evaluates to false. 

Ex: Int toys = 10;
while (toys < 11) {
  System.out.println("Not enough toys!"); 

  toys--;

300

What is an OR conditional operator?

This conditional operator is the last operator in the order of evaluation.

300

Why is concat used? And how would you concat these two strings together: 

String s1 = “Join"; 

String s2 = " Code"; 

Concat is used to combine two or more strings into a new one. 

String s3 = s1.concat(s2); 

300

What is it called when you can increase a variable by one?

The increment operator

400

What is the difference between a 2D array and a 2D list?  

A 2D array is a fixed-size data structure that holds elements of the same type in a grid-like format. A 2D list (or list of lists) is a dynamic data structure that can grow or shrink in size and can also hold elements of different types.

400

What is a for loop?

A loop that can simplify the process of incrementation. Contains initialization, a condition, and an increment. 

Ex: for (int i = 0; i < 5; i++) { 

//…

400

What is parentheses?

 Expressions contained within these will be evaluated in the statement before any other expressions.

400

When comparing two or more strings together and don’t want to worry about upper/lower case, what would you put?

You would add a equalsIgnoreCase

400

What is modulo?

Division with the remainder

500

How can you iterate through a 2D array?

for (int i = 0; i < matrix.length; i++) { 

    for (int j = 0; j < matrix[i].length; j++) { 

        System.out.print(matrix[i][j] + " "); 

    } 

    System.out.println(); 

500

What is a For-Each loop?

A loop that can go through each item in a list, performing actions with the elements (for each x : list, do this).  

Ex: for(double expense : expenses){ 

      if(expense > mostExpensive){ 

        mostExpensive = expense; 

      }    } 

500

What is a break?

Unless this keyword is present, all cases in the switch statement will be checked.

500

What does CharAt return? And what will be the result of this code: 

String str = “Today is Friday"; 

System.out.println(str.charAt(0)); 

This returns the number of characters stated in the parentheses.

The results of the code will be "T"

500

What are the primitive datatypes?

int, char, Boolean, byte, long, short, double, float

M
e
n
u