Quiz 2 Answer key : 198:110 Intro to Computers Summer 2007

Part A

1. E 2. A 3. C 4. J G I A 5. C B D K 6. B 7. C

8. = C6 * D6 + E6

9. F 10. B

Part B

    I.

        IF OnTarget < Goal THEN PRINT "Practice time."

    II. 22

    III.

        LET FinalBill = 500*Rooms + 2000*Baths

    IV. Abnormal V. 800

Part C

I.

  1. 1st line: comma should be a semicolon in INPUT PROMPT statement
  2. 2nd line: LET items are reversed; should be  LET Many = 20
  3. 3rd line: missing  THEN in the IF statement

II.

  1. 5th line: need a comma within PRINT list - after variable SpaceLeft
  2. 6th line: Should not have an END IF. The IF statement is a single-line IF, so cannot have END IF.
  3. 7th line: Cannot have Current in the DATA line, it is a variable; only values allowed as DATA

Part D

I.
            Choice?2
            Today 45 is the result.

Each line is worth 2 point. (Lines need to match exactly. Only exception is there can be a space after the ? 

II.

Begin calculations
R starts with 65
and S begins with 4
It changed from 25 to 69

Each line is worth 1 point, they must match exactly.  If the last line is spilt in two, take 1 point off.

Part E

Here is one possible program.

READ PriceCatFood, PriceDogFood
DATA 3.75,   4.75

INPUT PROMPT "How many cats do you have?" : NumCats
INPUT PROMPT "How many dogs do you have?" : NumDogs

LET WeeklyCatCost = NumCats * PriceCatFood * 7
LET WeeklyDogCost = NumDogs * PriceDogFood * 7
LET WeeklyPetFoodCost = WeeklyCatCost + WeeklyDogCost
 
PRINT "You spend $"; WeeklyCatCost; " on cats each week."
PRINT "You spend $"; WeeklyDogCost; " on dogs each week."
PRINT "Overall, you spend $"; WeeklyPetFoodCost; " each week feeding your pets."

PRINT "You are spending more each week buying ";
IF WeeklyCatCost > WeeklyDogCost THEN PRINT "cat food." ELSE PRINT "dog food."

END

(General grading. 10 points: perfect program. 9 points: a tiny mistake. 8 points: something important missing or wrong. 7 points : Read, Input and Prints okay but calculation way off. 5 points: Too many syntax errors and logic not right. 3 points or less: it doesn't look much like Basic. A missing END statement will lose you a point. )