Advertisement
Guest User

quiz answers

a guest
May 20th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.41 KB | None | 0 0
  1.  
  2.  
  3. <fieldset>
  4.             <legend id="q1"> What are one of the basic rules while writing XML?</legend>
  5.             <p>
  6.                 <label for="o1"><input type="radio" name="XMLRule" id="o1" value="XML should have no root element" required="required"/>All XML should have no root element at all</label>
  7.                 <br>
  8.                 <label for="o2"><input type="radio" name="XMLRule" id="o2" value="Attribute must appear outside quotes" required="required" />Attribute value must appear outside quotes</label>
  9.                 <br>
  10.                 <label for="o3"><input type="radio" name="XMLRule" id="o3" value="Tags should be closed" required="required" />All tags should be closed</label> <!-- first answer -->
  11.                 <br>
  12.                 <label for="o4"><input type="radio" name="XMLRule" id="o4" value="Tag contains spaces" required="required" />Tag names contain spaces</label>
  13.             </p>
  14.         </fieldset>
  15.  
  16.         <br>
  17.  
  18.         <fieldset>
  19.             <legend id="q2">When was SGML first developed?</legend>
  20.             <p>
  21.                 <select name="DevelopedWhen" id="DevelopedWhen" required="required">
  22.                     <option value="">Please select</option>
  23.                     <option value="1980">1980's</option>
  24.                     <option value="21">21st century</option>
  25.                     <option value="1990">1990's</option>
  26.                     <option value="1960s" id="1960s">1960's</option> <!-- second answer -->
  27.                 </select>
  28.             </p>
  29.         </fieldset>
  30.  
  31.         <br>
  32.  
  33.         <fieldset>
  34.             <legend id="q3">What does SGML stand for?</legend>
  35.             <p>
  36.                 <label for="sgml">Answer:</label> <!-- third answer: "Standard Generalized Markup Language" -->
  37.                 <input type="text" name="sgml" id="sgml" maxlength="50" size="20" />  
  38.             </p>
  39.         </fieldset>
  40.  
  41.         <br><br>
  42.  
  43.         <fieldset>
  44.             <legend id="q4">What are the differences between HTML and XML? (more than one correct answer)</legend>
  45.             <p>
  46.                 <label for="option1">Case sensitivity</label>
  47.                 <input id="option1" type="checkbox" name="html_xml_differences" value="Case sensitivity"/> <!-- fourth answer -->
  48.  
  49.                 <br>
  50.  
  51.                 <label for="option2">Designing web pages</label>
  52.                 <input id="option2" type="checkbox" name="html_xml_differences" value="Designing web pages" />
  53.  
  54.                 <br>
  55.  
  56.                 <label for="option3">Tags</label>
  57.                 <input id="option3" type="checkbox" name="html_xml_differences" value="Tags" />
  58.  
  59.                 <br>
  60.  
  61.                 <label for="option4">Preserving white spaces</label>
  62.                 <input id="option4" type="checkbox" name="html_xml_differences" value="Preserving white spaces" /> <!-- fifth answer -->
  63.             </p>
  64.             <br>
  65.  
  66.         </fieldset>
  67.  
  68.         <br><br>
  69.  
  70.         <fieldset>
  71.             <legend id="q5">What are 2 features of XML? (more than one correct answer)</legend>
  72.             <p>
  73.                 <label for="xml_features1"></label>
  74.                 <label for="xml_features1">Decreases data availability</label>
  75.                 <input id="xml_features1" type="checkbox" name="xml_features" value="Decreases data availability"/>
  76.  
  77.                 <br>
  78.  
  79.                 <label for="xml_features2">Used to create new programming languages</label>
  80.                 <input id="xml_features2" type="checkbox" name="xml_features" value="Used to create new programming languages" />
  81.  
  82.                 <br>
  83.  
  84.                 <label for="xml_features3">Simplifies data sharing</label>
  85.                 <input id="xml_features3" type="checkbox" name="xml_features" value="Simplifies data sharing" /> <!-- sixth answer -->
  86.  
  87.                 <br>
  88.  
  89.                 <label for="xml_features4">Separates data from HTML</label>
  90.                 <input id="xml_features4" type="checkbox" name="xml_features" value="Separates data from HTML" /> <!-- seventh answer -->
  91.             </p>
  92.         </fieldset>
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102. function setCorrectAnswers() {
  103.  
  104.        $correct = 0;
  105.  
  106.        $myanswers = array ($_GET["o3"], $_GET["1960s"], $_GET["sgml"], $_GET["option1"], $_GET["option4"], $_GET["xml_features3"], $_GET["xml_features4"]);
  107.  
  108.        $useranswers = array ("Tags should be closed", "1960s", "Standard Generalized Markup Language", "Case sensitivity", "Preserving white space", "Simplifies data sharing", "Separates data from HTML");
  109.  
  110.        if ($myanswers[0] == $useranswers[0]) {
  111.          $correct++; }
  112.  
  113.        if ($myanswers[1] == $useranswers[1]) {
  114.          $correct++; }
  115.  
  116.        if ($myanswers[2] == $useranswers[2]) {
  117.          $correct++; }
  118.  
  119.        if ($myanswers[3] == $useranswers[3]) {
  120.          $correct++; }
  121.        
  122.        if ($myanswers[4] == $useranswers[4]) {
  123.          $correct++; }
  124.  
  125.        if ($myanswers[5] == $useranswers[5]) {
  126.          $correct++; }
  127.  
  128.        if ($myanswers[6] == $useranswers[6]) {
  129.          $correct++; }    
  130.  
  131.        return $correct;  
  132.  
  133.       // echo "<p>$correct/7</p>";      
  134.  
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement