Page 1

Full file at http://testbank360.eu/test-bank-introduction-to-programming-with-java-1st-edition-dean

Chapter 2 Test Questions 1. Using set ... to ... for all assignments, write pseudocode for an algorithm that establishes the base and height of a triangle as 8 and 5, respectively. Then it computes the triangle’s area. Then it outputs that area. 2. Using ← for all assignments, write pseudocode for an algorithm that establishes the base and height of a triangle as 8 and 5, respectively. Then it computes the triangle’s area. Then it outputs that area. 3. Using “camelCase”, write the name for a Java variable that describes a computer's price. 4. Write a pair of pseudocode statements that prompts the user for a body weight in kilograms and then inputs the entered value and assigns it to a variable called kgBodyWeight. 5. Draw a flowchart for an algorithm that prompts a user for the diameter of a circle. Then it inputs the value the user enters. Then it uses that value to calculate the perimeter. Then it outputs the perimeter's value. Use ← for assignment(s). 6. Which (if any) of the following statements is (or are) true: a) In a well-structured program, flow never goes backward. b) Each conditional has exactly two alternative next statements. c) Each conditional always has exactly one previous statement. d) In a well-structured program, it's OK for flow to go back to a previous non-conditional statement. e) In a well-structured program, it's OK for flow to go back to a previous conditional. f) In a well-structured program, it's OK to repeat a particular sequence of operations an arbitrary number of times. 7. Write pseudocode using nested if-else statements to describe the three-way choice animals (including humans) face when confronted with a threat: If we are not noticed, we freeze. If we are noticed and are not trapped, we run. If we are noticed and are trapped, we fight. 8. Draw a flowchart to describe the three-way choice animals (including humans) face when confronted with a threat: If we are not noticed, we freeze. If we are noticed and are not trapped, we run. If we are noticed and are trapped, we fight. 9. Write pseudocode to describe an algorithm which computes and prints the sum of the squares of three prompted input values. Use looping with a down-counter that terminates at zero, and use set ... to ... for assignments. Use > for the looping condition, and use decrement count for each change in count's value. 10. Draw a flowchart to describe an algorithm which computes and prints the sum of the squares of one or more input values. Use user query for loop termination, and use ← for assignments. 11. When input values are arbitrary, you can use sentinel value loop termination to improve input efficiency. (T / F)


Full file at http://testbank360.eu/test-bank-introduction-to-programming-with-java-1st-edition-dean

12. Write the output produced by this algorithm: set x to 2 while x <= 3 set y to 1 while y <= 3 print x increment y newline increment x 13. Trace this algorithm: 1 old ← 3 2 num ← 5 3 while num < 10 4 next ← old + num 5 old ← num 6 num ← next Use this heading:

Test bank introduction to programming with java 1st edition dean  

test bank introduction to programming with java 1st edition dean. Full file at http://testbank360.eu/test-bank-introduction-to-programm...

Read more
Read more
Similar to
Popular now
Just for you