1. LON-CAPA Logo
  2. Help
  3. Log In
 

Problem Types

Back to Index

There are several types of problems that you can use. You should choose your problem how you want to process the answer in mind.

The type of problem is determined by which response is in between your problem tags. For instance,

<problem>
<startouttext></startouttext>
<m></m>
<endouttext></endouttext>
<br></br>
<numericalresponse>
<textline></textline>
</ numericalresponse >
</problem>

would indicate a numerical response, though simply changing numerical response to formula response would change the problem type.

Though there are many problem types, here are some of the ones you will use most frequently.

Coder's Note: "Only use StringResponse with interval answer, DO NOT use it with formula answers. StringResponse is super restrictive and problematic for students to submit answers, Strings require no spaces at all in the submissions and it becomes a mess when you have a formula." - Vianney Filos-Gonzalez(2015)

A numeric response limits the answer to a number. This should be used if the answer is a simple integer or decimal number. This is the simplest way to create a problem, as the user will not have to consider any formatting for their answer.

A formula response checks to see if the submitted answer is equivalent to the answer that you give. This should be used if your answer is some number that is complex like a fraction. It is important to note that correct use of parenthesis is needed when formatting your answer. For instance, x^2/x+1 would resolve to x+1 where x^2/(x+1) would not simplify. When selecting the answer that you set while programming a formula response, use only mathematical symbols and recognized mathematical strings like pi. If there is a way to express something mathematically, that is preferable in this instance to expressing it otherwise. For instance, if you have a square root, the best way to use that in an answer would be x^(1/2).

A custom response allows you to process the answer in any way you want to. You are able to do this by using a Perl script. This should be used when you want to have answers that are not solvable using the other problem types. Since this allows you to do whatever you want with the user input, remember that you will need to make sure that your code is able to manage all user inputs in the way you desire. For instance, when an answer is DNE, a user may mistype this as ‘dne’, ‘DNe’, ‘DEN’, ‘DNE ‘, or any number of other similar answers. If you want these answers to be correct, you must write your problems in a way that allows for those user errors.

Option response and radio response problems allow the user to select a single answer from predefined answers. This is useful for creating multiple choice questions.

Using "COLLECTION OF ANSWERS"

(Contributed by Vianney Filos-Gonzalez(2015) )

Very often you will want to add flexibility to LON-CAPA for accepting answer in different equivalent forms.

For easy reference on how it looks/works, check out this problem: https://loncapa.purdue.edu/res/purdue/purdue_math/Training/Creating%20Problems/Collection%20of%20Answers%20Example.problem

The procedure is to use a "Collection of Answers". The easiest way is to insert this into the "Response Area" using the colorful editor and not the plaintext XML view. Then you insert a new answer and the actual value of the answer goes in the "Value" field. To insert a different answer, do "Insert: Answer" under the first answer, not "Insert:Value", this option is for when you have multiple answer boxes.

Important: DO NOT leave an answer in the initial "Answer" txt field of the response part.


If you have multiple answer boxes and you don't want to specify which answer goes in what box, make the collection "Type: Unordered", use "Insert:Value" in the answer to add value for multiple boxes, and make the Answer Type Unordered".  

Accepting Multiple Answers

(Contributed by Harshad Lalit & Vianney Filos-Gonzalez(2015) )

 

 

For a more comprehensive look at problem types and how to implement them, look here.