Five students Adele, Betty,Carol, Doris, and Ellen- answered five questions on an exam consisting of two multiple-choice (a,b,c) questions and three true-or-false questions.
(1) They answered the questions as follows:
I II. III. IV. V
Adele. a a t t t
Betty. b b t f t
Carol. a b t t f
Doris. b c t t f
Ellen. c a f t t
(2) No two students got the same number of correct answers.
Who got the most correct answers?
answers=['aattt';'bbtft';'abttf';'bcttf';'caftt'];
students='ABCDE';
for a1='a':'c'
for a2='a':'c'
for a3='ft'
for a4='ft'
for a5='ft'
a=[a1 a2 a3 a4 a5];
for p=1:5
score(p)=sum(answers(p,:)==a);
end
if length(unique(score))==5
disp(a)
disp(score)
end
end
end
end
end
end
finds
>> theExam
bctff
1 3 2 4 0
>>
meaning the correct answers were b, c, true, false, false, and that D had the most correct answers, 4. B had the second most, 3; C, the thifd most, 2; A had 1 correct and E had none right.
|
Posted by Charlie
on 2023-08-31 09:07:10 |