Developing a Short and Simple IQ Test Online Using PHP

If you are a school administrator wanting to have an IQ test online, then this tutorial is for you. It can be used not only in the field of academics, but in the instances where you need to draw user interest to your website. An IQ test is a popular feature to incorporate into your website, and will attract a large amount of web traffic over time.

Overview

The objective of the IQ test is to quantitatively measure intelligence. The measurement is what makes this test very popular, because one can be classified as an “Idiot," "Normal” or a “Genius.”

Developing an IQ test sounds complex, but I will make it very simple. The approach to designing a test involves considering the different aspect, not just focusing on the test questions.

The factors to consider when designing a test online include:

  1. Length – The test should be short, because it is very annoying to have a long test; no one really cares to answer it all. About 10 test questions will do. Of course you sacrifice the quality of the test, but it is the user experience which is more important in the online world.

  2. User-friendliness – This factor is very important. Forcing anyone to register first by entering personal details is a complete turn-off; many users will consider it a waste of time. Also, having fancy navigation and using a lot of graphics will slow down the web page and should be avoided.

  3. Speed of results  – I have seen online tests that require the user to register before letting them know their IQ. This is another waste of time and should not be considered as part of the design.

There are basically two approaches you can take when you design an IQ test online.

  1. PHP only

  2. PHP with MySQL database

The first one is recommended if you only need ten questions in the test. The second one is advised if you have a lot of questions to give. MySQL works as an “answer key” in this case. The PHP portion interacts with the browser and will be the one to ask questions to the user using a form. After that, it will connect to MySQL to determine whether the answers are correct. The PHP portion will then compute the final grade according to the results.

The scope of this article is to illustrate the first approach only. MySQL database examples will be illustrated in future tutorials.

{mospagebreak title=Designing an IQ Grading System}

I am not in the academics field, but those ten questions should quantitatively determine the IQ of the person. The challenge is how to rate it. Below are the ways I would rate those test questions:



Test Question number

Score if Correct (Mental Age)

1(elementary level)

3

2(elementary level)

3

3(elementary level)

3

4(secondary level)

3

5(secondary level)

3

6(secondary level)

3

7(tertiary level)

4

8(tertiary level)

4

9(professional)

4

10(professional)

30

Total Mental Age (Score)

60


Since IQ is defined as:

Mental Age/ Chronological Age x 100

It is very easy to score the test. It requires the user to enter their chronological age at the time they take the test. The result of their test determines their mental age (summation of their scores). Dividing those data and multiplying by 100 gives the IQ.

In the above table, each test question has corresponding mental age score. For example, a certain user only correctly answers question 1 to 6 and he is 30 years old at the time of the test. The IQ computation will be:

Mental age score (total of question 1 to 6) = 18

Chronological age = 30

IQ = (Mental Age/ Chronological Age) x 100 = (18/30) x 100 = 60

Likewise, if the age of the person is 28 and he is able to answer question 1 to 10. The IQ is around:

Mental age = 60

Chronological age= 28

IQ= (Mental Age/ Chronological Age) x 100 = (60/28) x 100 = 214

Disclaimer: This method is not guaranteed to fully measure the intellectual capacity of the person.

The Test questions

Test questions can vary depending on your choice. In this article I will illustrate 10 questions that will be used in the PHP programming. This is not guaranteed to be a perfect test, but it will roughly measure your intelligence.

Test question 1: What is the approximate shape of orange fruit, it starts with “r”?

Test question 2: What is the product of 5 and 3?

Test question 3: If I have 3 apples and 12 mangoes, how many fruits do I have?

Test question 4: -5 + (+9)-(-8) is how much?

Test question 5: The result of 2 to the power of 6 divided by eight squared is how much?

Test question 6: If I have a right triangle whose two shorter sides are 5 and 12 respectively, how long is the longest side?

Test question 7: What is the name of  a  popular TV news network with two “Ns” comprised of 3 letters as initials?

Test question 8: In 2008, John is 2 times older than Jerry. In  2040, Jerry will be 46 years old. Find John’s year of birth.

Test question 9: If you are using Excel, which function offers the most convenient and most popular approach for extracting data from other spreadsheets or workbooks without using the manual copy and paste method? This is a one word answer.

Test question 10. If a 65-year-old couple retires today, how much may they need today to cover their future health care cost? This answer is only a figure and does not include a dollar sign.

{mospagebreak title=The HTML Test Form}

Test forms of the above questions can be created in a straightforward manner using HTML. Below is the complete source code:

<HTML>

<HEAD>

<TITLE>An 10 Question IQ Test</TITLE>

</HEAD>

<BODY>

