Characters
Strings
Printf
Loops
Loop Control
100

This escape sequence represents a line-feed.

\n

100

This is the index of the first character in a string.

0

100

System.out.printf("Hello", 1234);

Hello

100

Number of parts in a for-loop declaration.

3

100

This is the name of a while-loop with a condition that never becomes false.

infinite loop

200

This is the result of character.isLetter('a')

An error

Character needs to be capitalized.

200

This method returns the size of String s1.

s1.length()

200

Each of these represents:

%d

%s

%c

%f

%b

%%

int

String

char

float/double

boolean

%

200

This type of loop will always execute at least once.

do-while loop

200

This is the name of a special input value that represents the end of input in a while-loop

sentinel value

300

The Unicode for 'B' is 66. This is the Unicode for 'G'.

71

300

This method is used to check if s1 is the same as s2.

s1.equals(s2)

300

Left or right justified?

System.out.printf("%03d", -10);

right justified

300

This type of loop is best for when you know the exact number of iterations beforehand.

for loop

300

This keyword is used to terminate the loop prematurely once a certain condition is met.

break

400

int i = 116;

This statement will print the character with the Unicode value stored in i.

System.out.println((char) i);

400

s1.compareTo(s2) == 0

We now know this about s1 and s2.

They are the same

400

The correct way to print a double num up to 4 decimal places.

System.out.printf("%.4f", num);

400

Number of iterations in the following nested loop

for (int i = 0; i < 4; i++) {

    for (int j = 0; j < 5; j++) {

        System.out.println(i);

    }

}

20

400

This keyword is used to skip the rest of the current iteration and then proceed to the next one.

continue

500

We have a char variable called ch.

The following statement is checking:

(ch >= 'A' && ch <= 'Z')

If ch is capital

500

This is how we find out the last character in a String s1.

s1.charAt(s1.length() - 1)

500

Write a statement that will take the number 10.3456 and formats it at least 8-wide, right-justified, 0-filled, and rounded to the nearest hundredth. End it with a line break.

System.out.printf("%08.2f\n", 10.3456);

500

for (int i = 0; i < 10; i++) {

    if (i % 2 == 0) {

        continue;

    }

    System.out.print(i + " ");

}

The odd numbers 1-9

500

For each of the loop types below, state whether they can perform counter, sentinel, and flag-controlled loops.

A. for loops
B. while loops
C. do-while loops

for loops: counter
while loops: counter, sentinel, and flag
do-while loops: counter, sentinel, and flag

M
e
n
u