The data type that holds true/false values
What is a boolean?
The name for the technique used to branch code into two or more different paths based on some condition.
What is an if-statement?
This special method is automatically called when a new object is created to initialize its attributes.
What is a constructor?
This basic search checks each element in the data structure one by one to check for a match.
What is Linear Search?
Given the following code, this is printed:
int x = 3;
int y = 4;
System.out.println(x + y * 2);
What is 11?
The data type in Java that holds uppercase A when you set it to 65.
What is a char?
This keyword is used to exit a loop prematurely, regardless of the loop's condition.
What is break?
This keyword refers to the current instance of a class and is used to access its attributes and methods.
(Especially when two attributes have the same name)
What is this?
This simple sorting algorithm repeatedly steps through a list, compares adjacent elements and swaps them if they are in the wrong order.
What is Bubble Sort?
Given the following code, this is printed:
int sum = 0;
for (int i = 1; i <= 3; i++) {
sum += i;
}
System.out.println(sum);
What is 6?
User-created variable-types are also called this.
What is a Class/Object?
This type of loop guarantees the code inside it runs at least once before checking its condition.
What is a do-while loop?
This keyword is used to keep certain attributes of a class invisible to classes outside of the one which it is defined.
What is private?
This searching algorithm efficiently finds an item in a sorted list by repeatedly dividing the search interval in half.
What is Binary Search?
Given the code, this is the output:
int a = 5;
int b = 2;
int temp = a;
a = b;
b = temp;
System.out.println(a + " " + b);
What is 2 5?
The two ways we have learned to hold multiple members of a single primitive or object type
What are ArrayLists and Arrays
This control flow concept refers to placing one loop or conditional statement inside another to handle more complex logic.
What is nesting?
This type of keyword is used for methods and attributes of a class which belong to the class as a whole rather than any specific instance of it
What is static?
This term describes how the runtime of an algorithm grows with input size and is often expressed using Big-O notation.
What is time-complexity?
Given the code we get the output:
int sum = 0;
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= i; j++) {
sum += j;
}
}
System.out.println(sum);
What is 10?
This variable type that we learned about can hold multiple entries but only of a certain type
What are strings?
This statement skips the remaining code in the current iteration of the loop and proceeds to the next iteration.
What is continue?
This concept refers to restricting direct access to an object's data and requiring the use of methods to modify it.
What is Encapsulation?
This sorting algorithm divides a list into smaller sublists, sorts them, and then combines them back together.
What is Merge Sort?
Given the code, this is the value printed:
public static int mystery(int n) {
if (n == 1) {
return 2;
}
return n + mystery(n - 1);
}
System.out.println(mystery(4));
What is 11?