<?php
class Quest 
{
   public $text;
   public $points;
   public $answers;
   public $correctAnswer;
   
function __construct($text,$points,$answers,$correctAnswer)  
{
    $this->text             =$text;
    $this->points           =$points;
    $this->answers          =$answers;
    $this->correctAnswer    =$correctAnswer;
}

function printQ()  {

$i=1;
echo "$i) $this->text  $k\n";
foreach($this->answers as $letter => $answer)  {
echo "$letter. $answer\n";
$i++;
}
}

function checkQ($ans)  {
    for($j=0; $j<count($ans); $j++)  {
        if($this->correctAnswer==$ans[$j])  {
        echo "Вопрос $this->text Дан ответ $ans[$j] - Ответ правильный\n";
}

if($this->correctAnswer!=$ans[$j])  {
    echo "Вопрос $this->text Дан ответ $ans[$j] - Ответ не правильный, правильный ответ $this->correctAnswer\n";
}

return $this->points;
}
}
}

$q1=new Quest ("Столица Норвегии",10,array('a'=>'Прага','b'=>'Осло','c'=>'Берлин','d'=>'Стокгольм'),"b");
$q2=new Quest ("Год начала второй мировой войны",5,array('a'=>'1941','b'=>'1912','c'=>'1939','d'=>'1895'),"b");
$q3=new Quest ("Кто создал теорию относительности",10,array('a'=>'Ван Дамм','b'=>'Резерфорд','c'=>'Максвелл','d'=>'Эйнштейн'),"d");

$ans=array("b","c","d");

$que=array($q1,$q2,$q3);

foreach($que as $que1)  {
     $totalPoints+=$que1->checkQ($ans);
}

echo $totalPoints;
// your code goes here