Obscure Vocab
Make it stop!
Random Java
Arrays
Strings
100

Look at the Strings section of the handout.  What term describes the relationship between str1 and str3.

aliases

100

What is the contents of the ArrayList nums after all lines of code have run on the handout?

10, 20, 30, 10

100

A class that converts primitive data types into objects.

Wrapper Class

100

Type out the correct statement that will initialize an array of Strings called "words" with four empty spaces.

String[] words = new String[4];

100

str1.substring(10);

"igh School"

200

What term is used to describe when a class has more than one constructor, each one with a different signature?

Overloading

200

Look at Example 1.  What will print if the initial value of num is 10?

10 20

200

Changing a variable from one type to another

Type Casting

200

What is the result of the following code

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

laundry.add("shirt");
laundry.add("sock");
laundry.add("sock");
laundry.add("sweater");
laundry.add("shorts");
laundry.remove(1);

System.out.print(laundry)

[shirt, sock, sweater, shorts]

200

str2.substring(4,8);

" of "

300

What term describes the ability of multiple objects of a superclass and subclass to be stored in an ArrayList of superclass objects, then have the same method called on each object to observe its unique behavior?

Polymorphism

300

Look at Example 1.  How many times will the "else" code execute if the initial value of num is 2?

Three times

300

Write the call to Math.random() to pick a random number between 50 and 100.

(int)(Math.random() * 51) + 50

300

An array of int values called arr was initialized with elements {3, 1, 7, 3, 0} After 3 iterations of the selection sort, what is the status of the array?

{0, 1, 3, 7, 3}

300

str3.indexOf("a");

1

400

Name two of the three sorting algorithms that we learned in 2nd semester.  Bonus 200 if you name all three.

Selection, Insertion, and Merge sorts

400

Look at Example 2.  Fill in the missing code for the APStudent class's constructor.

super(name, IDNum);

this.apExams = apExams;


400

Information provided in a multi-line comment before a method that describes what must be true BEFORE the method runs.

Bonus 100 if you name what must be true AFTER the method runs.

Preconditions

Postconditions

400

An array of String objects is created and initialized as {"Nobody", "Time", "Element", "Cow", "Apple"}. After two iterations of the insertion sort, what is the state of the array?

{"Element", "Nobody", "Time", "Cow", "Apple"}

400

str1.substring(2,3) + str2.substring(12);

"kEagles"

500

Vocab term that describes a variable whose value is intended to be constant.  These are identified by using ALL CAPS when naming the variable.

Final

500

Write an enhanced for loop that will print all of the values in either myInts or values.

for(int num: myInts) {

   System.out.println(num);

}

for(double value: values) {

   System.out.println(value);

}

500

What is the syntax to create a multi-line comment?

/*

*/

500

Suppose an array of type 'int' is to be sorted in decreasing order using the selection sort algorithm. If the array is originally {2, 8, 10, 6, 5, 13}, what will the array look like after 2 passes of the sorting loop?

{13, 10, 8, 6, 5, 2}

500

str1.substring(14) + str4.substring(4,6);

"Schoolla"

M
e
n
u