Mathq
Mathq
<head>
<link href=https://fonts.googleapis.com/css?family=Roboto+Slab
rel=”stylesheet”>
</head>
<body>
<div id=”wrapper”>
<nav>
<ul>
</ul>
</nav>
<div id=”form-box”>
<form>
<select id=”language”>
<option value=”HTML”selected=”selected”>HTML</option>
<option value=”CSS”>CSS</option>
<option value=”JS”>Javascript</option>
<option value=”PY”>Python</option>
<option value=”C”>C language</option>
</select>
</form>
</div>
</div>
<div class=”quiz”>
<div id=”info”>
<div id=”ques-left”>Question:1/20</div>
</div>
<div id=”ques-view”>
</div>
<div class=”question”>
<h1>Question</h1>
</div>
<div class=”choice”>
</div>
<div class=”ans-btn”>
</div>
</div>
<div class=”final-result”>
</div>
<script
src=https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js></
script>
<script src=”script.js”></script>
</body>
</html>
//function myfunc(){
// alert(document.getElementById(“language”).value);
//}
Var countQues=0;
Var lang;
Var score=0;
Var HTMLquestions=[
Answer: 2
},
Answer: 3
},
Choices: [“1990”,”1980”,”2000”,”1995”],
Answer: 1
},
Question: “Apart from <b> tag, what other tag makes text bold ?”,
Choices: [“fat”,”strong”,”black”,”emp”],
Answer: 2
},
{/*5*/
Choices: [“dl”,”ol”,”list”,”ul”],
Answer: 2
},
Choices: [“picture”,”image”,”pic”,”img”],
Answer: 4
},
Answer: 3
},
Answer: 1
},
Choices: [“Curly”,”Round”,”Squart”,”Angle”],
Answer: 4
},
{/*10*/
Question: “Tags and test that are not directly displayed on the page are
written in _____ section.”,
Choices: [“head”,”title”,”body”,”html”],
Answer: 1
];
Var CSSquestions=[
Question: “If we want define style for an unique element, then which
css selector will we use ?”,
Choices: [“Id”,”text”,”class”,”name”],
Answer: 1
},
Question: “If we don’t want to allow a floating div to the left side of an
element, which css property will we use ?”,
Choices: [“margin”,”clear”,”float”,”padding”],
Answer: 2
},
{
Question: “Suppose we want to arragnge five nos. Of DIVs so that DIV4
is placed above DIV1. Now, which css property will we use to control the
order of stack ?”,
Choices: [“d-inex”,”s-index”,”x-index”,”z-index”],
Answer: 4
},
{/*4*/
Question: “Can we align a Block element by setting the left and right
margins ?”,
Answer: 2
},
Choices: [“wrap”,”push”,”float”,”align”],
Answer: 3
},
{/*6*/
Choices: [“pointer”,”default”,”arrow”,”arr”],
Answer: 2
},
{
Question: “If we want to use a nice looking green dotted border around
an image, which css property will we use?”,
Choices: [“border-color”,”border-decoration”,”border-style”,”border-
line”],
Answer: 3
},
{/*8*/
Choices: [“empty-cell”,”blank-cell”,”noncontent-cell”,”void-cell”],
Answer: 1
},
Question: “What should be the table width, so that the width of a table
adjust to the current width of the browser window?”,
Answer: 2
},
Question: “How can we write comment along with CSS code ?”,
Answer: 1
}
];
Var JSquestions=[
Answer: 3
},
{/*wscubetech*/
Choices: [“Function”,”File”,”FilleUpload”,”Data”],
Answer: 2
},
Question: “Java script can be used for Storing the form’s contents to a
database file on the server”,
Choices: [“False”,”True”],
Answer: 1
},
{
Question: “How does Java Script store dates in objects of Date type?”,
Answer: 3
},
Choices: [“False”,”True”],
Answer: 2
},
Choices: [“True”,”False”],
Answer: 2
},
Choices: [“Pathname”,”Protocol”,”Defaultststus”,”Host”],
Answer: 3
},
{
Question: “Which attribute needs to be changed to make elements
invisible?”,
Answer: 1
},
Choices: [“False”,”True”],
Answer: 2
},
Answer: 4
];
Var PYquestions=[
Answer: 1
},
Question: “Given a function that does not return any value, what value
is shown when executed at the shell?”,
Choices: [“int”,”bool”,”void”,”None”],
Answer: 4
},
Answer: 1
},
Answer: 2
},
Answer: 3
},
Choices: [“+5”,”-11”,”+11”,”-5”],
Answer: 1
},
Answer: 3
},
Answer: 1
},
Question: “To start Python from the command prompt, use the
command ______”,
Answer: 3
},
{
Answer: 3
];
Var Cquestions=[
Choices: [“1970”,”1975”,”1980”,”1985”],
Answer: 1
},
Choices: [“auto”,”main”,”case”,”register”],
Answer: 2
},
},
Answer: 3
},
Choices: [“for”,”If”,”do-while”,”while”],
Answer: 3
},
Answer: 3
},
Answer: 2
},
Answer: 3
},
Answer: 3
},
Answer: 4
];
//alert(questions.length);
Document.getElementById(“score”).textContent=”Score : “+0;
Document.querySelector(“.view-results”).style.display=”none”;
Document.querySelector(“.quiz”).style.display=”none”;
Document.querySelector(“.final-result”).style.display=”none”;
Document.querySelector(“.choose-lang”).addEventListener(“click”,function()
{
Lang=document.getElementById(“language”).value+”questions”;
Document.getElementById(“ques-left”).textContent=”Question : “+
(countQues+1)+”/”+window[lang].length;
// alert(window[lang].length);
Document.querySelector(“.quiz”).style.display=”block”;
Document.querySelector(“.question”).innerHTML=”<h1>”+window[lang]
[countQues].question+”</h1>”;
For (i=0;i<=3;i++){
Document.getElementById(“opt”+i).value=window[lang]
[countQues].choices[i];
Document.getElementById(“lb”+i).innerHTML=window[lang]
[countQues].choices[i];
// window.location.href=”#score”;
});
Document.querySelector(“.submit-
answer”).addEventListener(“click”,function(){
// alert(window[lang][countQues].choices[window[lang]
[countQues].answer-1]);
// alert(document.querySelector(‘input[name=”options”]:checked’).value);
If(document.querySelector(‘input[name=”options”]:checked’).value===wind
ow[lang][countQues].choices[window[lang][countQues].answer-1]){
Score+=10;
Document.getElementById(“score”).textContent=”Score : “+score;
Document.getElementById(“ques-view”).innerHTML+=”<div
class=’ques-circle correct’>”+(countQues+1)+”</div>”;
}else{
Score-=5;
Document.getElementById(“score”).textContent=”Score : “+score;
Document.getElementById(“ques-view”).innerHTML+=”<div
class=’ques-circle incorrect’>”+(countQues+1)+”</div>”;
};
If (countQues<window[lang].length-1){
countQues++;
}else{
Document.querySelector(“.submit-answer”).style.display=”none”;
Document.querySelector(“.view-results”).style.display=”unset”;
Document.getElementById(“ques-left”).textContent=”Question : “+
(countQues+1)+”/”+window[lang].length;
Document.querySelector(“.question”).innerHTML=”<h1>”+window[lang]
[countQues].question+”</h1>”;
For (i=0;i<=3;i++){
Document.getElementById(“opt”+i).value=window[lang]
[countQues].choices[i];
Document.getElementById(“lb”+i).innerHTML=window[lang]
[countQues].choices[i];
};/*For loop Closed*/
});
Document.querySelector(“.view-results”).addEventListener(“click”,function()
{
Document.querySelector(“.final-result”).style.display=”block”;
Document.querySelector(“.solved-ques-no”).innerHTML=”You Solved “+
(countQues+1)+” questions of
“+document.getElementById(“language”).value;
Document.getElementById(“display-final-score”).innerHTML=”Your Final
Score is: “+score;
If (correct/(countQues+1)>0.8){
Document.querySelector(“.remark”).innerHTML=”Remark:
OutStanding ! ”;
}else if(correct/(countQues+1)>0.6){
Document.querySelector(“.remark”).innerHTML=”Remark: Satisfactory,
Learn More.”;
}else{
Document.querySelector(“.remark”).innerHTML=”Remark:
Unsatisfactory, Try Again.”;
// window.location.href=”#display-final-score”;
});
Document.getElementById(“restart”).addEventListener(“click”,function(){
Location.reload();
});
Document.getElementById(“about”).addEventListener(“click”,function(){
});
/*Smooth Scroll*/
$(document).on(‘click’, ‘a[href^=”#”]’, function (event) {
Event.preventDefault();
$(‘html, body’).animate({
}, 1000);
});
Body {
Margin: 0px;
Padding: 0px;
Nav{
/* background-color: blueviolet;*/
Height: 50px;
Text-align: right;
Color: #fff;
Font-family: sans-serif;
Margin: 0 auto;
Nav li{
Display: inline-block;
Margin-right: 30px;
Padding: 15px;
Font-size: 20;
.mail{
Text-decoration: none;
Color: #fff;
Cursor: pointer;
#about{
Cursor: pointer;
#wrapper{
Background-image:linear-gradient(rgba(0,0,0,0.7),rgba(0,0,0,0.8)),
url(“hero-img.jpg”);
Background-position: center;
Background-size: cover;
Height: 100vh;
Text-align: center;
#form-box{
/* background-color: aqua;*/
Padding:1%;
Top:50%;
Position: absolute;
Left:40%;
.choose-lang{
Text-decoration: none;
Color: black;
Background-color:#fff;
Margin-left: 30px;
Padding: 15px;
Border-radius: 20px;
Font-family: monospace;
/* letter-spacing: 1.5px;*/
/* font-weight: 400;*/
.choose-lang:hover{
Background-color: #FF9933;
Color:#fff;
Cursor: pointer;
/* width: 120px;*/
Font-size: 110%;
#language{
Background-color:white;
Padding:12px;
Border-radius: 5px;
Cursor:pointer;
#language:hover{
Background-color:#fff;
#language option{
Background-color: #fff;
.quiz{
Background-color: #fff;
Text-align: center;
/* padding: 0%;*/
Margin-top: 20px;
Height: 100vh;
#info{
Height:25px;
Background-color: #fff;
#score{
Width:50%;
Float:left;
Font-size: 25px;
#ques-left{
Width:50%;
Float:left;
Font-size:25px;
#ques-view{
/* background-color:aqua;*/
Height: 35px;
Margin-top: 10px;
Padding: 2px;
.ques-circle{
Float: left;
Border-radius: 50%;
Width: 35px;
Height: 90%;
Margin-left: 10px;
Margin-top: 10px;
.correct{
Background-color: #2ecc71;
.incorrect{
Background-color: #fc5c65;
Color: #fff;
.question{
/* background-color: antiquewhite;*/
Letter-spacing: .13em;
.choice{
Background-color: #fff;
Padding: 3%;
.options{
Background-color: #fff;
Display:block;
Margin-left: 13%;
Font-size: 25px;
Font-weight: 100;
Margin-top: 30px;
Text-align: left;
Input[type=radio] {
Width: 20px;
Height: 1.3em;
Float: left;
.ans-btn{
Background-color: #fff;
Padding: 2%;
}
.submit-answer{
Background-color:white;
Padding: 15px;
Border-radius: 20px;
Font-family: monospace;
.submit-answer:hover{
Background-color: #FF9933;
Padding: 16px;
Color: #fff;
Cursor: pointer;
Border-radius: 20px;
.view-results{
Text-decoration: none;
Color: black;
Background-color:white;
Padding: 15px;
Border-radius: 20px;
Font-family: monospace;
Transition: background-color 0.3s,border 0.2s, color 0.2s;
.view-results:hover{
Background-color: #FF9933;
Padding: 16px;
Color: #fff;
Cursor: pointer;
Border-radius: 20px;
/*Final Results*/
.final-result{
Background-color: #fff;
Text-align: center;
Padding: 10px;
Font-size: 1.5em;
Height: 100vh;
.solved-ques-no{
Padding: 10px;
.right-wrong{
Padding: 10px;
}
#display-final-score{
Padding: 5%;
.remark{
Padding: 5%
#restart{
Background-color:#ff9933;
Margin-left: 30px;
Padding: 15px;
Border-radius: 20px;
Font-size: 80%;
#restart:hover{
Background-color: #FF9933;
Color:#fff;
Cursor: pointer;
/* width: 120px;*/
Font-size: 90%;
Margin-left: 8%
.options{
Margin-left: 4%;
.options{
Display: block;
Margin-top: 3%;
.options{
Margin-top: 3%;
.choose-lang{
Display: block;
Margin-top: 25px;
Margin-left: 0px;
#language{
Display: block;