<form action="IQ.php" method="post">

Please enter your age now <input type="text" name="age" size="2">

<br /><br />

Below are the 10 questions for this IQ Test. ALL ANSWERS IN LOWERCASE PLEASE.Answer as honestly as you can.

<br /><br />

Test question 1: What is the approximate shape of orange fruit, it starts with "r". <input type="text" name="T1" size="30">

<br /><br />

Test question 2: What is the product of 5 and 3? <input type="text" name="T2" size="30">

<br /><br />

Test question 3: If I have 3 apples and 12 mangoes, how many fruits do I have? <input type="text" name="T3" size="30">

<br /><br />

Test question 4: -5 + (+9)-(-8) is how much? <input type="text" name="T4" size="30">

<br /><br />

Test question 5: The result of 2 to the power of 6 divided by eight squared is how much? <input type="text" name="T5" size="30">

<br /><br />

Test question 6: If I have a right triangle whose two shorter sides are 5 and 12 respectively, how long is the longest side? <input type="text" name="T6" size="30">

<br /><br />

Test question 7: What is the name of  a  popular TV news network with two “Ns” comprised of 3 letters as initials? <input type="text" name="T7" size="30">

<br /><br />

Test question 8: In 2008, John is 2 times older than Jerry. In 2040, Jerry will be 46 years old. Find John’s year of birth. <input type="text" name="T8" size="30">

<br /><br />

Test question 9: If you are using Excel, which function offers the most convenient and most popular approach for extracting data from other spreadsheets or workbooks without using the manual copy and paste method. This is a one word answer. <input type="text" name="T9" size="30">

<br /><br />

Test question 10: If a 65 year old couple retires today how much may they need today to cover their future health care cost? This answer is only a figure and does not include a dollar sign. <input type="text" name="T10" size="30">

<br /><br />


<input type="submit" value="Compute my IQ now!">

</form>

</BODY>

</HTML>


{mospagebreak title=PHP Script to Process}

Below is the source code of IQ.php


<HTML>

<HEAD>

<TITLE>Your IQ Test Result!</TITLE>

</HEAD>

<BODY>

<?php

//Initialize variables

  $T1 = $_POST['T1'];

  $T2 = $_POST['T2'];

  $T3 = $_POST['T3'];

  $T4 = $_POST['T4'];

  $T5 = $_POST['T5'];

  $T6 = $_POST['T6'];

  $T7 = $_POST['T7'];

  $T8 = $_POST['T8'];

  $T9 = $_POST['T9'];

  $T10 = $_POST['T10'];

   $empty=strlen($_POST['age']);

     if ($empty==0)

{

  die(‘You forgot to enter your age. Press back.Thanks.’);

}

  else

{

  $chronologicalage = $_POST['age'];

}


//1

   if($T1 == round)

{

  $TS1 = 3;

}

   else

{

  $TS1 = 0;

}

//2

   if($T2 ==15)

{

  $TS2 = 3;

}

   else

{

  $TS2 = 0;

}

//3

   if($T3 == 15)

{

  $TS3 = 3;

}

   else

{

  $TS3 = 0;

}

//4

   if($T4 == 12)

{

  $TS4 = 3;

}

   else

{

  $TS4 = 0;

}

//5

   if($T5 == 1)

{

  $TS5 = 3;

}

   else

{

  $TS5 = 0;

}

//6

   if($T6 == 13)

{

  $TS6 = 3;

}

   else

{

  $TS6 = 0;

}

//7

   if($T7 =="cnn")

{

  $TS7 = 4;

}

   else

{

  $TS7 = 0;

}

//8

   if($T8 == 1980)

{

  $TS8 = 4;

}

   else

{

  $TS8 = 0;

}

//9

   if($T9 =="vlookup")

{

  $TS9 = 4;

}

   else

{

  $TS9 = 0;

}

//10

   if($T10 == 360000)

{

  $TS10 = 30;

}

   else

{

  $TS10 = 0;

}

//Total mental age scores

$mentalage= $TS1 + $TS2+ $TS3+ $TS4+ $TS5+ $TS6+ $TS7+ $TS8+ $TS9+ $TS10;

  $IQ= ($mentalage/$chronologicalage)*100;

echo "<br />Hi, your IQ is:"." ".round($IQ,0);

echo "<br />";

echo "<br />Thank you for taking this test!<br />"

?>

</BODY>

</HTML>


Basically, you can vary the test questions but never the scoring. You can use this type of test online. Please note that this is not guaranteed to be accurate because it is just a 10 question test.

[gp-comments width="770" linklove="off" ]
antalya escort bayan antalya escort bayan