this blog for general knowledge and compitition exam. it is very helpful for ssc, upsc, ibps, and others government exam.
Search This Blog
test by gkwithmath
TEST 1
function Quiz(questions) {
this.score = 0;
this.questions = questions;
this.questionIndex = 0;
}
Quiz.prototype.getQuestionIndex = function() {
return this.questions[this.questionIndex];
}
Quiz.prototype.guess = function(answer) {
if(this.getQuestionIndex().isCorrectAnswer(answer)) {
this.score++;
}
this.questionIndex++;
}
Quiz.prototype.isEnded = function() {
return this.questionIndex === this.questions.length;
}
function Question(text, choices, answer) {
this.text = text;
this.choices = choices;
this.answer = answer;
}
Question.prototype.isCorrectAnswer = function(choice) {
return this.answer === choice;
}
function populate() {
if(quiz.isEnded()) {
showScores();
}
else {
// show question
var element = document.getElementById("question");
element.innerHTML = quiz.getQuestionIndex().text;
// show options
var choices = quiz.getQuestionIndex().choices;
for(var i = 0; i < choices.length; i++) {
var element = document.getElementById("choice" + i);
element.innerHTML = choices[i];
guess("bt" + i, choices[i]);
}
showProgress();
}
};
function guess(id, guess) {
var button = document.getElementById(id);
button.onclick = function() {
quiz.guess(guess);
populate();
}
};
function showProgress() {
var currentQuestionNumber = quiz.questionIndex + 1;
var element = document.getElementById("progress");
element.innerHTML = "Question " + currentQuestionNumber + " of " + quiz.questions.length;
};
function showScores() {
var gameOverHTML = "
Result
";
gameOverHTML += "
Your scores: " + quiz.score + "
";
var element = document.getElementById("quiz");
element.innerHTML = gameOverHTML;
};
// create questions
var questions = [
new Question("What is the Capital of India?", ["New Delhi", "Mumbai","Jaipur", "Kolkata"], "New Delhi"),
new Question("National Animal of India?", ["Elephant", "Bengal Tiger","Lion", "Cow"], "Bengal Tiger"),
new Question("National River of India?", ["Yamuna", "Ganga","Brahmputra", "Sindhu"], "Ganga"),
new Question("तू कौन है ?", ["पागल ", "गधा","मेंचल", "दिमाग"], "दिमाग"),
];
var quiz = new Quiz(questions);
populate();
15वी फाइनेंस कमीशन अनुच्छेद 280 के तहत राष्ट्रपति ने फाइनेंस कमीशन को गठित कर दिया है, इस कमीशन का कार्य केंद्र और राज्यों के बीच कर का बटवारा करना है जिसमें केंद्र को
संयुक्त राष्ट्र अंतर्राष्ट्रीय बाल आपातकालीन फंड संयुक्त राष्ट्र महासभा द्वारा 11 दिसंबर, 1 9 46 को, उन देशों में बच्चों को आपातकालीन भोजन और स्वास्थ्य देखभाल प्रदान करने के लिए बनाया गया था जो द्वितीय विश्व युद्ध द्वारा तबाह हो गए थे। पोलिश चिकित्सक लुडविक राजचमन को यूनिसेफ के संस्थापक के रूप में व्यापक रूप मे जाता है और उन्होंने 1 9 46 से उनके पहले इसके अध्यक्ष के रूप में कार्य किया जाता है। राजचमन के सुझाव पर,
Comments
Post a Comment