Calculations in matrix table

121 Views Asked by At

I am facing a problem that I am unable to solve. I have a quiz with 21 questions divided into two parts, questions 1-13 and questions 14-21. There are five possible answers, with the first three not important so I assigned them a value of zero.

Now, however, I have three rules for calculating the final three options. In the program in which I have to do the quiz, I have general arithmetic operations available; addition, subtraction, division, multiplication and use of parentheses.

I need to put together a formula that would give me different ranges from which to assess which option belongs to the user who completed the quiz. The rules are:

  • OPTION 1 = if questions 1 - 13 have six or more answers with 3 or 4 and questions 14 - 21 if there are six or more answers with 3 or 4
  • OPTION 2 = if questions 1 - 13 have six or more answers with 3 or 4 and questions 14 - 21 if there are less than six answers with 3 or 4
  • OPTION 3 = if there are less than 5 answers in each set of questions with 3 or 4

It would be easiest if I could set ranges, for example: 0 - 10 = OPTION 1, 11 - 20 = OPTION 2 and 21 - 30 = OPTION 3 Thanks for any help!

Answer 0 Answer 1 Answer 2 Answer 3 Answer 4
Question 1 0 0 0 x x
Question 2 0 0 0 x x
Question 3 0 0 0 x x
Question 4 0 0 0 x x
Question 5 0 0 0 x x
Question 6 0 0 0 x x
Question 7 0 0 0 x x
Question 8 0 0 0 x x
Question 9 0 0 0 x x
Question 10 0 0 0 x x
Question 11 0 0 0 x x
Question 12 0 0 0 x x
Question 13 0 0 0 x x
Question 14 0 0 0 x x
Question 15 0 0 0 x x
Question 16 0 0 0 x x
Question 17 0 0 0 x x
Question 18 0 0 0 x x
Question 19 0 0 0 x x
Question 20 0 0 0 x x
Question 21 0 0 0 x x

Answers 0, 1 and 2 are not important so I placed 0 there.

Thanks in advance for any suggestions/help!

1

There are 1 best solutions below

1
On

So you can possibly use two digits to store information of questions 1-13 and remaining digits to store information of questions 14-21. Here is how:
Assign +1 point for options 3 and 4 for all questions 1-13.
Assign +100 points for options 3 and 4 for all questions 14-21.
Let us assume that the score is $s$.
You can get the number of 3 or 4 answers from 14-21 by dividing $s$ by $100$. Assuming this is integer division. $m=\lfloor{s/100}\rfloor$
You can get the last two digits by $l=s-m$
Determine:
OPTION 1 if $l\geq 6$ and $m \geq 6$
OPTION 2 if $l\geq 6$ and $m < 6$
OPTION 3 if $l<5$ and $m<5$
Hope this helps!