JavaSript Pdf1
JavaSript Pdf1
MICROPROJECT
QUIZ DEVELOPEMENT
ABSTRACT
The concept of quizzes is currently very popular among educated circles as well
as in entertainment shows. Though the quiz can be conducted manually it also
needs elaborate preparations, quizzes contribute to the growth of knowledge of
an individual and they are a popular source of entertainment. This program in
JavaScript focuses on creating interactive quizzes with a considerably of
JavaScript subject questions. The program utilizes most of important concept in
JavaScript and CSS design to get the final output is envision to knowledge and
get entertainment with value addition. The system reduces paperwork.. This
program mainly shows questions. It is designed to replace existing paperwork
and manual correction. The implementation of the system in the organization will
considerably reduce time and also provide readily calculated marks.
INTRODUCTION
Today, it may see that many people want to test their memory and general
knowledge power. We help them doing so with the help of our small program
which allows them to to check their overall IQ. The test contains all type of
questions that proves to be helpful to a person who keeps a very keen interest in
subject. The tests prepared via electronic exam systems, now, have been an
alternative for those who prepare for their exams by using their personal
computers or mobile devices. Connecting such services requires a computer and
Page 1
an internet access. In other words it is necessary that students must be in an
environment which provides above mentioned conditions in order to access such
electronic exam systems. This app is mainly for CO5I students. This will help
them do the revision at the important times like semester exams. If they use this
app they won’t need extra load of study materials and faculty to do the rest of the
learning.
Questions
This option leads the user to the main page of our program. The main page
consists of test questions.
Test
It content 5 questions. The questions asked are mainly the questions which has
been seen in syllabus. The user can leave the question if he does not know the
answer. And in the end can press the score button to end that particular test and
see the results.
Score
After each test, the score will be calculated. This section only shows the result of
the test and if the user wants to save the score.
Page 2
IMPLEMENTATION
On starting the program, the main screen is loaded with the 1st question of test.
The user can jump to any other question by using the next button.
The user can answer the question according to his own choice and submit the
test. The question contain multiple choice questions. After that, a score board
will be displayed indicating the individual score.
MODULE IMPLEMENTATION
Home Screen
Page 3
Test
This section will contain 5 questions. The questions asked are mainly the
questions which has been seen in subject number of times. The user can leave the
question if he does not know the answer. And in the end can press the score
button to end that particular test and see the results.
Page 4
Result
On clicking the score button. The score will be displayed in a new activity.
Page 5
Coding
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Quiz</title>
<style>
body
background-image: url('IMG-20151102-WA0352.jpg');
.grid
width: 600px;
height: 500px;
margin: 0 auto;
background-color: #fff;
Page 6
border: 1px solid black;
.grid h1
font-family: "Times";
color: green;
font-size: 60px;
font-style: italic;
text-align: center;
#score
color: #01BBFF;
font-style: italic;
text-align: center;
font-size: 30px;
Page 7
.grid #question
font-family: "monospace";
font-style: italic;
font-size: 30px;
color: #01BBFF;
.buttons
margin-top: 30px;
background-color: pink;
width: 250px;
font-family: "monospace";
font-size: 20px;
color: black;
font-style: italic;
Page 8
padding: 10px 10px;
cursor: pointer;
background-color: pink;
outline: 0;
#progress
color: #2b2b2b;
font-style: bold;
font-size: 18px;
</style>
Page 9
</head>
<body>
<div class="grid">
<div id="quiz">
<h1>Welcome to Quiz</h1>
<p id="question"></p>
<div class="buttons">
</div>
<footer>
</footer>
Page 10
</div>
</div>
<script >
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))
Page 11
this.score++;
this.questionIndex++;
Quiz.prototype.isEnded = function()
this.text = text;
this.choices = choices;
this.answer = answer;
Question.prototype.isCorrectAnswer = function(choice)
Page 12
function populate()
if(quiz.isEnded())
showScores();
else
// show question
element.innerHTML = quiz.getQuestionIndex().text;
// show options
element.innerHTML = choices[i];
guess("btn" + i, choices[i]);
showProgress();
Page 13
}
};
button.onclick = function()
quiz.guess(guess);
populate();
};
function showProgress()
};
function showScores()
Page 14
var gameOverHTML = "<h1>Result</h1>";
element.innerHTML = gameOverHTML;
};
var questions = [
new Question("Which language is used for styling web pages?", ["HTML", "JQuery",
"CSS", "XML"], "CSS"),
new Question("Which is used for Connect To Database?", ["PHP", "HTML", "JS", "All"],
"PHP"),
new Question("MIT is best institute for ...", ["Diploma", "BE", "B-Tech", "All"], "All")
];
// create quiz
// display quiz
populate();
Page 15
</script>
</body>
</html>
Screen Shot
Page 16
Page 17
Page 18
Page 19