Multiple Choice Questions & XML

Kquestion Add comments

XML is used to store Information about something in a logical format. Information is data that has meaning and that meaning can be represented in XML via its structure. A well written XML schema should be easy to understand and follow. Data should be stored within elements (sometimes referred to as tags) whereas information about the data (metadata) should be stored in attributes.

Below is the XML structure I devised to contain the information about the different questions types discussed in my ‘Multiple Choice Question Formats‘ post. I will refer to the element that contains the different question types as the question type element but in reality the name of the question type element will change depending on the question type.

Single Questions

<SINGLEQUESTIONS>
 <INSTRUCTIONS></INSTRUCTIONS>
 <QUESTION>
  <TEXT></TEXT>
  <SCORE></SCORE>
  <CORRECTANSWER></CORRECTANSWER>
  <ANSWERS>
   <ANSWER NUMBER="1"></ANSWER>
   <ANSWER NUMBER="2"></ANSWER>
   <ANSWER NUMBER="3"></ANSWER>
  </ANSWERS>
 </QUESTION>
</SINGLEQUESTIONS>

  • The SINGLEQUESTIONS element contains all the questions of this type.
  • The INSTRUCTIONS element is used to instruct the student how to answer the question.
  • The QUESTION element contains all the relevant information for one question. More than one of these elements can reside within the SINGLEQUESTIONS element.
  • The TEXT element contains the question text.
  • The SCORE element contains the score obtained for answering the question correctly.
  • The CORRECTANSWER element obviously contains the correct answer
  • The ANSWERS element contains the ANSWER elements
  • The ANSWER element has a NUMBER attribute to distinguish it from the other ANSWER elements and contains the answer text.

Common Answers

<COMMONANSWERS>
 <INSTRUCTIONS></INSTRUCTIONS>
 <ANSWERS>
  <ANSWER NUMBER="1"></ANSWER>
  <ANSWER NUMBER="2"></ANSWER>
  <ANSWER NUMBER="3"></ANSWER>
 </ANSWERS>
 <QUESTION>
  <TEXT></TEXT>
  <SCORE></SCORE>
  <CORRECTANSWER></CORRECTANSWER>
 </QUESTION>
</COMMONANSWERS>

The elements in this example all have the same meaning as in the first example. The difference is that they are ordered differently. In the first example all the question and answer information was contained within the QUESTION element. Now because the answer set is common to all of the questions within the COMMONANSWER element is has been removed from the QUESTION element and is only listed once.

The application will understand that all questions within a COMMONANSWER element will refer to those answers. This grouping helps to prevent repetitive data being stored. If a separate group of questions all refered to a common set of answers then these would be listed in the same format as this but within a new COMMONANSWER element.

Multiple Statements

<MULTIPLESTATEMENTS>
 <INSTRUCTIONS></INSTRUCTIONS>
 <ANSWERS>
  <ANSWER NUMBER="1"></ANSWER>
  <ANSWER NUMBER="2"></ANSWER>
  <ANSWER NUMBER="3"></ANSWER>
 </ANSWERS>
 <QUESTION>
  <TEXT></TEXT>
  <SCORE></SCORE>
  <CORRECTANSWER></CORRECTANSWER>
  <STATEMENTS>
   <STATEMENT NUMBER="1"></STATEMENT>
   <STATEMENT NUMBER="2"></STATEMENT>
   <STATEMENT NUMBER="3"></STATEMENT>
  </STATEMENTS>
 </QUESTION>
</MULTIPLESTATEMENTS>

The MULTIPLESTATEMENTS question is almost the same as the common answers format. The difference is that each question has a set of statements which the student evaluates as true or false and then chooses the correct answer.

True || False && Because Of?

Another type of question I refer to as ‘true false because of’ consists of two statements which the user must decide if they each true or false. Then the student must decide if the second statement is the reason for the first.

I have decided to include this type of question in the COMMONANSWERS question type because all of the questions refer to the same set of answers (see below). Due to the design of the COMMONANSWERS element both statements must reside in one block of text (see the above example). The two statements can be distinguised by using paragraph, <p> html elements.

Question:
The day is split into a light part and a dark part.
The earth rotates as it revolves around the sun.

Answer 1: Both statments are true and the second statement is a correct
          explanation for the first.
Answer 2: Both statments are true and the second statement is NOT a
          correct explanation for the first.
Answer 3: Only the first statement is true.
Answer 4: Only the second statement is true.
Answer 5: Both statements are false.

Leave a Reply

WP Theme & Icons by N.Design Studio | Akismet has gobbled 535 spam comments...Mmmm Tasty :-)
Entries RSS Comments RSS Log in