Bulletin UASVM Horticulture, 69(2)/2012 Print ISSN 1843-5254; Electronic ISSN 1843-5394 Randomly Generated Multiple-Choice Tests Using (La)Tex and Pseudorandom Number Generators Cristina-Olimpia RUS1), Mircea-Dan RUS2) 1) Faculty of Horticulture, University of Agricultural Sciences and Veterinary Medicine Cluj-Napoca, Calea Mănăştur 3-5, 400372 Cluj-Napoca, Romania; [email protected]. 2) Faculty of Automation and Computer Science, Technical University of Cluj-Napoca, Str. Memorandumului 28, 400114 Cluj-Napoca, Romania; [email protected]. Abstract. We are interested in developing, using TeX/LaTeX and a pseudorandom number generator (PRNG), an automated system for student exams that would generate for each student a unique multiple-choice test, based on a previously constructed database of multiple-choice problems. Even with a small set of problems, we show that it is possible to obtain a large variation of tests, by randomly selecting and randomly ordering the problems, based on predefined criteria, and by randomly permuting the choices of each problem. Keywords: LaTeX, linear congruential generator, multiple-choice test, PRNG, TeX Introduction. The use of multiple-choice tests in evaluating the knowledge, skills and abilities of students is still one of the most commonly used assessment formats worldwide. Though often maligned, when it is well and carefully prepared, it allows transparent and comprehensive coverage of content in a remarkably effective way. The preparation of a multiple-choice test for a large number of students usually requires the tests to be different from one student to another (in order to avoid “dishonest practices” that are typical to this type of test), yet overall similar, in order to achieve an accurate and impartial assessment. This task can be a tedious one if it is not approached in a systematic manner. Aims and objectives. Our goal is to design and implement, using free multiplatform computer software, an automated process of generating large numbers of individual multiplechoice tests from a small number of items (i.e., questions, problems, sets of questions or problems, etc.) that are grouped by similarity, using randomized selection based on similarity and by permutation of the order of items in each test and of choices in each item. Materials and methods. In designing the “multiple-choice test generator” (MCTG), we choose to put each item in a separate file and then organize the files in folders by similarity of the items. Then, we define a three-step procedure that randomly selects one item from each group, permutes the choices of each item and finally places all the items in a random order to build a test. The randomization is achieved using a standard linear congruential generator from (Lewis et al., 1969) as the pseudorandom number generator, and the algorithm of (Fisher and Yates, 1948) for generating (pseudo)random permutations; we refer also to the modifications of these algorithms in (Durstenfeld, 1964) and (Knuth, 1998). We choose to implement the MCTG using TeX (and LaTeX), which is a system for computer typesetting that is freely available on all major operating systems and which has the advantages of being fast, stable, flexible, popular, standard, easy to learn, content-oriented and having better output than “normal” word processors or text editors, while being mathfriendly (see (Knuth, 1984)). In this way, each item is created as a standalone .tex file, which is then randomly selected by a master .tex file that finally outputs the tests into a single PDF file. 537 The basis of our implementation is the definition of a new LaTeX environment that permutes the order in which its contents is typeset. These environments can be nested, in order to achieve the complexity required by the MCTG. The idea started from a recent discussion on tex.stackexchange.com (see http://tex.stackexchange.com/questions/40815/). For the generation of pseudorandom numbers, we use the implementation of the linear congruential generator of Lewis et al. given by Donald Arseneau in “random.tex”, that is included in all standard LaTeX distributions. Also, the paper of (v. Bechtolsheim, 1988) provided an excellent tutorial into the subtleties of TeX coding. Results and Discussion. The result of our work is a LaTeX package that can be easily used by anyone familiar with TeX and LaTeX to build (on-the-fly) a large number of different multiple-choice tests provided that the questions/problems have been previously created using a predefined and flexible template. As an example, using a set of 50 problems grouped in 25 folders of 2 similar problems each, we generated (based on the principles described in the previous sections) a number of 1000 different random tests, each containing 25 problems, a process that took about 6 minutes on a regular PC. The system is flexible enough to allow almost any kind of customization in the way the text is formatted or in the page layout, while it can be expanded to include other type of tests where variation can be achieved by single or complex randomization. Further developments will include automatic generation of random questions or problems based on predefined templates. Our system is a viable alternative to existing LaTeX packages, like “eqexam” or to other more complex solutions (e.g., (Grün and Zeileis, 2008), (Sojka, 2003)) Conclusion. We addressed the problem of designing and implementing a multiplechoice test generator, using free multiplatform computer software. The result is a LaTeX package that can be used to build very fast any number of random tests from a limited set of questions. The formatting and typographical layout of the tests is fully customizable. Future versions of the package will include automatic generation of random problems based on predefined templates. REFERENCES 1. Bechtolsheim, S. (1988). A tutorial on \expandafter. TUGboat 9:57-61. 2. Durstenfeld, R. (1964). Algorithm 235: Random permutation. Communications of the ACM 7:420. 3. Fisher, R.A. and Yates, F. (1948). Statistical tables for biological, agricultural and medical research. 3rd ed. Oliver and Boyd, London. 4. Grün, B. and A. Zeileis (2008). Automatic generation of simple (statistical) exams. Research Report Series / Department of Statistics and Mathematics, 77. WU Vienna University of Economics and Business. 5. Knuth, D.E. (1984). The TeXbook. Computers and Typesetting, Volume A. Addison-Wesley, Boston. 6. Knuth, D.E. (1998). The art of computer programming, Volume 2. 3rd ed. Addison–Wesley, Boston. 7. Lewis, P.A., A.S. Goodman and J.M. Miller (1969). A pseudo-random number generator for the System/360. IBM Syst. J 8:136-146. 8. Sojka, P. (2003). Rapid evaluation using multiple choice tests and TeX. SIGCSE Bull. 35:265. 538
© Copyright 2026 Paperzz