Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contributors/contributorsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ contributors = [
},
{
id: 2,
fullname: "sample 2",
username: "https://github.com/TechHack3",
fullname: "Kaushik Shetty",
username: "https://github.com/Kaushik100001",
}
];
2 changes: 2 additions & 0 deletions projects/QuizAPP-main/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.vscode/settings.json
45 changes: 45 additions & 0 deletions projects/QuizAPP-main/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet">
<title>Document</title>
</head>
<body id="neutral">

<!-- <p id="points">0</p> -->
<div class="container">
<div class="question hide" id="que">
<div class="q " id="question">
QUESTION
</div>
<div class="option">
<a class="btn" id="op1">option 1</a>
<a class="btn" id="op2">option 2</a>
<a class="btn" id="op3">option 3</a>
<a class="btn" id="op4">option 4</a>
</div>
</div>
<div class="controls">
<button class="cbtn started " id="start" >Start</button>
<button class="cbtn hide " id="next" >Next</button>
<p class="hide" id="P">POINTS:<span id="number">0</span> </p>

</div>




</div>




<script src="index.js"></script>
</body>
</html>
338 changes: 338 additions & 0 deletions projects/QuizAPP-main/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,338 @@
let questions = [
{

question: "Eritrea, which became the 182nd member of the UN in 1993, is in the continent of",
answers: [
{ text: "Asia", correct: "w" },
{ text: "Europe", correct: "w" },
{ text: "Africa", correct : "r" },
{ text: "Australia", correct: "w" }



]

},
{

question: "Grand Central Terminal, Park Avenue, New York is the world's",
answers: [
{ text: "largest railway station", correct: "r" },
{ text: "highest railway station", correct: "w" },
{ text: "longest railway station", correct: "w" },
{ text: "None of Above", correct: "w" }


]

},
{

question: "Hitler party which came into power in 1933 is known as",
answers: [
{ text: "Labour Party", correct: "w" },
{ text: "Nazi Party", correct: "r" },
{ text: "Ku-Klux-Klan", correct: "w" },
{ text: " Democratic Party", correct: "w" }


]

},
{

question: "First China War was fought between",
answers: [
{ text: "China and Britain", correct: "r" },
{ text: "China and France", correct: "w" },
{ text: "China and Egypt", correct: "w" },
{ text: "China and Greek", correct: "w" }


]

},
{

question: "Federation Cup, World Cup, Allywyn International Trophy and Challenge Cup are awarded to winners of",
answers: [
{ text: "Tennis", correct: "w" },
{ text: "Volleyball", correct: "r" },
{ text: "Basketball", correct: "w" },
{ text: "Cricket", correct: "w" }


]

},
{

question: "Guwahati High Court is the judicature of",
answers: [
{ text: "Nagaland", correct: "w" },
{ text: "Arunachal Pradesh", correct: "w" },
{ text: "Assam", correct: "w" },
{ text: " All of the above", correct: "r" }


]

},
{
question: " Fire temple is the place of worship of which of the following religion?",
answers: [
{ text: "Taoism", correct: "w" },
{ text: "Judaism", correct: "w" },
{ text: "Zoroastrianism (Parsi Religion)", correct: "r" },
{ text: "Shintoism", correct: "w" }


]
},
{
question: "Golf player Vijay Singh belongs to which country?",
answers: [
{ text: "USA", correct: "w" },
{ text: "Fiji", correct: "r" },
{ text: "India", correct: "w" },
{ text: "UK", correct: "w" }


]
},
{
question: "Garampani sanctuary is located at",
answers: [
{ text: "Junagarh, Gujarat", correct: "w" },
{ text: "Diphu, Assam", correct: "r" },
{ text: "Kohima, Nagaland", correct: "w" },
{ text: "Gangtok, Sikkim", correct: "w" }


]
},
{
question: "Who amongst the following had called Rabindranath Tagore as THE GREAT SENTINEL ?",
answers: [
{ text: "Abul Kalam Azad", correct: "w" },
{ text: "Mahatma Gandhi", correct: "r" },
{ text: "Dr. Rajendra Prasad", correct: "w" },
{ text: "Subhash Chandra Bose", correct: "w" }


]
},






]


let i = 0;
document.getElementById("next").addEventListener("click", setnewQuestion)




