Make Up Quiz 3b

AMES 5

Quantitative Computer Skills

Make Up Quiz 3b, Feb. 11, 1999

(Closed book and notes, Choose one best answer, Use green scantron form)

1. In the program LET a = 4 (new line) IF a=4 then PRINT "helium" else PRINT "hydrogen" (new line) END the output will be

(a) hydrogen (b) helium (c) ending doesn't match beginning (d)wrong type (e) a different error message

2. In the program LET a = 4 (new line) IF a=4 then PRINT "helium" else PRINT "hydrogen" (new line) END IF the output will be

(a) hydrogen (b) helium (c) ending doesn't match beginning (d)beginning doesn't match ending (e) a different error message

3. In the program LET a$ = "4" (new line) IF A=4 then PRINT "helium" else PRINT "hydrogen" (new line) END the output will be

(a) hydrogen (b) helium (c) ending doesn't match beginning (d)beginning doesn't match ending (e) a different error message

4. In the single line IF-THEN-ELSE structure LET a$ = 4 (new line) IF a=4 then PRINT "helium" else PRINT "hydrogen" (new line) END the output will be

(a) hydrogen (b) helium (c) ending doesn't match beginning (d) wrong type (e) a different error message

5. The most versatile branching structure in True BASIC is the IF branch. The output of the single block IF-THEN branch program LET a=4 (new line) IF A=4 THEN (new line) PRINT "helium" (new line) ELSE (new line) PRINT "hydrogen" (new line) END IF (new line) END is

(a) hydrogen (b) helium (c) ending doesn't match beginning (d) wrong type (e) a different error message

6. The output of the double block IF-THEN-ELSE structured program LET a=3 (new line) IF a=4 THEN (new line) PRINT "helium" (new line) ELSE (new line) PRINT "hydrogen" (new line) END IF (new line) END is

(a) hydrogen (b) helium (c) ending doesn't match beginning (d) wrong type (e) a different error message

7. The output of the triple block IF-THEN-ELSEIF-ELSE structured program LET a=3 (new line) IF a=4 or a=3 and a<>0 THEN (new line) PRINT "helium" (new line) ELSEIF a=1 then (new line) PRINT "hydrogen" (new line) ELSE (new line) PRINT "neither hydrogen nor helium" (new line) END IF (new line) END is

(a) hydrogen (b) helium (c) ending doesn't match beginning (d) wrong type (e) a different error message

8. Another type of branching is the multibranch SELECT CASE structure. The output of the program at the right is

(a) hydrogen (b) helium (c) ending doesn't match beginning (d) wrong type (e) a different error message LET a = 2

SELECT CASE a

CASE 1 to 2

PRINT "hydrogen"

CASE 3 to 4

PRINT "helium"

CASE else

PRINT "neither hydrogen nor helium"

END SELECT

END

9. The logical expression END DATA for 8. is (a) true (b) false