MMPC Online Testing

Technologies: PHP, Javascript, HTML, CSS

MMPC Online Testing PortalMMPC’s human resources department had a simple problem: they needed to replace the paper assessment tests given to job applicants. The paper tests required frequent revision and printing, tests were being lost which caused delays and inconvenience in the hiring process, and of course grading the tests required the valuable time of the human resources staff. The solution: move the tests to the MMPC intranet, automate the test correction process, and email the results to the human resources personnel who needed to see them.

Unparsed Quiz FileThe requirements for the tests were these: questions needed to support true/false, multiple choice, multiple choice with multiple answers, and short answer; tests should be able to be broken up into multiple pages with appropriate navigation between pages; the format for the quizzes had to be simple and easy for a non-technical person to update or create. This last point proved to be the key to the whole project. I looked at many possibilities: Javascript and PHP arrays, XML, CSV. The technical solutions all suffered a fatal flaw by either being too complicated for a lay person or too simple to carry the necessary information in an easy to read format.

It quickly became apparent that a custom file format was required, something easy to read, easy to understand at a glance, and uncomplicated to edit. What I came up with was a system whereby the structure of the content in combination with a short prefix would dictate the structure and type of question. PageHeader denoted the beginning of a new page. Q denoted the beginning of a new question. A denoted an answer option to the previous Q. M denoted a matching option for multiple choice multiple answer questions. A simple asterisk next to an answer identified the correct answer.

Parsed Quiz FileWhen a test was chosen from the testing portal the selected quiz file would be opened in PHP, parsed, and converted into a well-formatted HTML form. Questions with single answers would be displayed as short answer; questions with two answers would be displayed as true/false; questions with more than two answer options but only one correct answer would show as multiple choice (radio buttons); and questions with matching options as well as answers displayed as multiple choice multiple answer.

PHP Quiz ParserUpon completing the test, the test answers would be submitted to a PHP script that would parse the test answers against the quiz structure, score the test, and email the results to the human resources department.