Primitive Types
Math
Arrays
Recursion
Misc
100


Which of the following is not a primitive type?


  1. int

  2. double

  3. String

  4. boolean

  5. char

What is String?

100

The value of a after the code runs

int a = 5 * 3.2

What is 15?

100

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"};


  1. I only

  2. II only

  3. III only

  4. I and II

  5. I and III

What is 1, I only?

100

This is the definition of recursion

What is a method which calls upon itself?



100

The difference between == and .equals()?

What is == compares memory addresses of objects  and equals() compares the values of objects

200

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;?

200

The value of x after the code runs

int x = 12 % 5;

What is 2?

200

The problem in the following code

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

list.add(1);

System.out.println(list.get(0));


  1. It will throw an IndexOutOfBoundsException.

  2. You cannot use int as the type in an ArrayList.

  3. list is a reserved word, so you can’t call the variable that.

  4. You need to define the new ArrayList on a new line of code.

  5. Nothing. The above code is correct.

What is 2, You cannot use int as the type in an ArrayList?

200

ONE type of sorting method that can be made using recursion

What is merge sort, bubble sort, or quick sort?



200

The purpose of final keyword

What is Final can be used with variables, methods, and classes?


300


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

            


300

This is printed after the code runs

Double a = 2.5;

int b = 10;

System.out.print(a*b);

What is 25.0?

300

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?

300

The two searching methods we learned to make with recursion

What is binary and linear search?



300

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.

400

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

400

This is the value of x after the code runs

double x = 5 + 8 * 9 / 10;

What is 12?

400

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>();

  1. I only


  1. III only

  2. I and III


  1. II and III

  2. I, II, and III

What is 4, II and III?

400

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?

400

The definition of a parameter


  1. The value that a method returns.


  1. The formal names given to the data that gets passed into a method.



  1. The values that a method prints to the screen.



  1. The type that is given to a variable


What is 2, The formal names given to the data that gets passed into a method?

500

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!");


  1. I and II only

  2. I, II, and III only

  3. I and III only

  4. I, II, and IV only

  5. I, II, III, and IV



What is 1, I and II only?

500

This is printed after the code runs

System.out.print(67%(5-3.5)*5/4);


What is 1.25?

500

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?

500

The approach that MergeSort uses?

What is divide and conquer?

500

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

  1. Melissa sleeps for 8 hours and wakes up at 7 am

  1. Melissa sleeps for 7 hours and wakes up at 8 am

  2. Melissa sleeps for 9 hours and wakes up at 5:30 am

  3. 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?



M
e
n
u