From 9c887755e47d63eb41626396aaf51272d2074c7b Mon Sep 17 00:00:00 2001 From: Parth Dwivedi Date: Mon, 23 Oct 2023 20:18:57 +0530 Subject: [PATCH] Added a QuizApp --- QuizApp/Parth4git/index.html | 21 ++++++ QuizApp/Parth4git/script.js | 142 +++++++++++++++++++++++++++++++++++ QuizApp/Parth4git/style.css | 80 ++++++++++++++++++++ 3 files changed, 243 insertions(+) create mode 100644 QuizApp/Parth4git/index.html create mode 100644 QuizApp/Parth4git/script.js create mode 100644 QuizApp/Parth4git/style.css diff --git a/QuizApp/Parth4git/index.html b/QuizApp/Parth4git/index.html new file mode 100644 index 0000000..9a17df6 --- /dev/null +++ b/QuizApp/Parth4git/index.html @@ -0,0 +1,21 @@ + + + + + + + + Quiz App + + +
+
+

Question

+
+
+ +
+ +
+ + \ No newline at end of file diff --git a/QuizApp/Parth4git/script.js b/QuizApp/Parth4git/script.js new file mode 100644 index 0000000..fce6921 --- /dev/null +++ b/QuizApp/Parth4git/script.js @@ -0,0 +1,142 @@ +const questionContainer = document.getElementById("question-container"); +const questionElement = document.getElementById("question"); +const answerButtons = document.getElementById("answer-buttons"); +const nextButton = document.getElementById("next-btn"); +const restartButton = document.getElementById("restart-btn"); +const resultDiv = document.getElementById("result"); + +let shuffledQuestions, currentQuestionIndex, score; + +const questions = [ + { + question: "What is 2 + 2?", + answers: [ + { text: "4", correct: true }, + { text: "22", correct: false }, + { text: "222", correct: false }, + { text: "2222", correct: false }, + ], + }, + { + question: "What is the capital of France?", + answers: [ + {text:"London",correct:false}, + {text:"Berlin",correct:false}, + {text:"Paris",correct:true}, + {text: "Madrid",correct:false} +], + + }, + { + question: "Which planet is known as the Red Planet?", + answers: [ + {text:"Mars",correct:true}, + {text: "Earth",correct:false}, + {text:"Venus",correct:false}, + {text:"Jupiter",correct:false} +], + + }, + { + question: "What does HTML stand for?", + answers: [ + { text: "HyperText Markup Language", correct: true }, + { text: "HighText Machine Language", correct: false }, + { text: "HyperText Machine Language", correct: false }, + { text: "HighText Markup Language", correct: false }, + ], + }, + { + question: "Which property is used to change the background color?", + answers: [ + { text: "color", correct: false }, + { text: "bgColor", correct: false }, + { text: "background-color", correct: true }, + { text: "background", correct: false }, + ], + }, + { + question: "Inside which HTML element do we put the JavaScript?", + answers: [ + { text: "", correct: false }, + { text: "", correct: false }, + { text: "