See Questions Before Listening Audio/Reading Text in Quiz

See Questions Before Listening Audio/Reading Text in Quiz

by Breana Watts -
Number of replies: 2

Hello,

Is it possible to show the questions of a listening quiz for a certain amount of time (i.e., 2 minutes) before students can access the audio? What I want is for the students to have 2-3 minutes to read through the questions before the listening starts. Then, once the listening stops they have to submit their questions.

My second question, is it possible to do the same for a reading quiz? I want the students to be able to read the questions first for 2-3 minutes before they can access the reading text. Also, is it possible to make it so students cannot copy and paste the reading text? 

Many thanks!

Average of ratings: -
In reply to Breana Watts

Re: See Questions Before Listening Audio/Reading Text in Quiz

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Breana,

You can try the Active quiz plugin which has timed questions. However, active quizzes are in real time.

To prevent copying, use the Safe exam browser.

As a quick workaround, you can make timed questions using some simple javascript (no jQuery!):

<div id="id_20200410_2003"></div>
<br>
<p>The language being spoken is English?</p>
<script>
function myFunction() {
  if (sessionStorage.getItem("started") == "yes") {
    var start =  Number(sessionStorage.getItem("starttime"));
  } else {
    var start= new Date().getTime();
    sessionStorage.setItem("started", "yes");
    sessionStorage.setItem("starttime", start.toString());
  }
  if (sessionStorage.getItem("read") == "finished") {
    var x = document.getElementsByClassName("description");
    x[0].style.display = "none";
    var x = document.getElementsByClassName("truefalse");
    x[0].style.display = "initial";
  } else {
    var duration = 30000;
    var x = document.getElementsByClassName("description");
    x[0].style.display = "initial";
    document.getElementById("description").style.display= "initial";
    var x = document.getElementsByClassName("truefalse");
    x[0].style.display = "none";
    var x = setInterval(function() {
      var now = new Date().getTime();
      var distance = duration - (now - start);
      var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
      var seconds = Math.floor((distance % (1000 * 60)) / 1000);
      if (seconds < 10) {
        document.getElementById("countdown").innerHTML = "0" + minutes + ":0" + seconds;
      }
      if (seconds >= 10) {
        document.getElementById("countdown").innerHTML = "0" + minutes + ":" + seconds;
      }
      if (minutes == 0 && seconds <= 10) {
        document.getElementById("timeleft").style.backgroundColor = "red";
        document.getElementById("timeleft").style.color = "white";
        document.getElementById("countdown").style.color = "white";
      }
      if (minutes < 0 && seconds < 0) {
        var x = document.getElementsByClassName("description");
        x[0].style.display = "none";
        var x = document.getElementsByClassName("truefalse");
        x[0].style.display = "initial";
        sessionStorage.setItem("read", "finished");
      }
    }, 1000);
  }
  var x1 = document.​createElement("AUDIO");
  x1.set​Attribute("src", "ht​tps:​/​/moodleformulas.​org/pluginfile.php/7303/mod_label/intro/Sound_1.mp3");
  x1.set​Attribute("controls", "controls");
  document.getElement​ById("id_20200410_2003").appendChild(x1);
}
window.on​load = myFunction;
</script>

XML files:

Average of ratings: Useful (2)
In reply to Dominique Bauer

Re: See Questions Before Listening Audio/Reading Text in Quiz

by N W -
Hello Dominique
Thanks for posting this code. I used the .XML files you kindly provided but it is not working as shown in your video: 
there is no timer countdown in the body and the page does not automatically move to the next question.
Could you possibly tell me what I  am doing wrong? 
Thank you in advance.
Screenshot