Kathleen M. Huhner
1. Sample Test following weeks 4 through 6.
I. Inspect the following program. What errors will be detected when the program is run?
10 READ X,Y
20 LET X+2=Y-3
30 LET Z=X+Y-X
40 PRINT “ANSWER Z-Y
50 GO TO 80
60 LET I=(Y+X)(Y-X)
70 GO 50
II. Construct a flowchart and write a program for one of the following problems.
-
1. Calculate a man’s gross weekly pay given his rate-per-hour, his overtime rate-per-hour, and the number of hours that he worked that week,
-
-
2. Compute the perimeter of a right triangle given the length of the hypotenuse and the length of one leg.
III. will the output look like?
1.
|
50 LET I-1
|
|
55 PRINT I;
|
|
60 IF I> 12 THEN 90
|
|
70 LET I = I+1
|
|
80 GO TO 55
|
|
90 PRINT “
|
END”
|
|
100 END
|
2.
|
5 READ X
|
|
10 READ Y
|
|
15 READ Z
|
|
20 READ Z2
|
|
25 PRINT X,Y,X*Y,Z, Z2,Z2-Z
|
|
30 GO TO 5
|
|
35 DATA 5,2.5,40,2.97,37,2,3.1,75
|
|
40 END
|