Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: preparing multiple choice questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63371] Re: preparing multiple choice questions
  • From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
  • Date: Tue, 27 Dec 2005 04:42:41 -0500 (EST)
  • Organization: The Open University, Milton Keynes, U.K.
  • References: <doof2r$kd9$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Baris Erbas" <berbas at anadolu.edu.tr> a écrit dans le message de news: 
doof2r$kd9$1 at smc.vnet.net...
|
| Dear Mathematica Users,
|
| I have been trying to prepare a test of 30 question with multiple choices
| ranging from a-e.
|
| I want to automatically assign the question numbers and and the correct
| answers using mathematica. All correct answers should be in equal 
quantity,
| i.e. 6 a, 6 b, . 6 e.
|
| I tried to use Random with Table however it doesnt produce equal number of
| correct answers. I also tried to look into the Statistical packages.
|
| Is there a way of doing this in Mathematica? Could you please froward me 
to
| a link if you already know one?
|
|
|
| All the best
|
|
|
| Baris Erbas
|
|

Hi Baris,

The following function will do what you want:

In[1]:=
correctAnswers[]:=
  Module[{occurences={0,0,0,0,0},results},While[occurences!={6,6,6,6,6},
      results=Table[{q,{a,b,c,d,e}[[Random[Integer,{1,5}]]]},{q,1,30}];
      occurences=Length/@Split@Sort@results[[All,2]];
      ];
    results]

In[2]:=
correctAnswers[]

Out[2]=
{{1,e},{2,e},{3,b},{4,b},{5,e},{6,d},{7,c},{8,d},{9,d},{10,d},{11,b},{12,
    a},{13,a},{14,c},{15,c},{16,e},{17,a},{18,c},{19,a},{20,b},{21,e},{22,
    c},{23,b},{24,d},{25,d},{26,a},{27,e},{28,c},{29,a},{30,b}}

Best regards,
/J.M.

(************** Content-type: application/mathematica **************
                     CreatedBy='Mathematica 5.2'

                    Mathematica-Compatible Notebook

This notebook can be used with any Mathematica-compatible
application, such as Mathematica, MathReader or Publicon. The data
for the notebook starts with the line containing stars above.

To get the notebook into a Mathematica-compatible application, do
one of the following:

* Save the data starting with the line of stars above into a file
  with a name ending in .nb, then open the file inside the
  application;

* Copy the data starting with the line of stars above to the
  clipboard, then use the Paste menu command inside the application.

Data for notebooks contains only printable 7-bit ASCII and can be
sent directly in email or through ftp in text mode.  Newlines can be
CR, LF or CRLF (Unix, Macintosh or MS-DOS style).

NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing
the word CacheID, otherwise Mathematica-compatible applications may
try to use invalid cache data.

For more information on notebooks and Mathematica-compatible
applications, contact Wolfram Research:
  web: http://www.wolfram.com
  email: info at wolfram.com
  phone: +1-217-398-0700 (U.S.)

Notebook reader applications are available free of charge from
Wolfram Research.
*******************************************************************)

(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[      2674,         78]*)
(*NotebookOutlinePosition[      3317,        100]*)
(*  CellTagsIndexPosition[      3273,         96]*)
(*WindowFrame->Normal*)

Notebook[{
Cell[BoxData[
    \(correctAnswers[] :=
      Module[{occurences = {0, 0, 0, 0, 0}, results},
        While[occurences != {6, 6, 6, 6,
              6}, \[IndentingNewLine]results =
            Table[{q, {a, b, c, d,
                    e}[\([Random[Integer, {1, 5}]]\)]}, {q, 1, 30}];
          occurences =
            Length /@
              Split@\(Sort@
                  results[\([All,
                      2]\)]\);\[IndentingNewLine]]; \
\[IndentingNewLine]results]\)], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    \(correctAnswers[]\)], "Input"],

Cell[BoxData[
    \({{1, e}, {2, e}, {3, b}, {4, b}, {5, e}, {6, d}, {7, c}, {8,
        d}, {9, d}, {10, d}, {11, b}, {12, a}, {13, a}, {14, c}, {15,
        c}, {16, e}, {17, a}, {18, c}, {19, a}, {20, b}, {21,
        e}, {22, c}, {23, b}, {24, d}, {25, d}, {26, a}, {27,
        e}, {28, c}, {29, a}, {30, b}}\)], "Output"]
}, Open  ]]
},
FrontEndVersion->"5.2 for Microsoft Windows",
ScreenRectangle->{{0, 1280}, {0, 717}},
WindowSize->{770, 559},
WindowMargins->{{0, Automatic}, {Automatic, 0}}
]

(*******************************************************************
End of Mathematica Notebook file.
*******************************************************************)



  • Prev by Date: Re: Re: Questions regarding MatrixExp, and its usage
  • Next by Date: Re: preparing multiple choice questions
  • Previous by thread: Re: preparing multiple choice questions
  • Next by thread: Re: preparing multiple choice questions