Which of the following is not a primitive type?
int
double
String
boolean
char
What is String?
The value of a after the code runs
int a = 5 * 3.2
What is 15?
The following are valid arrays
I. int[] coolArray = {1, 2, 3};
II. int[] threeThings = {1.0, 2.0, 3.0};
III. int[] = {"1", "2", "3"};
I only
II only
III only
I and II
I and III
What is 1, I only?
This is the definition of recursion
What is a method which calls upon itself?
The difference between == and .equals()?
What is == compares memory addresses of objects and equals() compares the values of objects
The proper syntax to declare and initialize a variable called temperature to have the value 70.4
1. int temperature = 70.4;
2. double temperature = 70.4;
3. temperature = 70.4;
4. dbl temperature = 70.4;
5. temperature = (double) 70.4
What is double temperature = 70.4;?
The value of x after the code runs
int x = 12 % 5;
What is 2?
The problem in the following code
ArrayList<int> list = new ArrayList<int>();
list.add(1);
System.out.println(list.get(0));
It will throw an IndexOutOfBoundsException.
You cannot use int as the type in an ArrayList.
list is a reserved word, so you can’t call the variable that.
You need to define the new ArrayList on a new line of code.
Nothing. The above code is correct.
What is 2, You cannot use int as the type in an ArrayList?
ONE type of sorting method that can be made using recursion
What is merge sort, bubble sort, or quick sort?
The purpose of final keyword
What is Final can be used with variables, methods, and classes?
The output that will be produced by
System.out.println("Hello");
System.out.println("Karel");
1. Hello Karel
2. HelloKarel
3. Hello
Karel
4. Error
What is 3, Hello
Karel
This is printed after the code runs
Double a = 2.5;
int b = 10;
System.out.print(a*b);
What is 25.0?
You cannot use int as the type in an arraylist
What the following code will print
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(0);
list.add(1);
list.add(2);
list.add(3);
list.add(4);
list.add(5);
int sum = 0;
for (int i = 0; i < list.size(); i+= 2)
{
sum += list.get(i);
}
System.out.println(sum);
0
5
6
9
15
What is 6?
The two searching methods we learned to make with recursion
What is binary and linear search?
The thing that occurs when you override a private method
What is nothing, private methods cannot be overridden because they are not visible to subclasses.
Joe’s Pizza is creating a program that will calculate the total amount of money an employee earns each week. Employees are paid by the hour and only work in 1 hour increments. Salaries start at minimum wage, but employees get a $0.50 raise after the first month. The variables that would be the best to store the hours and salary of the employees
1. double hours
int salary
2. int hours
double salary
3. boolean hours
double salary
4. int hours
int salary
5. double hours
boolean salary
What is 2, int hours double salary
This is the value of x after the code runs
double x = 5 + 8 * 9 / 10;
What is 12?
Consider the following statement:
ArrayList<String> newList = /* Missing Code */
The following that can be replaced with /* Missing Code */ so that the statement works as intended
I.
new ArrayList<String>;
II.
new ArrayList();
III.
new ArrayList<String>();
I only
III only
I and III
II and III
I, II, and III
What is 4, II and III?
Given this array:
1 2 4 5 6 7 8 12 14 21 22 42 53
The amount of comparisons that are required to find 42 using the Binary Search
What is 2?
The definition of a parameter
The value that a method returns.
The formal names given to the data that gets passed into a method.
The values that a method prints to the screen.
The type that is given to a variable
What is 2, The formal names given to the data that gets passed into a method?
The following that prints:
Hello Java!
I.
System.out.println("Hello Java!");
II.
System.out.print("Hello Java!");
III.
System.out.print("Hello");
System.out.print("Java!");
IV.
System.out.println("Hello");
System.out.println("Java!");
I and II only
I, II, and III only
I and III only
I, II, and IV only
I, II, III, and IV
What is 1, I and II only?
This is printed after the code runs
System.out.print(67%(5-3.5)*5/4);
What is 1.25?
Consider the following code segment:
int[][] nums = new int[5][5];
for(int i = 0; i< nums.length; i++)
{
for(int j = 0; j< nums[0].length; j++)
{
nums[i][j] = i + j;
}
}
The amount of instances of the number 5 that will be stored in this 2D array?=
4
5
3
1
0
What is 4?
The approach that MergeSort uses?
What is divide and conquer?
Melissa will only drink a cup of coffee if she has slept less than 8 hours or she had to wake up before 6 am.
The following cases in which Melissa does not drink a cup of coffee
Melissa sleeps for 8 hours and wakes up at 7 am
Melissa sleeps for 7 hours and wakes up at 8 am
Melissa sleeps for 9 hours and wakes up at 5:30 am
Melissa sleeps for 7 hours and wakes up at 6 am
What is 1, Melissa sleeps for 8 hours and wakes up at 7 am?