Letting student practice with number bases can be a crucial part in your course. To let them practice you would like to give them exercises where they can practice transformations between different number bases. This is possible in Grasple by combining two operators and creating a non-standard answer rule check.

Below we will explain you how to do this.

Creating Number Bases exercises

To create exercises for number bases transformation you will have to use two operators (see a full list of operators here):

  • "Read decimal from binary": used to parse the non-decimal base input of the student and transform it to decimal for comparing with another decimal number

  • "Display decimal as base": used to create non-decimal base parameters which can be used in the text/feedback of the exercise.

NOTE: checking the answer is always done by transforming any input to the decimal base and comparing it to the right decimal number.

IMPORTANT: currently Grasple only supports transformations between number bases of integer values

Example exercise #1: transform decimal number to binary number

We are going to create the following exercise:

The first step is to create the parameters needed in this exercise. Below you can see the above question in edit view.

Here you can see one parameter which is the decimal number "decInt". We defined that parameter and its binary transformation in the parameters section using the "Display Decimal as Base":

The parameter "bin" can be used to display in the feedback. This parameter will not be used to check the answer.

To check the binary answer of the student, we will create a non-standard answer rule. You can read more about answer rules here.

Below you can see how we interpret the answer of the student as binary number "sa1ToDecimal" and compare it to the correct decimal number "decInt". Use the "Read decimal from base" operator to do this.

Now you have a question which checks whether the input of the student is the correct binary number.

Example Exercise #2: transform hexadecimal number to decimal number

Similarly, but a slightly different approach is required for exercises asking for a transformation from a non-decimal number to a decimal number. The main difference is that the answer rule is simpler.

We are going to create the following exercise:

The first step is to create the parameters needed in this exercise. Below you can see the above question in edit view.

Here you can see one parameter which is the decimal number "decInt", which is the correct answer. We defined that parameter and its hexadecimal transformation ("hex") in the parameters section using the "Display Decimal as Base":

Since the input is a decimal number you can simply use a standard answer rule by providing the decimal number in the answer box. For completeness, below you can see the answer rule for this exercise:

Questions?

If you have any questions and/or feedback, please reach out to us via the chat icon in the bottom (right) or emailing us at support@grasple.com.

Did this answer your question?