A few years ago I was asked by our languages coordinator to ‘digitise’ some diagnostic language tests for students to assess their level of language knowledge prior to enrolment.

The task

The basic remit of the task was that students should take a test and, depending on their score, be directed to enrol on a course designed for their target language level. Scores did not need to be stored for future access, and no student data needed to be collected.

I was provided with word documents consisting of tests for 5 languages; each test was divided into 5 sections of 10 questions; the questions were all three-item multiple choice (MCQs) with one correct answer; the 5 sections increased in order of difficulty, corresponding roughly to CEFR levels A1, A2, B1, B2, C1.

Test parameters

There were two basic parameters for each test:

  • If a student scored less than 5/10 on a level, then they would be directed to the enrolment page for their designated level.
  • If they scored 5/10 or above, they would be directed to the next level, thereby progressing. The two parameters would then apply to the current level.

I decided to use PHP to accomplish this. PHP stands for ‘PHP Hypertext Preprocessor’ (a recursive acronym), a server-side scripting language that is relatively easy to write.

Programming logic

  • Each test consists of a page of questions for each section.
  • Each page sets a global Session $_SESSIONvariable that, on submission, is passed to the answer-checking PHP page.
  • The questions for each section are stored in arrays, which are called into a function using a foreach loop structure to output the 10 questions to HTML radio button form fields.
  • A submit button calls a post method method=post to action a php file containing the correct answers.
  • The answers file contains the correct answers stored in arrays for each level.
  • The Session value is passed to a function, which:
    • loops through the answers array,
    • compares each submitted answer with the stored correct answers
    • adds a score of 1 per each correct answer and passes the result to an if ... else control structure
    • depending on the score, a switch control prints an approprite response to the HTML page, informing the student of their score and directing to either the enrolment page or the next page of the test.

Thus, a very simple form of computer-adaptive test was created for 5 different languages. You can try them yourself here:

Chinese Diagnostic Test

French Diagnostic Test

German Diagnostic Test

Japanese Diagnostic Test

Spanish Diagnostic Test