Quiz review

1. What word is missing in the following statement and why is it needed?
int[] a = int[10];

2. What is the best reason to use a for loop with an array?

3. Give an example of how an array is used in programming.

4. What's the difference in the way you find the length of a string vs an array?

5. Write the code to print an array of integers of any length backwards (from the last integer to the first integer).

6. Consider the code: String word = "artichoke"; What is output by:

A) System.out.println(word.length());
B) System.out.println(word.charAt(word.length()-1));
C) System.out.println(word.indexOf('k'));
D) System.out.println(word.substring(0, 3));
E) System.out.println(word.substring(0,5));
F) System.out.println(word.substring(6));

7. What's the different between primitive types and objects (reference types)? When is null used?

8. Show how testing for the equality of int is different from testing for the equality of Strings.

9. Give an example of concatenation