const op1 = document.getElementById('op1');
const op2 = document.getElementById('op2');
const op3 = document.getElementById('op3');
const op4 = document.getElementById('op4');




document.getElementById("start").addEventListener("click", Startgame)




let shuffledQuestion, currentquestionindex



function Startgame() {

document.getElementById("start").classList.add('hide')
document.getElementById("que").classList.remove('hide')
document.getElementById("P").classList.remove('hide')
document.getElementById("neutral").classList.add('neutral')
if(i<=9){

document.getElementById("question").innerText = `${i + 1})` + " " + questions[i].question
option()
}
else{
document.getElementById("que").classList.add('hide')
document.getElementById("P").classList.add('middle')
}


}






function option() {
document.getElementById("op1").innerText = "a)" + " " + questions[i].answers[0].text
document.getElementById("op2").innerText = "b)" + " " + questions[i].answers[1].text
document.getElementById("op3").innerText = "c)" + " " + questions[i].answers[2].text
document.getElementById("op4").innerText = "d)" + " " + questions[i].answers[3].text
}







function setnewQuestion() {
i++;
console.log(i)
Startgame()
document.getElementById("neutral").classList.add('neutral')


}




let P=1


op1.addEventListener("click", () => {
if (questions[i].answers[0].correct === "r") {
document.body.style.backgroundColor = "green";
document.getElementById("op1").style.color = "green";
let a = document.getElementById("number").innerText=P++
setTimeout(() => {
document.body.style.backgroundColor = "#554994";

}, 1500)
setTimeout(() => {
document.getElementById("op1").style.color = "black";
setnewQuestion()
}, 1500)

}
else {
document.body.style.backgroundColor = "red";
document.getElementById("op1").style.color = "red";

setTimeout(() => {
document.body.style.backgroundColor = "#554994";
}, 1500)
setTimeout(() => {
document.getElementById("op1").style.color = "black";
setnewQuestion()
}, 1500)
}





})
op2.addEventListener("click", () => {

if (questions[i].answers[1].correct === "r") {
document.body.style.backgroundColor = "green";
document.getElementById("op2").style.color = "green";

setTimeout(() => {
document.getElementById("op2").style.color = "black";
document.body.style.backgroundColor = "#554994";
setnewQuestion()
}, 1500)
let a = document.getElementById("number").innerText=P++

}
else {
document.getElementById("neutral").classList.add('wrong')
document.body.style.backgroundColor = "red";
document.getElementById("op2").style.color = "red";
setTimeout(() => {
document.body.style.backgroundColor = "#554994";
}, 1500)
setTimeout(() => {
document.getElementById("op2").style.color = "black";
setnewQuestion()
}, 1500)
}
})




op3.addEventListener("click", () => {

if (questions[i].answers[2].correct === "r") {
document.body.style.backgroundColor = "green";
document.getElementById("op3").style.color = "green";
setTimeout(() => {
document.getElementById("op3").style.color = "black";
document.body.style.backgroundColor = "#554994";
setnewQuestion()
}, 1500)
let a = document.getElementById("number").innerText=P++

}
else {
document.getElementById("neutral").classList.add('wrong')
document.body.style.backgroundColor = "red";
document.getElementById("op3").style.color = "red";
setTimeout(() => {
document.body.style.backgroundColor = "#554994";
}, 1500)
setTimeout(() => {
document.getElementById("op3").style.color = "black";
setnewQuestion()

}, 1500)
}
})







op4.addEventListener("click", () => {

if (questions[i].answers[3].correct === "r") {
document.body.style.backgroundColor = "green";

document.getElementById("op4").style.color = "green";

setTimeout(() => {
setnewQuestion()
document.body.style.backgroundColor = "#554994";
document.getElementById("op4").style.color = "black";
}, 1500)
let a = document.getElementById("number").innerText=P++

}
else {
document.getElementById("neutral").classList.add('wrong')
document.body.style.backgroundColor = "red";
document.getElementById("op4").style.color = "red";

setTimeout(() => {
document.body.style.backgroundColor = "#554994";
}, 1500)
setTimeout(() => {
document.getElementById("op4").style.color = "black";
setnewQuestion()
}, 1500)
}

})


Loading