-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
161 lines (145 loc) · 3.93 KB
/
index.js
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
//list of questions
var questions = [ questionOne = {
question: `Let's start off easy, who is are part of Tapu Sena?
options:
[a] Tapu, Sonu, Goli, Gogi, and Pinku.
[b] Tapu, Gogi, and Pinku
[c] Tapu akela hi puri sena hai`,
answer: "a"
},
questionTwo = {
question: `What is Jethalal's father, Bapu ji's, real name?
options:
[a] Jayantilal Giridharlal Gada
[b] Natwarlal Prabhashankar Udhaiwala
[c] Champaklal Jayantilal Gada`,
answer: "c"
},
questionThree = {
question: `Most evenings, the group gets together at a shop to discuss everything under the sun. What is the name of the shop?
options:
[a] Abdul's Soda Shop
[b] Aao-Khao store
[c] All-In-One General Store`,
answer: "c"
},
questionFour = {
question: `What is the name of the company where Popatlal works as a reporter?
options:
[a] Express Mail
[b] Toofan Mail
[c] Toofan Express`,
answer: "c"
},
questionFive = {
question: `Complete this line from the title song of the show: Problem toh hai sabke saath Bas ___ ki hai baat Taarak Mehta ka ooltah chashmah.
options:
[a] suljhane
[b] nazariye
[c] dekhne`,
answer: "b"
},
questionSix = {
question: `Other than being the society's secretary and a teacher, what is Bhide's side job?
options:
[a] He irons the clothes
[b] He delivers the pickles and papad that his wife makes.
[c] How does he even have the time to do a third job?`,
answer: "b"
},
questionSeven = {
question: `On which street is the Gokuldham society located?
options:
[a] Powder gali, Goregaon East
[b] Powder gali, Goregaon West
[c] Yeh toh na ho paega`,
answer: "a"
},
questionEight = {
question: `What is the name of the bhojnalaya where Bagha and Natu Kaka have food?
options:
[a] Gujarati Bhojnalya
[b] Padmini Bhojnalaya
[c] Padmavati Bhojnalaya`,
answer: "c"
},
questionNine = {
question: `What is Krishnan Iyer's profession?
options:
[a] Reporter
[b] Scientist
[c] Teacher`,
answer: "b"
},
questionTen = {
question: `Which of the following shows had a crossover with Taarak Mehta Ka Ooltah Chashmah?
options:
[a] C.I.D
[b] Bhabhiji Ghar Par Hain
[c] Kasuatti Zindagi Kay"]`,
answer: "a"
}
];
var rs = require("readline-sync");
const chalk = require("chalk");
var count=0;
// using function to make a quiz
function welcome()
{
var userName = rs.question(chalk.cyan.bold("Enter your name:"));
console.log("\n");
console.log(chalk.yellow.bold("Welcome " + userName + " to the quiz of Taarak Mehta Ka Ooltah Chashmah!!!"));
console.log("\n");
var userPass = rs.question(chalk.cyan.bold("Enter password:"), {
hideEchoBack: true});
console.log("\n");
console.log(chalk.yellow.bold("There's no negative marking. enjoy :)"));
console.log(chalk.whiteBright.bold("--------------------------------------------------------------------------------------------"));
console.log("\n");
}
function play(q , a)
{
var ans=rs.question(chalk.blue.bold("Select option:"));
if(ans.toUpperCase() === a.toUpperCase())
{
console.log(chalk.green.bold("YAY! Correct Answer"));
console.log(chalk.whiteBright.bold("--------------------------------------------------------------------------------------------"));
console.log("\n");
count = count + 1;
}
else
{
console.log(chalk.red.bold("NAY! Wrong Answer"));
console.log(chalk.whiteBright.bold("--------------------------------------------------------------------------------------------"));
console.log("\n");
}
}
function game()
{
for(i = 0; i < questions.length; i++)
{
var currQ = questions[i];
console.log(chalk.blue.bold(currQ.question));
play(currQ.question , currQ.answer);
}
}
// print the final score
function score()
{
console.log(chalk.magentaBright.bold("Your score is : " + count));
if(count === 10)
{
console.log(chalk.magentaBright.bold("WOW! Congratulations!!!"));
}
else if(count === 0)
{
console.log(chalk.magentaBright.bold("ALAS! Try harder next time"));
}
else
{
console.log(chalk.yellow.bold("You can do better."));
}
}
welcome();
game();
score();