"Which of the following variable names will cause an error in Python?", "options" => ["count", "_value", "2value", "value2"], "answer" => "2value" ], [ "question" => "What will be the output of: print(type(5))?", "options" => ["int", "", "integer", "number"], "answer" => "" ], [ "question" => "Which statement correctly converts user input into integer?", "options" => [ "x = input()", "x = int(input())", "x = input(int)", "x = readInt()" ], "answer" => "x = int(input())" ], [ "question" => "Which condition will execute the block only if x is greater than 10?", "options" => [ "if x = 10", "if x > 10", "if x >= 10", "if x != 10" ], "answer" => "if x > 10" ], [ "question" => "How many times will the loop run? for i in range(1, 5):", "options" => ["3", "4", "5", "Infinite"], "answer" => "4" ] ]; /* =============================== FORM SUBMIT =============================== */ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $score = 0; $total = 0; foreach ($questions as $index => $q) { if (isset($_POST['q'.$index])) { $total++; if ($_POST['q'.$index] === $q['answer']) { $score++; } } } $percentage = ($score / $total) * 100; $_SESSION['final_attempted'] = true; $_SESSION['final_score'] = $percentage; /* 🔥 PASS topic_id TO RESULT PAGE */ header("Location: /rs_lab/final_assessment_result.php?topic_id=$topic_id"); exit; } ?> Final Assessment | RS Learning Lab

🏁 Final Assessment

$q): ?>