comparing output in combined answers

comparing output in combined answers

by AIMAN ISMAIL -
Number of replies: 2

Hi.

I am trying to create a question on pointers in C, hence I believe the student's and expected answers need to be executed within the same .c file.

So, my idea is to combine the student's and expected answers into a .c file, compile, execute, then compare the first few lines with the last few lines of output (following the guide in git). 

The program seems to be working fine, with all the answers marked correct. However, I am getting the "Your code must pass all tests to earn any marks. Try again." message and incorrect answer.

Anything I did wrong question setup? Or is there a better way to achieve this?

Attached is XML file of question (removed the pointers part).

Thanks.



In reply to AIMAN ISMAIL

Re: comparing output in combined answers

by Richard Lobb -
That is certainly confusing, I admit.

The problem is simply that you're awarding 4 marks to the question via the awarded property of the JSON. But the testcase is specified to be worth just 1 mark. A question is marked as "all correct" if all testcases are awarded full marks. Awarding more than full marks breaks that test.

You can either:
  1. Change the code to award 1 mark, or
  2. Change the testcase to be worth 4 marks, or 
  3. Remote the 'awarded' property from your JSON output altogther. The awarded mark will then be fraction * value_of_test_case.

I recommend option 3 as that's generally what you want. You can then change the value of each test case directly in the test case rather than having to alter the code.

Sorry about the confusion. If there's some documentation somewhere that suggests you explicitly set an 'awarded' property in a per-test-case-template output, please tell me where it is. You don't generally need to do that and, as you've discovered, it can be confusing.

Richard

In reply to Richard Lobb

Re: comparing output in combined answers

by AIMAN ISMAIL -
Thanks for the reply.
It is okay now.

I referred to the example under "A simple grading-template example" where the 'awarded' property was written in the json.dumps method.

Thanks