10/4
2
Let x = true, y = true
Evaluate the expression
(x || !y) &&(!x || y)
true
A class that converts primitive data types into objects.
A Wrapper Class
Type out the correct statement that will initialize an array of Strings called "words" with four empty strings.
String [] words = {" ", " ", " ", " "};
"catastrophe".substring(4);
10/4.0
2.5
Let x = true, y = true
Evaluate the expression
(x || !(x && y)) || (x && y)
true
Changing a variable from one type to another
Type Casting
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)
"catastrophe".substring(4,5);
11 / 2 * 3
15
Let x be an integer. For what range of x is the expression true?
!(x > 5) && (x > 0)
0 < x <= 5
A sorting algorithm in which each value is placed in its final sorting position
Selection Sort
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}
"catastrophe".indexOf("a")
1
(int) (10.01 / 4.99)
2
Daily double!
What does the following evaluate to?
!(x || y) == ((!x) & (!y))
true
The method that creates an instance of a class.
Constructor
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"}
Daily Double!
"catastrophe".substring(0);
"catastrophe"
(double) (10/4)
2.0
Let x = false, y = true, and w be unknown. Evaluate the following expression.
(w OR x) OR (y AND !w)
true
What is the syntax to create a multi-line comment in Java?
/*
*/
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}
"catastrophe".substring(11);
IndexOutOfBoundsException