Quiz 3b
AMES 5
Quantitative Computer Skills
Quiz 3b, January 21, 1999
(Closed book and notes, Choose one best answer, Use green scantron form)
1. In a single line IF-THEN-ELSE structure such as 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) an error message (d) disaster (e) a blank screen.
2. In a single line IF-THEN-ELSE structure such as 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) an error message (d) disaster (e) a blank screen.
3. In a single line IF-THEN-ELSE structure such as 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) an error message (d) disaster (e) a blank screen.
4. In a single line IF-THEN-ELSE structure such as 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) an error message (d) disaster (e) a blank screen.
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) an error message (d) disaster (e) a blank screen.
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) an error message (d) disaster (e) a blank screen.
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 PRINT "hydrogen" (new line) ELSE (new line) PRINT "neither hydrogen nor helium" END IF (new line) END is
(a) hydrogen (b) helium (c) an error message (d) neither hydrogen nor helium (e) a blank screen.
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) an error message (d) neither hydrogen nor helium (e) a blank screen.
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