Five students each answered five questions on an quiz consisting of two multiple-choice questions (A, B or C) and three True-False questions. They answered the questions as follows:
Student Q1 Q2 Q3 Q4 Q5
Alex A A T T T
Bert B B T F T
Carl A B T T F
Dave B C T T F
Eddy C A F T T
No two students got the same number of correct answers. Who got the most correct answers?
(In reply to
solution by Charlie)
The program
DATA aattt,bbtft,abttf,bcttf,caftt
FOR p = 1 TO 5: READ ans$(p): NEXT
FOR a1 = 1 TO 3
a$(1) = MID$("abc", a1, 1)
FOR a2 = 1 TO 3
a$(2) = MID$("abc", a2, 1)
FOR a3 = 1 TO 2
a$(3) = MID$("tf", a3, 1)
FOR a4 = 1 TO 2
a$(4) = MID$("tf", a4, 1)
FOR a5 = 1 TO 2
a$(5) = MID$("tf", a5, 1)
REDIM aCt(5)
good = 1
FOR p = 1 TO 5
ct(p) = 0
FOR i = 1 TO 5
IF a$(i) = MID$(ans$(p), i, 1) THEN ct(p) = ct(p) + 1
NEXT i
IF aCt(ct(p)) > 0 THEN good = 0: EXIT FOR
aCt(ct(p)) = aCt(ct(p)) + 1
NEXT p
IF good THEN
FOR i = 1 TO 5
PRINT a$(i);
NEXT i
PRINT
FOR p = 1 TO 5
PRINT ct(p)
NEXT
END IF
NEXT a5
NEXT a4
NEXT a3
NEXT a2
NEXT a1
would find all solutions, and found only
bctff
1
3
2
4
0
as the correct answers, and the scores of the quiz takers.
|
Posted by Charlie
on 2004-09-02 08:59:06 |