<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4249438776453653932</id><updated>2023-05-06T21:49:30.846-07:00</updated><title type='text'>Travelling and Tracking Knowledge</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://doyouknww.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4249438776453653932/posts/default'/><link rel='alternate' type='text/html' href='https://doyouknww.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Travelling and Tracking Knowledge</name><uri>http://www.blogger.com/profile/00934996177338927497</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4249438776453653932.post-7309490028334998308</id><published>2023-04-18T01:03:00.005-07:00</published><updated>2023-05-06T21:35:45.071-07:00</updated><title type='text'></title><content type='html'>&lt;!doctype html&gt;
&lt;html&gt;&lt;head&gt;
&lt;meta charset=&#39;utf-8&#39;&gt;
&lt;meta name=&#39;viewport&#39; content=&#39;width=device-width, initial-scale=1&#39;&gt;
&lt;title&gt;Exam Preparation MCQ&lt;/title&gt;
&lt;link href=&#39;&#39; rel=&#39;stylesheet&#39;&gt;
&lt;link href=&#39;&#39; rel=&#39;stylesheet&#39;&gt;
&lt;style&gt;#quizWrap {
    max-width: 600px;
    margin: 0 auto;
}

#quizQn {
    padding: 20px;
    background: #4c93ba;
    color: #fff;
    font-size: 24px;
    border-radius: 10px;
}

#quizAns {
    margin: 10px 0;
    display: grid;
    grid-template-columns: auto auto;
    grid-gap: 10px;
}

#quizAns input[type=radio] {
    display: none;
}

#quizAns label {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px;
    font-size: 20px;
    cursor: pointer;
    text-align: center;
}

#quizAns label.correct {
    background: #d8ffc4;
    border: 1px solid #60a03f;
}

#quizAns label.wrong {
    background: #ffe8e8;
    border: 1px solid #c78181;
}

* {
    font-family: arial, sans-serif;
    box-sizing: border-box;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    background: rgb(238, 174, 202);
    background: radial-gradient(circle, rgba(238, 174, 202, 1) 0%, rgba(148, 187, 233, 1) 100%);
}

.widget-wrap {
    width: 600px;
    padding: 30px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.4);
}&lt;/style&gt;
                                &lt;script type=&#39;text/javascript&#39; src=&#39;&#39;&gt;&lt;/script&gt;
                                &lt;script type=&#39;text/javascript&#39; src=&#39;https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js&#39;&gt;&lt;/script&gt;
                                &lt;script type=&#39;text/javascript&#39; src=&#39;&#39;&gt;&lt;/script&gt;
                            &lt;/head&gt;
                            &lt;body oncontextmenu=&#39;return false&#39; class=&#39;snippet-body&#39;&gt;
                            &lt;div class=&quot;widget-wrap&quot;&gt;
    &lt;h1&gt;SIMPLE JS QUIZ&lt;/h1&gt;
    &lt;div id=&quot;quizWrap&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
                            &lt;script type=&#39;text/javascript&#39;&gt;var quiz = {
data: [
{
q: &quot;What is the standard distance between the target and archer in Olympics?&quot;,
o: [
&quot;50 meters&quot;,
&quot;70 meters&quot;,
&quot;100 meters&quot;,
&quot;120 meters&quot;],

a: 1
},
{
q: &quot;Which is the highest number on a standard roulette wheel?&quot;,
o: [
&quot;22&quot;,
&quot;24&quot;,
&quot;32&quot;,
&quot;36&quot;],

a: 3 },

{
q: &quot;How much wood could a woodchuck chuck if a woodchuck would chuck wood?&quot;,
o: [
&quot;400 pounds&quot;,
&quot;550 pounds&quot;,
&quot;700 pounds&quot;,
&quot;750 pounds&quot;],

a: 2 },

{
q: &quot;Which is the seventh planet from the sun?&quot;,
o: [
&quot;Uranus&quot;,
&quot;Earth&quot;,
&quot;Pluto&quot;,
&quot;Mars&quot;],

a: 0 },

{
q: &quot;Which is the largest ocean on Earth?&quot;,
o: [
&quot;Atlantic Ocean&quot;,
&quot;Indian Ocean&quot;,
&quot;Arctic Ocean&quot;,
&quot;Pacific Ocean&quot;],

a: 3 }],

hWrap: null, // HTML quiz container
hQn: null, // HTML question wrapper
hAns: null, // HTML answers wrapper

now: 0, // current question
score: 0, // current score

init: () =&gt; {
quiz.hWrap = document.getElementById(&quot;quizWrap&quot;);

quiz.hQn = document.createElement(&quot;div&quot;);
quiz.hQn.id = &quot;quizQn&quot;;
quiz.hWrap.appendChild(quiz.hQn);

quiz.hAns = document.createElement(&quot;div&quot;);
quiz.hAns.id = &quot;quizAns&quot;;
quiz.hWrap.appendChild(quiz.hAns);

quiz.draw();
},

draw: () =&gt; {
quiz.hQn.innerHTML = quiz.data[quiz.now].q;

quiz.hAns.innerHTML = &quot;&quot;;
for (let i in quiz.data[quiz.now].o) {
let radio = document.createElement(&quot;input&quot;);
radio.type = &quot;radio&quot;;
radio.name = &quot;quiz&quot;;
radio.id = &quot;quizo&quot; + i;
quiz.hAns.appendChild(radio);
let label = document.createElement(&quot;label&quot;);
label.innerHTML = quiz.data[quiz.now].o[i];
label.setAttribute(&quot;for&quot;, &quot;quizo&quot; + i);
label.dataset.idx = i;
label.addEventListener(&quot;click&quot;, () =&gt; {quiz.select(label);});
quiz.hAns.appendChild(label);
}
},

select: option =&gt; {
let all = quiz.hAns.getElementsByTagName(&quot;label&quot;);
for (let label of all) {
label.removeEventListener(&quot;click&quot;, quiz.select);
}

let correct = option.dataset.idx == quiz.data[quiz.now].a;
if (correct) {
quiz.score++;
option.classList.add(&quot;correct&quot;);
} else {
option.classList.add(&quot;wrong&quot;);
}

quiz.now++;
setTimeout(() =&gt; {
if (quiz.now &lt; quiz.data.length) {quiz.draw();} else { quiz.hQn.innerHTML=`You have answered ${quiz.score} of ${quiz.data.length} correctly.`; quiz.hAns.innerHTML=&quot;&quot; ; } }, 1000); }, reset: ()=&gt; {
    quiz.now = 0;
    quiz.score = 0;
    quiz.draw();
    } };

    window.addEventListener(&quot;load&quot;, quiz.init);&lt;/script&gt;
                            &lt;/body&gt;
                        &lt;/html&gt;</content><link rel='replies' type='application/atom+xml' href='https://doyouknww.blogspot.com/feeds/7309490028334998308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://doyouknww.blogspot.com/2023/04/online-quiz-tests.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4249438776453653932/posts/default/7309490028334998308'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4249438776453653932/posts/default/7309490028334998308'/><link rel='alternate' type='text/html' href='https://doyouknww.blogspot.com/2023/04/online-quiz-tests.html' title=''/><author><name>Travelling and Tracking Knowledge</name><uri>http://www.blogger.com/profile/00934996177338927497</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>