// Version History // 0.0.1 Created blaquiz.php // 0.0.2 Added for questions and answers $version = "BlaQuiz Version: 0.0.2"; $questions = array ( "How many bits in a byte?", "What does TTP mean?", "What does RAM stand for?", "What does ROM stand for?", "What does CPU stand for?", "What does GPU stand for?", "Checking a computer program for errors is called what?", "The term BASIC is an acronym for what?", "Grace thought of a number, added 7, multiplied by 3, took away 5 and divided by 4 to give an answer of 7. What was her starting number?", "John starts with a number. He squares it, then takes away 5, next multiplies it by 4, takes away 7, divides it by 3 and finally adds 6. His answer is 9.What number did he start with? ", "If ADD = 9, BAD = 7, and CAD = 8 what is the value of ADA?", "If DATA = 52, CACHE = 40 and BIT = 62. What is the value of BABBAGE?", "Who coined the term Web 2.0?", "The Internet began with the development of?" ); $answers = array ( "8", "Time To Poo", "Random Access Memory", "Read Only Memory", "Central Processing Unit", "Graphical Processing Unit", "Debugging", "Beginner's All-purpose Symbolic Instruction Code", "4", "3", "6", "40", "Dale Dougherty", "ARPANET" ); // get the input $stdin = read_stdin(); $stdin = explode(" ", $stdin); $out = ""; $token = ""; if(isset($stdin[0])) { switch ($stdin[0]) { case "-q": $id = rand(0,sizeof($questions) - 1); $out = "ID: $id $questions[$id]"; break; case "-a": if(isset($stdin[1]) && isset($stdin[2])) { //Check question ID $id = $stdin[1]; if($id < sizeof($questions)) { //get answer $answer = ""; for($i=2; $i