Object Oriented Programming
Class Design and Structure
Arrays and Algorithms
Conditions and Logic
Two-Dimensional Arrays
ArrayLists and String Methods
100

Java syntax requires most statements to end with what symbol?

What is a semicolon? (;)

100

What is the purpose of a constructor in a Java class?

What is to initialize objects of that class?

100

What is the index of the last element in an array of size n?

What is n-1?

100

What logical operator is used to test if two conditions are both true in Java?

What is && (AND)?

100

How do you declare a two-dimensional array of integers with 3 rows and 4 columns in Java?

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

100

What does the method list.size() return for an ArrayList?

What is the number of elements in the ArrayList?

200

In object-oriented programming, what do we call the blueprint that defines the structure and behaviors (methods) of objects?What is a class?

What is a class?

200

In the following code snippet, what will the getName() method return?

What is the name of the student passed to the constructor?

200

How do you declare an array of integers in Java with a length of 5?

What is int[] arr = new int[5];?

200

Which Java keyword is used to create a block of code that will execute if a condition is true?

What is if?

200

What is the name for traversing a two dimensional array "column by column" instead of "row by row"?

What is column-major order?

200

What method would you use to add an element to an ArrayList?

What is add()?

300

What keyword is used to create a new instance of a class in Java?

What is new?

300

What is the name of the first line of the constructor which includes the public keyword, the constructor name, and the values to specify when an object is created?

What is the constructor signature?

300

What is the default value of an integer element in a newly created array of integers in Java?

What is 0?

300

This notation is used to check if two values are NOT equal

What is != ?

300

How do you access the element in the second row and third column of a 2D array arr?

What is arr[1][2]?

300

How do you declare an ArrayList of Strings in Java?

What is ArrayList<String> list = new ArrayList<>();?

400

Which principle of OOP allows a subclass to inherit fields and methods from a superclass?

What is inheritance?

400

In Java, what is the difference between public and private access modifiers?

What is public allows access from anywhere, while private restricts access to within the same class?

400

How would you access the third element in a 1D array called arr?

What is arr[2]?

400

If you use the == comparison operator on two objects,what is being compared?

What are the locations in memory of the two objects?

400

Given the following 2D array, write a loop to print each element:


int[][] matrix = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

400

How do you remove the element at index 3 in an ArrayList called list?

What is list.remove(3)?

500

What is the term for a method in a subclass that overrides a method in its superclass?

What is method overriding?

500

What is the purpose of the this keyword in a constructor?

What is to refer to the current object's instance variable (i.e., differentiating instance variables from parameters)?

500

This type of loop is best used when you will need to traverse every element in an array

What is an enhanced for loop?

500

How would you write a condition to check if a variable x is greater than 5 and less than 10 in a single statement?

What is if (x > 5 && x < 10)?

500

The output of arr.length, where "arr" is a 2D array with 4 rows and 5 columns

What is 4?

500

How can you retrieve only the third character of a string called myString? (assume myString is at least four characters long)

What is myString.substring(2, 3);