Miscelaneous
Arrays and ArrayLists
Strings and Substrings
OOP Concepts
Loops/Conditionals
100

This term is used for inheritance from super class.

What is extends?

100

Given int[] arr = {3, 5, 4, 7, 8, 9}, what value is in arr[arr.length/2]?

What is 7?

100

This kind of string, immutable and defined in code, is delimited by double-quotes (e.g. "Hello")

What is a string literal?

100
When a method name has more than one body defined, differentiated by unique lists of parameters, they are called this.
What is overloaded method?
100

int x = 1; 
  while (x != 100)   
      x*=2;
System.out.println(x);

This is the the result of the executing the code above.

What is an infinite loop?
200
These comments define the expected state of an object after a method's execution.
What are postconditions?
200

This is the primary reason one would use an ArrayList over an Array.

What is dynamic resizing? (Or the ability to add elements/remove elements/change size/etc.)

200

"abcdefgh".substring(2, 4)

What is "cd"?

200

When a subclass has a method with the same name and inputs as the superclass, we can say that this method has _________ the superclass method.

Overridden

200
The number of times the following nested loop structure will execute the inner most statement (x++)

for(int j = 0; j <= 100; j += 2)
	for(int k = 100; k > 0; k--)
	   x++;
What is 5100?
300

The set of classes that are thrown as error messages.

What are Exceptions?

300

To get the number of elements in an array, you use ____; to get the number of elements in an ArrayList you use ____. (Make sure to include parentheses where necessary)

What are "length" and "size()"?

300
"Hello".length() % 4 - 2*"Hello".indexOf("l")
What is -3?
300
To use an object, you must do these two things.
What are Declare and Instantiate?
300

if (num > 0)
    if (num < 10)
        System.out.println("AAA");
else
        System.out.println("BBB");

This is printed after executing the code above if num = 20.

What is BBB?

400

The binary number corresponding to 19 (decimal)

What is 10011?

400

The reason that the declaration

ArrayList<int> list; 

will not compile.


What is the use of int instead of Integer?

400
The result of the line System.out.print("ABC" + 2*5 - 2);
What is error?
400
A cat ____ an animal, A cat ____ a color
What are Is-a and Has-a?
400
Given the method, what is returned if we call it with x = 10.

  public boolean mystery(int x){
      if (x == 0) 
            return true; 
      else if (x < 0)  
            return false; 
      else 
            return mystery(x - 2);
  }
What is true?
500

Consider the following method that is intended to return true with probability prob and false with probability 1. - prob. 

//precondition: 0.0<=prob<=1.0

public boolean chance(double prob)

{ //statement}

Replace //statement with a single line so that the method works. Hint: use Math.random().

What is return Math.random() < prob?

500

Given

ArrayList<String> list = new ArrayList<>();

list.add("A");

list.add("B);

list.add("C");

list.add(0,"D");

This is what

System.out.println(list.remove(list.size()%3));

will print.

What is A?

500
"adbcefg".substring(1, 3 * "abcd".indexOf("acbcd".substring(2)) + 1)
What is "dbc"?
500
This describes the concept of combining data and methods into one object, such that the data can only be accessed through the methods.
What is Encapsulation?
500

Given the method, what is returned if we call it with value = 4.


  public int method(int value){
      if (value < 1) 
            return 0; 
      else 
            return 1 + method(value-1) + method(value-2); 
  }

 What is 7?

M
e
n
u