Chapter 4 Computer Science Ap Answers

Only available on StudyMode
  • Topic: For loop, C++, Subroutine
  • Pages : 2 (719 words )
  • Download(s) : 313
  • Published : November 15, 2011
Open Document
Text Preview
Lesson 4 - introduction to control statements
Fill in the Blanks
Complete the following sentences by writing the word or words in the blanks provided. 1. In the statement, x =3;, the ' =' operator is one of Java's extended assignment operators. 2. Using the same name for two methods in the same class, where each method has different parameter input, is called overloading. 3. The nextInt method of Java's Random class returns an integer chosen at random from a range of values between 0 and n-1 where n is the parameter value passed to the method. 4. Java's while statement, and the if-else statements are examples of control statements. 5. The double equal sign (==) is the symbol used to represent Java's equal to operator. 6. Java's for loop is an example of a(n) counter-controlled loop. 7. When a while loop or a for loop is coded inside another while loop or for loop, the inner loop is called a(n) nested loop.. 8. A(n) sentinel is a special value that denotes the end of a list and is used to terminate loop processing when reading input values from a user, or a data file. 9. A(n) off-by-one error occurs when a loop is executed one too many, or one too few times due to an incorrectly coded check of the counter variable. 10. A loop that runs without stopping due to a logic error is called a(n) infinite loop 11. Using a floating-point value as a control variable in a loop, but failing to account for the effects of floating-point precision, can cause a loop to execute much differently than expected. True/False

Circle T if the statement is true or F if the statement is false. T F 1. Using Java's increment and decrement operators in the middle of complex expressions might lead to programming errors due to complexities involved in using these operators. T F 2. Java's max() method returns the maximum value possible for a variable of the supplied data type.. T F 3. Java's read messages can be passed text strings as a parameter, and the string will be used by the method as a...
tracking img