Wiris

Documentation / WirisQuizzes

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • WirisQuizzes

      • LearningLemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Miscellaneous

                      • Wiris Integrations

                        • Home
                        • WirisQuizzes
                        • Validation Options
                        • Grading functions
                        • Grading functions

                        Compound answers

                        Reading time: 1min

                        We can also create grading functions in the case of compound answer questions. All we need to do is use a separate argument for each answer blank. So, if there are three blanks to fill in, the grading function should look like gf(x,y,z). The first argument corresponds to the first blank, and the second argument corresponds to the second blank, etc. Let's see a simple example.

                        The question will be a standard exercise in introductory calculus:  
                         
                        For this, the following grading function could be used:  
                         
                        Unlike ordinary compound answers, the advantage here is that we don’t need to worry about the order in which the student enters their answers. It also allows for virtually infinite valid responses (e.g., any solution of the form 8k + 1 with k an integer would be correct). However, much more complex behavior can be programmed as well.

                        Empty answer from the student

                        Imagine we are working with a compound answer like in the previous example. The student might leave a box empty and just answer some questions, which could crash the validation algorithm, resulting in all grades being 0 even if some were correct.

                        If you want to grade the answers he had submitted, you need to modify the algorithm and test that all boxes are not empty with the command not_null?. For instance, following the same example above, the algorithm should be as follows.

                        Tip
                        The not_null? is a precaution you need to use if you want to do something complex with your answer that might crash the program if the response were null. If you are making simple comparisons, you technically don't need it, but we strongly recommend systematically including it to avoid undesired situations.

                         

                         

                        Was this article helpful?

                        Give feedback about this article

                        Related Articles

                        • Why MathML 3?
                        • MathML makes elementary math accessible
                        • MathML 3
                        • Keep arguments as strings

                        Empowering STEM education

                        MathType

                        • Office Tools
                        • LMS
                        • XML
                        • HTML

                        WirisQuizzes

                        Learning Lemur

                        Integrations

                        Solutions

                        • Education
                        • Publishing houses – platforms and interactive
                        • Publishing houses – Print and digital
                        • Technical writers

                        Pricing

                        Downloads

                        Blog

                        • Success stories

                        About us

                        • Careers
                        • Partnership

                        Contact Us

                        Contact Sales

                        European union (European Regional Development Fund) and 1EdTech (TrustEd Apps Certified)
                        • Cookie Policy
                        • Terms of Use
                        • Privacy Policy / GDPR
                        • Student Data Privacy
                        • Compliance
                        • Cookie Settings

                        © Wiris 2026

                        Expand