forked from Sir-Haidar/QUIZIONARY
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphysics.html
More file actions
955 lines (833 loc) · 25.6 KB
/
Copy pathphysics.html
File metadata and controls
955 lines (833 loc) · 25.6 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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Jamb CBT Test - Haidar Umar Bose</title>
<link rel="stylesheet" href="quiz.css">
<style>
i {
font-size: 10px;
font-weight: bold;
}
</style>
</head>
<body>
<!-- The starting page start -->
<!-- this image below is the jamb logo -->
<center>
<img src="Assets/jamb.png" alt="Sir Haidar" class="img-fluid rounded-circle w-50 mb-3" id="jamb">
</center>
<h1>OFFLINE JAMB CBT TEST</h1>
<div class="designer">
<p>Design By <a href="https://facebook.com/">Haidar Umar Bose</a></p>
</div>
<!-- start Quiz button -->
<div class="start_btn" id="start_btn"><button>Start Quiz</button></div>
<!-- The starting page ends -->
<!-- Info Box -->
<div class="info_box">
<div class="info-title"><span>Some Rules of this Quiz</span></div>
<div class="info-list">
<div class="info">1. You will have only <span>15 seconds</span> per each question.</div>
<div class="info">2. Once you select your answer, it can't be undone.</div>
<div class="info">3. You can't select any option once time goes off.</div>
<div class="info">4. You can't exit from the Quiz while you're playing.</div>
<div class="info">5. You'll get points on the basis of your correct answers.</div>
</div>
<div class="buttons">
<button class="quit">Exit Quiz</button>
<button class="restart">Continue</button>
</div>
</div>
<!-- Quiz Box -->
<div class="quiz_box">
<header>
<div class="title">JAMB CBT TEST</div>
<div class="timer">
<div class="time_left_txt">Time Left</div>
<div class="timer_sec">15</div>
</div>
<div class="time_line"></div>
</header>
<section>
<div class="que_text">
<!-- Here I've inserted question from JavaScript -->
</div>
<div class="option_list">
<!-- Here I've inserted options from JavaScript -->
</div>
</section>
<!-- footer of Quiz Box -->
<footer>
<div class="total_que">
<!-- Here I've inserted Question Count Number from JavaScript -->
</div>
<button class="next_btn">Next Que</button>
</footer>
</div>
<!-- Result Box -->
<div class="result_box">
<div class="icon">
<i class="fas fa-crown"></i>
</div>
<div class="complete_text">You've completed the Quiz!</div>
<div class="score_text">
<!-- Here I've inserted Score Result from JavaScript -->
</div>
<div class="buttons">
<button class="restart">Replay Quiz</button>
<button class="quit">Quit Quiz</button>
</div>
</div>
<script>
// creating an array and passing the number, questions, options, and answers
let questions = [
{
numb: 1,
question: "A body when slightly displaced is said to be in neutral equilibrium only if it tends to",
answer: "Come to rest in a new position with the center of gravity and height remaining unchanged",
options: [
"Come to rest in a new position with the center of gravity and height remaining unchanged",
"Return to its original position",
"Remains in its displaced position",
"Move further away from its original position while its centerof mass changes"
]
},
{
numb: 2,
question: "A string length of 5m is extendend by 0.04m when a load of 0.8kg is suspended at the end. How far will it extend if a force of 16N is applied? [g=10m/s<i>2</i>]",
answer: "0.08m",
options: [
"0.04m",
"0.12m",
"0.01m",
"0.08m"
]
},
{
numb: 3,
question: "Which of the following has negligible mass?",
answer: "Gamma rays",
options: [
"Protons",
"Gamma rays",
"Beta particles",
"Alpha particles"
]
},
{
numb: 4,
question: "How can energy loss be minimized through Eddy-current?",
answer: "By using insulated soft iron wires",
options: [
"By using high resistance wires",
"By using insulated soft iron wires",
"By using low resistance wires",
"By using turns of wires"
]
},
{
numb: 5,
question: "Calculate the upthrust on an object of volume 50cm3 which is immersed in liquid of density 10<i>3</i>kgm<i>3</i> [g=10ms<i>-2</i>]",
answer: "0.5N",
options: [
"0.8N",
"2.5N",
"0.5N",
"1.0N"
]
},
{
numb: 6,
question: "Which of the following would appear when a white screen is illuminated by red and green light?",
answer: "Purple",
options: [
"Red",
"Purple",
"Yellow",
"Green"
]
},
{
numb: 7,
question: "I. Refraction II. Interface III. Diffraction. Which of the above properties are common to all waves?",
answer: "I, II, and III",
options: [
"II and III only",
"I, II, and III",
"I and II only",
"I and III only"
]
},
{
numb: 8,
question: "calculate the electric field intensity between two plates of potential difference 6.5V when seperated by a distance of 35cm",
answer: "18.57NC<i>-1</i>",
options: [
"18.57NC<i>-1</i>",
"53.06NC<i>-1</i>",
"2.28NC<i>-1</i>",
"0.80NC<i>-1</i>"
]
},
{
numb: 9,
question: "The distance between the image and the object in a plane mirror is 40cm, if the distance of the object is reduce by 9.2cm, what is the distance of the object from the mirror? ",
answer: "15.50m",
options: [
"17.50m",
"15.50m",
"18.50m",
"16.50m"
]
},
{
numb: 10,
question: "Find the potential energy of an object of mass 10kg placed on a building floor 10m above the ground level. [g=10m<i>-2</i>]",
answer: "1.000J",
options: [
"10.000J",
"5.000J",
"100J",
"1.000J"
]
},
{
numb: 11,
question:"Choose the option nearest in meaning to the word in italic - 'A political <i>impasse</i> does not offer the best opportunity for merrymaking'",
answer:"Gridlock",
options: [
"Party",
"Manifesto",
"Gridlock",
"Rally"
]
},
{
numb: 12,
question:"We were all <i>enthusiastic</i> as we awaited the result of the election",
answer:"Agitated",
options: [
"Bemused",
"Agitated",
"Elated",
"Nervous"
]
},
{
numb: 13,
question:"The uniform makes the guard look <i>absurd</i>",
answer:"Ridiculous",
options: [
"Sensible",
"Smark",
"Dirty",
"Ridiculous"
]
},
{
numb: 14,
question:"The law is often <i>tardy</i> in reacting to changing atitude",
answer:"Slow",
options: [
"Quick",
"Slow",
"Exclusive",
"Generous"
]
},
{
numb: 15,
question:"Haidar and Adamu ate <i>sumptuous</i> meals on their uncle`s wedding day",
answer:"Expensive",
options: [
"Expensive",
"Foreign",
"Insipid",
"Cheap"
]
},
{
numb: 16,
question:"Ummi <i>crouched</i> over the the papers on the desk",
answer:"Bent over",
options: [
"Wrote on",
"Stood on",
"Walked over",
"Bent over"
]
},
{
numb: 17,
question:"Thousands of workers have been victims of <i>retrenchment</i> since the military came back to power",
answer:"Unemployment",
options: [
"Unemployment",
"Trench Mentality",
"Suffering",
"Increase in Penury"
]
},
{
numb: 18,
question:"The principal gave his speech <i>offhand</i> at the sport meeting",
answer:"Unprepared",
options: [
"Calmly",
"Beautifully",
"Unconcerned",
"Unprepared"
]
},
{
numb: 19,
question:"The director`s remark was extremely <i>apposite</i> to the issue being discussed",
answer:"Inconsequential",
options: [
"Appropriate",
"Inconsequential",
"Emphatic",
"Adquate"
]
},
{
numb: 20,
question:"Musa is <i>eligible</i> for the post of secretary",
answer:"Qualified",
options: [
"Invited",
"Nominated",
"Qualified",
"Intelligent"
]
},
{
numb: 21,
question:"Choose the option opposite in meaning to the word in italic - 'I am optimistic about the interview though it was a <i>mind-bending</i> exercise'",
answer:"An easy",
options: [
"An enervating",
"A debilitating",
"A difficult",
"An easy"
]
},
{
numb: 22,
question:"The trader was amused by the <i>cut-throat</i> rush for the goods",
answer:"Lacklustre",
options: [
"Mad",
"Woorisome",
"Strange",
"Lacklustre"
]
},
{
numb: 23,
question:"His father surmounted the <i>myriad</i> of obstacles on his way",
answer:"Few",
options: [
"Few",
"Most",
"All",
"Many"
]
},
{
numb: 24,
question:"Beneath Ada`s <i>guff</i> exterior, he`s really very kind-hearted",
answer:"Nice",
options: [
"Harsh",
"Nice",
"Rough",
"Gentle"
]
},
{
numb: 25,
question:"Aisha seems to feel <i>ambivalent</i> about her future",
answer:"Inconsiderate",
options: [
"Decision",
"Anxious",
"Ambitious",
"Inconsiderate"
]
},
{
numb: 26,
question:"There was a general <i>acquiescence</i> on the new drug law",
answer:"Resistance",
options: [
"Resistance",
"Discrepancy",
"Compromise",
"Agreement"
]
},
{
numb: 27,
question:"The crowd was very <i>receptive</i> to the speakers suggestion",
answer:"Hostle",
options: [
"Alert",
"Disobedience",
"Hostle",
"Repeliant"
]
},
{
numb: 28,
question:"Governing a country is not always as <i>starightforward</i> as people sometimes imagine",
answer:"Complicated",
options: [
"Complicated",
"Troublesome",
"Untoward",
"Irksome"
]
},
{
numb: 29,
question:"The report of the commitee contained a <i>plathora</i> of details",
answer:"Shortage",
options: [
"Simplicity",
"Shortage",
"Multitude",
"Spectrum"
]
},
{
numb: 30,
question:"The teacher said that Aliyu`s essay was full of many redundant details",
answer:"Useful",
options: [
"Unexplained",
"Strange",
"Necessary",
"Useful"
]
},
{
numb: 31,
question:"Choose the option that best complete the gap 'The police claim that a number of stolen cars ... recovered'",
answer:"Has being",
options: [
"Have been",
"Has been",
"Has being",
"Have being"
]
},
{
numb: 32,
question:"Until he lost the election, Abgo ... to be the student union president",
answer:"Has been hoping",
options: [
"Had been hoping",
"Has been hoping",
"Would have hoped",
"Has hoped"
]
},
{
numb: 33,
question:"The old man was rushed to hospital when his blood pressure dropped to a ... level",
answer:"Dangerously lowly",
options: [
"Dangerously lowly",
"Dangerous lowly",
"Dangerously low",
"Dangerous low"
]
},
{
numb: 34,
question:"If he ... for the admission, i am sure he would succeed",
answer:"Has applied",
options: [
"Will applied",
"Applied",
"Had applied",
"Has applied"
]
},
{
numb: 35,
question:"The ... robber showed no mercy during the attack",
answer:"Benevolent",
options: [
"Loquacious",
"Senseless",
"Ruthless",
"Benevolent"
]
},
{
numb: 36,
question:"Did you have ... when you went to visit the medical doctor",
answer:"Diarrhae",
options: [
"Diarrhoae",
"Diarrhae",
"Diarhoae",
"Diarhae"
]
},
{
numb: 37,
question:"Your performance will improve if you ... hard",
answer:"Practice",
options: [
"Practising",
"Practical",
"Would practice",
"Practice"
]
},
{
numb: 38,
question:"The brave hunter killed the ... in the forest",
answer:"Black big spitting cobra",
options: [
"Big spitting cobra black ",
"Black big spitting cobra",
"Big black spitting cobra",
"Big spitting black cobra"
]
},
{
numb: 39,
question:"He wrote to you ... ?",
answer:"Hadn`t he",
options: [
"Hadn`t he",
"Wouldn`t he",
"Didn`t he",
"Hasn`t he"
]
},
{
numb: 40,
question:"The club were not ... on a solid ethical base",
answer:"Found",
options: [
"Funded",
"Found",
"Create",
"Founded"
]
},
{
numb: 41,
question:"I watched him as he ... the hole",
answer:"Digs",
options: [
"Dug",
"Is diging",
"Digs",
"Dung"
]
},
{
numb: 42,
question:"His father hardly misses the news because he goes about with his ... radio",
answer:"Portable",
options: [
"Potabble",
"Pottable",
"Potable",
"Portable"
]
},
{
numb: 43,
question:"The ivetigation commission has treated all the ... submitted to it by the warning factions",
answer:"Petitions",
options: [
"Protests",
"Petitions",
"Applications",
"Enquiries"
]
},
{
numb: 44,
question:"Olu bought his clothes and those of his ... ",
answer:"Elder Brother`s",
options: [
"Senior Brother`s",
"Elder Brothers",
"Elder Brother`s",
"Senior Brother"
]
},
{
numb: 45,
question:"Our neighbour was attracted by the ... from my mother`s cooking.",
answer:"Scent",
options: [
"Flavour",
"Stench",
"Scent",
"Aroma"
]
},
{
numb: 46,
question:"Everybody is allowed to ... his views on state matters.",
answer:"Show",
options: [
"Show",
"Share",
"Hear",
"Listen"
]
},
{
numb: 47,
question:"Despite all preparations, the wedding did not ...",
answer:"Come off",
options: [
"Come along",
"Come by",
"Come on",
"Come off"
]
},
{
numb: 48,
question:"For beating ... his coursemate, Abubakar was ... from the university",
answer:"On/expelled",
options: [
"Up/rusticated",
"On/expelled",
"At/removed",
"Alway/sent"
]
},
{
numb: 49,
question:"",
answer:"",
options: [
"",
"",
"",
""
]
},
{
numb: 50,
question:"",
answer:"",
options: [
"",
"",
"",
""
]
},
];
//selecting all required elements
const start_btn = document.querySelector(".start_btn button");
const info_box = document.querySelector(".info_box");
const exit_btn = info_box.querySelector(".buttons .quit");
const continue_btn = info_box.querySelector(".buttons .restart");
const quiz_box = document.querySelector(".quiz_box");
const result_box = document.querySelector(".result_box");
const option_list = document.querySelector(".option_list");
const time_line = document.querySelector("header .time_line");
const timeText = document.querySelector(".timer .time_left_txt");
const timeCount = document.querySelector(".timer .timer_sec");
// if startQuiz button clicked
start_btn.onclick = ()=>{
info_box.classList.add("activeInfo"); //show info box
}
// if exitQuiz button clicked
exit_btn.onclick = ()=>{
info_box.classList.remove("activeInfo"); //hide info box
}
// if continueQuiz button clicked
continue_btn.onclick = ()=>{
info_box.classList.remove("activeInfo"); //hide info box
quiz_box.classList.add("activeQuiz"); //show quiz box
showQuetions(0); //calling showQestions function
queCounter(1); //passing 1 parameter to queCounter
startTimer(15); //calling startTimer function
startTimerLine(0); //calling startTimerLine function
}
let timeValue = 15;
let que_count = 0;
let que_numb = 1;
let userScore = 0;
let counter;
let counterLine;
let widthValue = 0;
const restart_quiz = result_box.querySelector(".buttons .restart");
const quit_quiz = result_box.querySelector(".buttons .quit");
// if restartQuiz button clicked
restart_quiz.onclick = ()=>{
quiz_box.classList.add("activeQuiz"); //show quiz box
result_box.classList.remove("activeResult"); //hide result box
timeValue = 15;
que_count = 0;
que_numb = 1;
userScore = 0;
widthValue = 0;
showQuetions(que_count); //calling showQestions function
queCounter(que_numb); //passing que_numb value to queCounter
clearInterval(counter); //clear counter
clearInterval(counterLine); //clear counterLine
startTimer(timeValue); //calling startTimer function
startTimerLine(widthValue); //calling startTimerLine function
timeText.textContent = "Time Left"; //change the text of timeText to Time Left
next_btn.classList.remove("show"); //hide the next button
}
// if quitQuiz button clicked
quit_quiz.onclick = ()=>{
window.location.reload(); //reload the current window
}
const next_btn = document.querySelector("footer .next_btn");
const bottom_ques_counter = document.querySelector("footer .total_que");
// if Next Que button clicked
next_btn.onclick = ()=>{
if(que_count < questions.length - 1){ //if question count is less than total question length
que_count++; //increment the que_count value
que_numb++; //increment the que_numb value
showQuetions(que_count); //calling showQestions function
queCounter(que_numb); //passing que_numb value to queCounter
clearInterval(counter); //clear counter
clearInterval(counterLine); //clear counterLine
startTimer(timeValue); //calling startTimer function
startTimerLine(widthValue); //calling startTimerLine function
timeText.textContent = "Time Left"; //change the timeText to Time Left
next_btn.classList.remove("show"); //hide the next button
}else{
clearInterval(counter); //clear counter
clearInterval(counterLine); //clear counterLine
showResult(); //calling showResult function
}
}
// getting questions and options from array
function showQuetions(index){
const que_text = document.querySelector(".que_text");
//creating a new span and div tag for question and option and passing the value using array index
let que_tag = '<span>'+ questions[index].numb + ". " + questions[index].question +'</span>';
let option_tag = '<div class="option"><span>'+ questions[index].options[0] +'</span></div>'
+ '<div class="option"><span>'+ questions[index].options[1] +'</span></div>'
+ '<div class="option"><span>'+ questions[index].options[2] +'</span></div>'
+ '<div class="option"><span>'+ questions[index].options[3] +'</span></div>';
que_text.innerHTML = que_tag; //adding new span tag inside que_tag
option_list.innerHTML = option_tag; //adding new div tag inside option_tag
const option = option_list.querySelectorAll(".option");
// set onclick attribute to all available options
for(i=0; i < option.length; i++){
option[i].setAttribute("onclick", "optionSelected(this)");
}
}
// creating the new div tags which for icons
let tickIconTag = '<div class="icon tick"><i class="fas fa-check"></i></div>';
let crossIconTag = '<div class="icon cross"><i class="fas fa-times"></i></div>';
//if user clicked on option
function optionSelected(answer){
clearInterval(counter); //clear counter
clearInterval(counterLine); //clear counterLine
let userAns = answer.textContent; //getting user selected option
let correcAns = questions[que_count].answer; //getting correct answer from array
const allOptions = option_list.children.length; //getting all option items
if(userAns == correcAns){ //if user selected option is equal to array's correct answer
userScore += 1; //upgrading score value with 1
answer.classList.add("correct"); //adding green color to correct selected option
answer.insertAdjacentHTML("beforeend", tickIconTag); //adding tick icon to correct selected option
console.log("Correct Answer");
console.log("Your correct answers = " + userScore);
}else{
answer.classList.add("incorrect"); //adding red color to correct selected option
answer.insertAdjacentHTML("beforeend", crossIconTag); //adding cross icon to correct selected option
console.log("Wrong Answer");
for(i=0; i < allOptions; i++){
if(option_list.children[i].textContent == correcAns){ //if there is an option which is matched to an array answer
option_list.children[i].setAttribute("class", "option correct"); //adding green color to matched option
option_list.children[i].insertAdjacentHTML("beforeend", tickIconTag); //adding tick icon to matched option
console.log("Auto selected correct answer.");
}
}
}
for(i=0; i < allOptions; i++){
option_list.children[i].classList.add("disabled"); //once user select an option then disabled all options
}
next_btn.classList.add("show"); //show the next button if user selected any option
}
function showResult(){
info_box.classList.remove("activeInfo"); //hide info box
quiz_box.classList.remove("activeQuiz"); //hide quiz box
result_box.classList.add("activeResult"); //show result box
const scoreText = result_box.querySelector(".score_text");
if (userScore > 3){ // if user scored more than 3
//creating a new span tag and passing the user score number and total question number
let scoreTag = '<span>and congrats! , You got <p>'+ userScore +'</p> out of <p>'+ questions.length +'</p></span>';
scoreText.innerHTML = scoreTag; //adding new span tag inside score_Text
}
else if(userScore > 1){ // if user scored more than 1
let scoreTag = '<span>and nice attempt , You got <p>'+ userScore +'</p> out of <p>'+ questions.length +'</p></span>';
scoreText.innerHTML = scoreTag;
}
else{ // if user scored less than 1
let scoreTag = '<span>and sorry , You got only <p>'+ userScore +'</p> out of <p>'+ questions.length +'</p></span>';
scoreText.innerHTML = scoreTag;
}
}
function startTimer(time){
counter = setInterval(timer, 1000);
function timer(){
timeCount.textContent = time; //changing the value of timeCount with time value
time--; //decrement the time value
if(time < 9){ //if timer is less than 9
let addZero = timeCount.textContent;
timeCount.textContent = "0" + addZero; //add a 0 before time value
}
if(time < 0){ //if timer is less than 0
clearInterval(counter); //clear counter
timeText.textContent = "Time Off"; //change the time text to time off
const allOptions = option_list.children.length; //getting all option items
let correcAns = questions[que_count].skip_to_next_question; //getting correct answer from array
for(i=0; i < allOptions; i++){
if(option_list.children[i].textContent == correcAns){ //if there is an option which is matched to an array answer
option_list.children[i].setAttribute("class", "option correct"); //adding green color to matched option
option_list.children[i].insertAdjacentHTML("beforeend", tickIconTag); //adding tick icon to matched option
console.log("Time Off: Skip the Question.");
// time off
}
}
for(i=0; i < allOptions; i++){
option_list.children[i].classList.add("disabled"); //once user select an option then disabled all options
}
next_btn.classList.add("show"); //show the next button if user selected any option
}
}
}
function startTimerLine(time){
counterLine = setInterval(timer, 29);
function timer(){
time += 1; //upgrading time value with 1
time_line.style.width = time + "px"; //increasing width of time_line with px by time value
if(time > 549){ //if time value is greater than 549
clearInterval(counterLine); //clear counterLine
}
}
}
function queCounter(index){
//creating a new span tag and passing the question number and total question
let totalQueCounTag = '<span><p>'+ index +'</p> of <p>'+ questions.length +'</p> Questions</span>';
bottom_ques_counter.innerHTML = totalQueCounTag; //adding new span tag inside bottom_ques_counter
}
</script>
</body>
</html>