You Down With OOP?
Keep It Classy
Hip Hip Array!
If Only...
Enter the Matrix
100

This is how you create an object from a class in Java.

What is using the new keyword?

100

This keyword is used to create a blueprint for an object.

What is class?

100

This type of loop is best suited for traversing an array when the size is known.

What is a for loop?

100

This Java keyword is used to execute code only when a condition evaluates to true.

What is if?

100

This is the syntax to declare a 2D array in Java with 3 rows and 4 columns.

What is int[][] arr = new int[3][4];?

200

This loop repeatedly executes a block of code as long as its condition remains true.

What is a while loop?

200

 In Java, this special method is used to initialize an object when it is created.

What is a constructor?
200

This is the syntax to declare and initialize an array of integers in Java with values 1, 2, and 3.

What is int[] arr = {1, 2, 3};? (answer must include {curly brackets})

200

This operator combines two conditions and evaluates to true only if both are true.

What is &&?

200

The row and column indices of the top-left corner of a 2D array.

What are [0][0]?

300

This feature of object-oriented programming allows you to reuse code by deriving new classes from existing ones.

What is inheritance?

300

This type of method belongs to the class rather than any object instance.

What is a static method?

300

This is the syntax for an enhanced for loop to iterate over an integer array arr.

What is for (int num : arr)?

300

The keyword used to specify an alternative block of code if the condition in an if statement is false.

What is else?

300

This is the output of arr[1][2] for a 2D array arr = {{1,2,3}, {4,5,6}, {7,8,9}}.

What is 6?

400

This principle of OOP involves breaking down a complex problem or system into smaller, more manageable parts.

What is decomposition?

400

These are the components of a class that define the behavior and characteristics of its objects.

What are fields and methods?

400

Write a method named findSum that takes an array of integers as input and returns the sum of all the elements in the array.

public static int findSum(int[] arr) {

    int sum = 0;

    for (int num : arr) {

        sum += num;

    }

    return sum;

}

400

This logical law states that the negation of a conjunction is equivalent to the disjunction of the negations, and vice versa.

What is DeMorgan's Law?

400

This loop structure is commonly used to iterate through all elements of a 2D array.

What are nested for loops?

500

These three programming constructs allow you to write algorithms in Java effectively.

What are sequencing, selection, and iteration?

500

This keyword is used in a subclass to call a constructor or method from its superclass, ensuring proper initialization or reuse of inherited behavior.

What is super?

500

Write a method named reverseArray that takes an array of integers as input and returns a new array containing the elements in reverse order.

public static int[] reverseArray(int[] arr) {

    int[] reversed = new int[arr.length];

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

        reversed[i] = arr[arr.length - 1 - i];

    }

    return reversed;

}

500

This is the value of the expression (true || false) && false

What is false?

500

The term for when you traverse a 2D array diagonally from the top-left to the bottom-right.

What is diagonal traversal?