Java Programming, 3rd Edition Chapter 09 Book Work Page 1 of 2

Multiple Choice Instructions: Write the letter of the correct response on your paper.

1. A(n) ______variable is a variable defined within a method or in the parameter list of a method, and is in scope only within that method. a. static b. local c. instance d. private 2. The ______of the ArrayList is the size of the array used to store the array elements, which is at least as large as the list size. a. storage field b. ArrayStorage c. ArrayList size d. capacity 3. A(n) ______is the value used when no other value is supplied. a. default value b. initial value c. if/then value d. other value 4. A(n) ______provides the value of a private variable within the class to a user program. a. mutator method b. code method c. accessor method d. variable method 5. A(n) ______accepts the proposed new value for the variable. a. mutator method b. code method c. accessor method d. variable method 6. The ______removes elements from the ArrayList one at a time. a. element() method b. remove() method c. removelist() method d. array() method 7. Referencing an object as an instance of a more general parent class is called ______. a. reference casting b. object casting c. downcasting d. upcasting 8. The String valueOf() method returns a String representing the value of the ______passed to it. a. argument b. buffer c. index d. sum 9. The process of converting ciphertext into plaintext is called ______. Java Programming, 3rd Edition Chapter 09 Book Work Page 2 of 2

a. encryption b. coding c. decryption d. object coding 10. The substring() method returns a portion, or substring, of a ______object. a. Method b. String c. Array d. Code

True/False Instructions: Write T if the statement is true or F if the statement is false on your paper. T F 1. It is good programming practice to publish as part of the program documentation the headers of any method used as the public interface. T F 2. Make methods public only if they must be accessible outside of the class. T F 3. Blank finals do not allow objects of the same class to have the same named constant. T F 4. Making final variables static ensures that the same value is used for all instances. T F 5. LinkedList typically yields faster access than ArrayList. T F 6. Multiple methods may be defined with the same name and they must have identical parameter lists. T F 7. Beginning Java programmers writing assignment statements should use for parameters distinct names that do not conflict with instance variable names. T F 8. Keep methods short and focused on a single task. T F 9. Validating the data type prior to compile time is said to make the collection typesafe. T F 10. The String class is the Java class that does not support immutable string values. Short Answer Instructions: Write the best answer on your paper.

1. To design for reuse, you must ______the specific functionality of a given class and design it to provide

that functionality regardless of the particular application where it is used.

2. You can change the ______of a public method without changing the public interface.

3. A ______is a variable shared by all objects of a class.

4. Instance variables are often defined as ______, limiting their access within a class.

5. When a program contains multiple methods all having the same name, the methods are said to be ______.

6. Password class, also called ______, do not need to know the specifics of the instance attributes.

7. Casting from a more general type to a more specific type is called ______.

8. Many techniques exist to perform the process of ______, which is the conversion of data into a form not

understood easily by unauthorized users.

9. A ______is a transformation of a string of characters into a shorter, fixed-length value that represents the

original string.

10. Preventing the characters typed as user input from displaying or substituting anothercharacter in their place is

called ______.