Objects & Methods
Java Classes (String & Math)
Selection Structures
Iteration (Loops)
Iteration (Loops)
100

This operator is used to access methods and instance variables of an object.

What is the dot operator (or dot notation)

100

 This String method returns the number of characters in a String.

What is length()?

100

This relational operator checks if two values are equal in a boolean expression.

 What is == (double equals)?

100

This type of loop is best when you know exactly how many times you need to iterate.

What is a for loop?

100

The expression 6 + 3 / 2 * 2 evaluates to this value using proper order of operations.

What is 8? (6 + 1 * 2 = 6 + 2 = 8)

200

This type of method does not return a value and uses the keyword "void."

What is a void method?

200

For String s = "computer", s.substring(2, 5) returns this value.For String s = "computer", s.substring(2, 5) returns this value.

What is "put"?

200

To compare if two String objects have the same content, you should use this method instead of ==.

What is .equals()?

200

The for loop header for(int i = 0; i < 10; i += 2) will execute this many times.

What is 5 times? (i = 0, 2, 4, 6, 8)

200

 After executing: int a = 5; a += 3; a *= 2; the final value of a is this.

 After executing: int a = 5; a += 3; a *= 2; the final value of a is this.

300

This special method has the same name as the class and is used to create and initialize objects.

What is a constructor?

300

Math.random() returns a double value in this range.

What is 0.0 (inclusive) to 1.0 (exclusive)?

300

In short-circuit evaluation with the && operator, if the first condition is this value, the second condition is never evaluated.

What is false?

300

In a while loop, forgetting to update this variable inside the loop body can cause an infinite loop.

What is the loop control variable?

300

 Given double a = (int)(6.5 - 3.5); and double b = (int)6.5 - 3.5;, the value of a - b is this.


What is 0.5? (a = 3.0, b = 2.5, so 3.0 - 2.5 = 0.5)


400

This special method has the same name as the class and is used to create and initialize objects.

What are arguments?

400

 Given String word = "September", word.substring(0, 3) + word.substring(word.length() - 3) produces this output.

What is "Sepber"?

400

 The expression !(x < 3) && !(x != 4 || x > 10) is equivalent to this simplified expression.

What is (x >= 3) && (x == 4 && x <= 10)?

400

The code segment that prints n % 4 for n starting at 10, incrementing by 5 each time while n <= 35, produces this output.

What is "2 3 0 1 2 3"?What is "2 3 0 1 2 3"?

400

 In the scramble method, the call scramble("computer", 3) returns this String value.

What is "utercom"? (substring(4,8) + substring(0,3) = "uter" + "com")

500

Given a TestScore class with a bonus(int b) method that adds to the score, calling unit1.bonus(5) followed by unit1.getScore() when the original score was 80.0 returns this value.

What is 85.0?

500

 The code (int)(Math.random() * 5) + 9 produces random integers in this interval.

What is 9 to 13 (inclusive)?

500

 The boolean expression x || !y || !(x && y) will always evaluate to this value, regardless of the values of x and y.

What is true (always true)?

500

The nested loop with outer loop executing from x = 1 to 3 and inner loop executing from y = 3 to 0 (decrementing), calculating sum += x + y each iteration, produces this final sum value.


What is 42?

500

What is "utercom"? (substring(4,8) + substring(0,3) = "uter" + "com")

What is 19? (final values: num=0, val=5, ans=14)