Short Answer 5, 6 p. 71
5. What two things must you normally specify in a variable declaration? You must specify the variable type and identifier.
6. What value is stored in uninitialized variables? Some languages assign a default value as 0 to uninitialized variables. In many languages, however, uninitialized variables hold unpredictable values.
Algorithm Workbench Review Questions 3-10 p.71
3. Write assignment statements that perform the following operations with the variables a, b, and c.
a. Adds 2 to a and stores the result in b
Set b= 2 +a
b. Multiplies b times 4 and stores the result in a set a= b*4
c. Divides a by 3.14 and stores the result in b set b= 3.14/b
d. Subtracts 8 from b and stored the result in a set a= b-8
4. Assume the variables result, w,x, y, and z are all integers, and that w= 5, x= 4, y=8 and z=2. What will the values be stored in result in each of the following statements?
a. set result= x+y= 4+8
b. set result=z*2= 2*2
c. set result= y/x= 8/4 set result= y-z= 8-2
5. Write a pseudocode statement that declares the variable cost so it can hold real numbers. Floating-point variable cost
6. Write a pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0.
Declare Real price=99.95
Display "the original price."
Input item original price
Display "price"
7. Write a pseudocode statement that assigns the value 27 to the variable count.
Count:=27
8. Write a pseudocode statement that assigns the sum of 10 and 14 to the variable total.
Declare Integer total=0
Set total=10+14
9. Write a pseudocode statement that subtracts the variable downpayment from the variable total and assigns the result for the variable due.
Declare Integer downPayment
Declare Integer Total
Declare Integer Due Set Due = Total – downPayment
10. Write a pseudocode statement that multiplies the variable subtotal by 0.15 and assigns the