Each of the ten students - Allan, Betty , Carl, Doris, Elmer, Fiona, Gary, Hazel, Irvin and Julia– answered ten questions on a quiz consisting of five multiple-choice questions (A, B, C, D or E) and five True-False questions.
They answered the questions as follows:
Student Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10
Allan C C B D D T F F F F
Betty A C D E A F T F F F
Carl A B E C B T F T T T
Doris C D A E B T F F F F
Elmer C C E D A F T F F F
Fiona C E A C E F F T T T
Gary A B A C E T F F T T
Hazel B B D C A T F F F F
Irvin E E C C B T T T T T
Julia A B C C D F F F T T
- No two students got the same number of correct answers.
Determine who got the most correct answers.
DATA Allan,CCBDDTFFFF
DATA Betty,ACDEAFTFFF
DATA Carl ,ABECBTFTTT
DATA Doris,CDAEBTFFFF
DATA Elmer,CCEDAFTFFF
DATA Fiona,CEACEFFTTT
DATA Gary ,ABACETFFTT
DATA Hazel,BBDCATFFFF
DATA Irvin,EECCBTTTTT
DATA Julia,ABCCDFFFTT
FOR i = 1 TO 10
READ name$(i), answer$(i)
NEXT
CLS
FOR q1 = 1 TO 5
q(1) = q1
FOR q2 = 1 TO 5
q(2) = q2
FOR q3 = 1 TO 5
q(3) = q3
FOR q4 = 1 TO 5
q(4) = q4
FOR q5 = 1 TO 5
q(5) = q5
FOR q6 = 1 TO 2
q(6) = q6
FOR q7 = 1 TO 2
q(7) = q7
FOR q8 = 1 TO 2
q(8) = q8
FOR q9 = 1 TO 2
q(9) = q9
FOR q10 = 1 TO 2
q(10) = q10
REDIM used(10)
good = 1
FOR student = 1 TO 10
score = 0
FOR qNo = 1 TO 10
stAns = INSTR("ABCDETF", MID$(answer$(student), qNo, 1))
IF stAns > 5 THEN stAns = stAns - 5
IF stAns = q(qNo) THEN score = score + 1
NEXT
IF used(score) > 0 THEN good = 0: EXIT FOR
used(score) = student
NEXT
IF good THEN
IF used(10) > 0 THEN maxst = used(10): ELSE maxst = used(9)
PRINT name$(maxst), answer$(maxst)
PRINT "Answer key:",
FOR qNo = 1 TO 10
IF qNo < 6 THEN PRINT MID$("ABCDE", q(qNo), 1); : ELSE PRINT MID$("TF", q(qNo), 1);
NEXT: PRINT
FOR score = 10 TO 0 STEP -1
PRINT score, name$(used(score))
NEXT
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
finds the best scoring student:
Gary ABACETFFTT
Answer key: ABACETFTTT
score student
10
9 Gary
8 Carl
7 Fiona
6 Julia
5 Irvin
4 Hazel
3 Doris
2 Allan
1 Betty
0 Elmer
Edited on February 18, 2013, 6:06 pm
|
Posted by Charlie
on 2013-02-18 18:06:03 |