Given the correct key in the form of an array correct_key='.........'; write a program to evaluate the grade of a student from the answer key. use -1 if answer is wrong, 10 if answer is correct and 0 if no answer.

댓글 수: 1

RITTIK KUMAR GHOSH
RITTIK KUMAR GHOSH 2014년 11월 13일
being more specific, there were total of 8 questions carrying 10 marks for a correct answer and -1 for wrong answer and 0 for an unattended question. how to evaluate it?

댓글을 달려면 로그인하십시오.

 채택된 답변

MA
MA 2014년 11월 13일

1 개 추천

%w=wrong
%c=correct
%o=unanswered
syms w c o
s=0;
for i=1:5
g(i)=input('answer= ');
if g(i)==w
s=s-1;
elseif g(i)==c
s=s+10;
elseif g(i)==o
s=s+0;
end
end
display('grade')
display(s)

댓글 수: 4

RITTIK KUMAR GHOSH
RITTIK KUMAR GHOSH 2014년 11월 13일
can you help me out with the commands?
MA
MA 2014년 11월 13일
you have 5 question, program ask you about the answer of each question then it gives your score
RITTIK KUMAR GHOSH
RITTIK KUMAR GHOSH 2014년 11월 14일
thanks
MA
MA 2014년 11월 14일
you're welcome

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

RITTIK KUMAR GHOSH
RITTIK KUMAR GHOSH 2014년 11월 14일

0 개 추천

1.When I am putting in the answers as 10 0 -1 10 10, the grade remains the same in each case, it is not changing and showing the result 0. why is it so? 2.Why there are 2 spaces in this script('answer= ') can you please explain?

댓글 수: 4

i run program for your case and get the below result:
answer= c
answer= o
answer= w
answer= c
answer= c
grade
s =
29
RITTIK KUMAR GHOSH
RITTIK KUMAR GHOSH 2014년 11월 14일
answer= c The following error occurred converting from sym to double: Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a double array. If the input expression contains a symbolic variable, use the VPA function instead. This is what is coming when I am trying to run the program
RITTIK KUMAR GHOSH
RITTIK KUMAR GHOSH 2014년 11월 14일
then I tried out with the numerical inputs and every time it is s=0
RITTIK KUMAR GHOSH
RITTIK KUMAR GHOSH 2014년 11월 15일
thanks for all the help, got it correct

댓글을 달려면 로그인하십시오.

질문:

2014년 11월 13일

댓글:

2014년 11월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by