-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuizGame.js
More file actions
111 lines (92 loc) · 1.95 KB
/
Copy pathQuizGame.js
File metadata and controls
111 lines (92 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
let passed = 0;
let wrong = 0;
let question1 = `
What is the capital of France?
a. Paris
b. London
c. Berlin
d. Rome
`;
console.log(question1);
let askUser = readline.question.bind(readline);
askUser("Enter the correct option: ", userInput => {
if (userInput.toLowerCase() == 'a'){
console.log("correct");
passed++;
} else {
console.log("wrong");
wrong++;
}
let question2 = `
What is the output of photosynthesis?
a. sugar and carbondioxide
b. carbondioxide and oxygen
c. oxygen and sugar
d. respiration and chlorophyll
`;
console.log(question2);
askUser("Enter the correct option: ", userInput => {
if (userInput.toLowerCase() == 'c'){
console.log("correct");
passed++;
} else {
console.log("wrong");
wrong++;
}
let question3 = `
Photosynthesis and Respiration are opposite of each other?
a. True
b. False
`;
console.log(question3);
askUser("Enter the correct option: ", userInput => {
if (userInput.toLowerCase() == 'a'){
console.log("correct");
passed++;
} else {
console.log("wrong");
wrong++;
}
let question4 = `
Which of these is the third stage of a water cycle process?
a. Evaporation
b. Condensation
c. Precipitation
d. Collection
`;
console.log(question4);
askUser("Enter the correct option: ", userInput => {
if (userInput.toLowerCase() == 'c'){
console.log("correct");
passed++;
} else {
console.log("wrong");
wrong++;
}
let question5 = `
The bones of the lower arm are?
a. femur and tibia
b. femur and humerus
c. tibia and fibula
d. ulna and radius
`;
console.log(question5);
askUser("Enter the correct option: ", userInput => {
if (userInput.toLowerCase() == 'd'){
console.log("correct");
passed++;
} else {
console.log("wrong");
wrong++;
}
console.log(`You passed ${passed} questions and got ${wrong} questions wrong.`);
readline.close();
});
});
});
});
});