<!-- wp:html --> <!DOCTYPE html> <html lang="hi"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>MCQ Quiz</title> <style> /* Basic CSS resets */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; background-color: #f1f8e9; color: #33691e; } .content-container { background-color: #dcedc8; padding: 5px; border-radius: 5px; max-width: auto; margin: 20px auto; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); position: relative; } .header { background-color: #7cb342; color: #ffffff; text-align: center; padding: 20px; border-radius: 10px; margin-bottom: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); position: relative; } .header h1 { margin: 0; font-size: 28px; } /* Hamburger Menu Icon */ .hamburger { position: absolute; top: 8px; left: 8px; z-index: 1000; width: 20px; height: 15px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; } .hamburger-line { height: 3px; background-color: #fff; border-radius: 2px; } /* Sidebar (Question Nav) */ #questionNavOverlay { position: fixed; top: 0; left: -250px; /* hidden by default */ width: 250px; height: 100%; background-color: #fff; transition: left 0.3s ease-in-out; z-index: 2000; box-shadow: 2px 0 6px rgba(0,0,0,0.3); padding: 20px; overflow-y: auto; } #questionNavOverlay.show { left: 0; /* slide in */ } #questionNavTitle { margin-bottom: 10px; font-weight: bold; font-size: 1.1rem; } .question-nav { display: flex; flex-wrap: wrap; gap: 5px; } .circle-number { width: 30px; height: 30px; border-radius: 50%; background-color: #ccc; color: #000; display: flex; justify-content: center; align-items: center; cursor: pointer; user-select: none; /* Prevent text selection */ transition: background-color 0.2s; } .circle-number:hover { background-color: #aaa; } .circle-number.active { background-color: #4CAF50; color: #fff; } /* Quiz Container */ .quiz-container { background-color: #fff; border-radius: 10px; padding: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); max-width: auto; width: 100%; margin: 0 auto; text-align: center; position: relative; } .question-counter { font-weight: bold; padding: 5px 10px; border-radius: 5px; background-color: #d9edf7; position: absolute; top: 10px; left: 10px; } /* Timer display */ .timer { font-weight: bold; padding: 5px 10px; border-radius: 5px; background-color: #ffcccb; position: absolute; top: 10px; right: 10px; } .question { font-size: 1.2rem; margin-top: 40px; margin-bottom: 20px; text-align: left; } .choices { display: flex; flex-direction: column; gap: 10px; } .choice { padding: 10px; background-color: #f0f0f0; border: 1px solid #ddd; border-radius: 5px; cursor: pointer; transition: background-color 0.3s, box-shadow 0.3s; } .choice:hover { background-color: #e0e0e0; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .choice.selected { background-color: #28a745; /* More vivid green */ color: #fff; } .choice.correct { background-color: #28a745; /* More vivid green */ border-color: #28a745; color: #fff; } .choice.incorrect { background-color: #dc3545; /* More vivid red */ border-color: #dc3545; color: #fff; } .choice.disabled { cursor: not-allowed; pointer-events: none; opacity: 0.6; } .explanation { margin-top: 20px; text-align: left; background-color: #e7f3fe; padding: 15px; border-left: 5px solid #2196F3; border-radius: 5px; } .buttons { display: flex; justify-content: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; } .btn { flex: 1 1 auto; padding: 8px 12px; background-color: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 0.9rem; text-align: center; min-width: 100px; max-width: 150px; transition: none; } .btn.disabled { background-color: #cccccc; cursor: not-allowed; } .hidden { display: none; } /* Result Section */ #resultContent { text-align: center; margin-top: 20px; } .congrats { font-size: 1.5rem; color: #4CAF50; } .sad { font-size: 1.5rem; color: #d32f2f; } /* Popup Message (Optional) */ #popupMessage { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); color: white; padding: 10px 20px; border-radius: 5px; font-size: 1rem; z-index: 5000; display: none; } #popupMessage.show { display: block; } #popupMessage.correct { background-color: #28a745; } #popupMessage.incorrect { background-color: #dc3545; } </style> </head> <body> <div class="content-container"> <div class="header"> <!-- Hamburger menu button --> <div class="hamburger" id="hamburgerBtn"> <div class="hamburger-line"></div> <div class="hamburger-line"></div> <div class="hamburger-line"></div> </div> <h1>MCQs Quiz</h1> </div> <!-- Sidebar (Question Nav) --> <div id="questionNavOverlay"> <div id="questionNavTitle">Questions</div> <div class="question-nav" id="questionNav"></div> </div> <!-- Quiz Container --> <div class="quiz-container" id="quizContent"> <div class="question-counter" id="questionCounter">1/3</div> <!-- Timer display here --> <div class="timer" id="timer">Time: 00:00</div> <div class="question" id="question">Loading question...</div> <div class="choices" id="choices"></div> <!-- Explanation and feedback --> <div class="explanation hidden" id="explanation"></div> <!-- Buttons for navigation and submission --> <div class="buttons"> <button class="btn" id="prevButton">Previous</button> <button class="btn" id="submitAnswerButton">Submit Answer</button> <button class="btn hidden" id="nextButton">Next</button> </div> </div> <!-- Result Section --> <div id="resultContent" class="hidden"> <h2>Quiz Completed</h2> <div id="resultMessage"></div> <p id="scoreMessage"></p> </div> </div> <!-- Optional Popup Message --> <div id="popupMessage" class="hidden"></div> <script> /***** JavaScript Code *****/ // Quiz data (sample) const quizData = [ { "question": "डेटाबेस (Database) क्या है?", "options": [ "डेटा को संग्रहीत और प्रबंधित करने की एक प्रणाली", "एक प्रकार का सॉफ्टवेयर एडिटर", "केवल डेटा विश्लेषण उपकरण", "एक हार्डवेयर डिवाइस" ], "correct": 0, "explanation": "डेटाबेस डेटा को संग्रहीत, प्रबंधित और व्यवस्थित करने की एक प्रणाली है, जिससे डेटा तक सुगम और सुरक्षित पहुँच संभव होती है।" }, { "question": "डेटाबेस प्रबंधन प्रणाली (DBMS) के मुख्य कार्यों में से कौन-सा शामिल नहीं है?", "options": [ "डेटा संग्रहण और पुनर्प्राप्ति", "डेटा सुरक्षा और अखंडता सुनिश्चित करना", "नेटवर्क हार्डवेयर का निर्माण", "डेटाबेस डिज़ाइन और प्रबंधन" ], "correct": 2, "explanation": "DBMS डेटा संग्रहण, सुरक्षा, अखंडता, और डेटाबेस डिज़ाइन जैसे कार्यों को संभालता है, जबकि नेटवर्क हार्डवेयर का निर्माण DBMS का कार्य नहीं है।" }, { "question": "रिलेशनल डेटाबेस (Relational Database) का मूल आधार क्या है?", "options": [ "वृक्ष संरचना", "नेटवर्क ग्राफ", "तालिकाएँ (Tables)", "वस्तु-उन्मुख मॉडल" ], "correct": 2, "explanation": "रिलेशनल डेटाबेस में डेटा तालिकाओं (Tables) में संग्रहीत होता है, जहाँ प्रत्येक तालिका में पंक्तियाँ और स्तंभ होते हैं।" }, { "question": "SQL (Structured Query Language) का मुख्य उपयोग क्या है?", "options": [ "डेटाबेस का डिज़ाइन करना", "डेटाबेस से डेटा निकालने, जोड़ने, अपडेट करने और हटाने के लिए", "नेटवर्क कनेक्शन सेटअप करना", "सिस्टम प्रोग्रामिंग" ], "correct": 1, "explanation": "SQL का मुख्य उपयोग डेटाबेस से डेटा निकालने, जोड़ने, अपडेट करने और हटाने के लिए किया जाता है।" }, { "question": "ACID गुणों में से कौन-सा गुण ट्रांजेक्शन की विश्वसनीयता सुनिश्चित करता है?", "options": [ "Atomicity", "Consistency", "Isolation", "Durability" ], "correct": 1, "explanation": "Consistency (सुसंगतता) गुण यह सुनिश्चित करता है कि ट्रांजेक्शन के बाद डेटाबेस की स्थिति नियमों के अनुरूप बनी रहे।" }, { "question": "डेटाबेस डिज़ाइन में 'नॉर्मलाइजेशन' का उद्देश्य क्या है?", "options": [ "डेटाबेस की गति बढ़ाना", "डेटा डुप्लिकेशन को कम करना और डेटा की अखंडता सुनिश्चित करना", "डेटाबेस को ग्राफिकल रूप में प्रस्तुत करना", "डेटाबेस के आकार को बढ़ाना" ], "correct": 1, "explanation": "नॉर्मलाइजेशन का उद्देश्य डेटा डुप्लिकेशन को कम करना और डेटा की अखंडता सुनिश्चित करना है, जिससे डेटाबेस अधिक कुशल और सटीक हो।" }, { "question": "NoSQL डेटाबेस में से कौन-सा प्रकार दस्तावेज़-आधारित डेटाबेस है?", "options": [ "MongoDB", "Redis", "Neo4j", "Cassandra" ], "correct": 0, "explanation": "MongoDB एक दस्तावेज़-आधारित NoSQL डेटाबेस है, जो JSON जैसे दस्तावेज़ों में डेटा संग्रहित करता है।" }, { "question": "रिलेशनल डेटाबेस में 'प्राइमरी की' (Primary Key) का क्या कार्य है?", "options": [ "तालिका में किसी भी स्तंभ का चयन करना", "तालिका में प्रत्येक पंक्ति की विशिष्ट पहचान करना", "तालिका को अन्य तालिकाओं से जोड़ना", "डेटा को एन्क्रिप्ट करना" ], "correct": 1, "explanation": "प्राइमरी की तालिका में प्रत्येक पंक्ति की विशिष्ट पहचान करती है, जिससे प्रत्येक रिकॉर्ड अद्वितीय होता है।" }, { "question": "SQL में 'JOIN' ऑपरेशन का उपयोग क्या करता है?", "options": [ "दो तालिकाओं को जोड़ने के लिए", "डेटा को सॉर्ट करने के लिए", "डेटा को फिल्टर करने के लिए", "नए तालिकाएँ बनाने के लिए" ], "correct": 0, "explanation": "'JOIN' ऑपरेशन का उपयोग दो या अधिक तालिकाओं को एक साथ जोड़ने के लिए किया जाता है, जिससे संबंधित डेटा को एकत्रित किया जा सके।" }, { "question": "NoSQL डेटाबेस किस प्रकार के डेटा के लिए उपयुक्त होते हैं?", "options": [ "संगठित और संरचित डेटा", "असंगठित और लचीला डेटा", "केवल टेक्स्ट डेटा", "केवल इमेज डेटा" ], "correct": 1, "explanation": "NoSQL डेटाबेस असंगठित और लचीला डेटा संभालने के लिए उपयुक्त होते हैं, जैसे कि दस्तावेज़, ग्राफ, की-वैल्यू जोड़े, आदि।" }, { "question": "डेटाबेस प्रबंधन में 'इंडेक्सिंग' का क्या महत्व है?", "options": [ "डेटा को एन्क्रिप्ट करना", "डेटाबेस को बैकअप करना", "डेटा तक तेज़ पहुँच सुनिश्चित करना", "डेटा को डिस्क पर स्टोर करना" ], "correct": 2, "explanation": "इंडेक्सिंग से डेटा तक पहुँचने की गति बढ़ती है, जिससे क्वेरीज़ को तेजी से निष्पादित किया जा सकता है।" }, { "question": "ट्रांजेक्शन में 'Isolation' गुण का क्या अर्थ है?", "options": [ "ट्रांजेक्शन को एक ही समय में निष्पादित करना", "ट्रांजेक्शन को दूसरे ट्रांजेक्शन से अलग रखना", "ट्रांजेक्शन के डेटा को लॉक करना", "ट्रांजेक्शन को रीवर्ट करना" ], "correct": 1, "explanation": "Isolation गुण यह सुनिश्चित करता है कि एक ट्रांजेक्शन के दौरान अन्य ट्रांजेक्शन से कोई हस्तक्षेप न हो, जिससे डेटा की अखंडता बनी रहे।" }, { "question": "रिलेशनल डेटाबेस में 'Foreign Key' का उपयोग क्या करता है?", "options": [ "तालिका में किसी भी स्तंभ को पहचानने के लिए", "एक तालिका में दूसरे तालिका की प्राइमरी की को संदर्भित करने के लिए", "डेटा को एन्क्रिप्ट करने के लिए", "तालिकाओं को एक साथ जोड़ने के लिए" ], "correct": 1, "explanation": "Foreign Key का उपयोग एक तालिका में दूसरे तालिका की प्राइमरी की को संदर्भित करने के लिए किया जाता है, जिससे तालिकाओं के बीच संबंध स्थापित होता है।" }, { "question": "NoSQL डेटाबेस में से कौन-सा प्रकार ग्राफ डेटा संरचना का उपयोग करता है?", "options": [ "MongoDB", "Cassandra", "Neo4j", "Redis" ], "correct": 2, "explanation": "Neo4j एक ग्राफ-आधारित NoSQL डेटाबेस है, जो नोड्स और एजेज़ के माध्यम से डेटा के बीच संबंधों को दर्शाता है।" }, { "question": "SQL में 'GROUP BY' क्लॉज का उपयोग कब किया जाता है?", "options": [ "डेटा को सॉर्ट करने के लिए", "डेटा को फिल्टर करने के लिए", "डेटा को समूहित करने के लिए ताकि प्रत्येक समूह पर संक्षेपण कार्य (जैसे SUM, COUNT) किया जा सके", "नई तालिकाएँ बनाने के लिए" ], "correct": 2, "explanation": "'GROUP BY' क्लॉज का उपयोग डेटा को एक या अधिक स्तंभों के आधार पर समूहित करने के लिए किया जाता है, जिससे प्रत्येक समूह पर संक्षेपण कार्य जैसे SUM, COUNT, AVG आदि लागू किए जा सकते हैं।" }, { "question": "डेटाबेस डिज़ाइन में 'ER डायग्राम' का क्या उपयोग है?", "options": [ "डेटाबेस को एन्क्रिप्ट करने के लिए", "डेटाबेस की संरचना और संबंधों को ग्राफिकल रूप में दर्शाने के लिए", "डेटा को ट्रांसमिट करने के लिए", "डेटाबेस को बैकअप करने के लिए" ], "correct": 1, "explanation": "ER (Entity-Relationship) डायग्राम का उपयोग डेटाबेस की संरचना, एंटिटीज़ और उनके बीच के संबंधों को ग्राफिकल रूप में प्रदर्शित करने के लिए किया जाता है।" }, { "question": "ट्रांजेक्शन प्रबंधन में 'Durability' गुण का क्या अर्थ है?", "options": [ "ट्रांजेक्शन को तेज़ निष्पादित करना", "ट्रांजेक्शन के सफलतापूर्वक पूर्ण होने के बाद, उसके परिणाम स्थायी रूप से डेटाबेस में सुरक्षित रहते हैं, भले ही सिस्टम फेल हो जाए", "ट्रांजेक्शन को पुनः प्रारंभ करना", "ट्रांजेक्शन को रोकना" ], "correct": 1, "explanation": "Durability गुण यह सुनिश्चित करता है कि ट्रांजेक्शन के सफलतापूर्वक पूरा होने के बाद उसके परिणाम स्थायी रूप से डेटाबेस में सुरक्षित रहेंगे, चाहे सिस्टम में कोई भी विफलता क्यों न हो।" }, { "question": "SQL में 'INNER JOIN' और 'LEFT JOIN' में मुख्य अंतर क्या है?", "options": [ "'INNER JOIN' केवल मेल खाते रिकॉर्ड लौटाता है, जबकि 'LEFT JOIN' बाएँ तालिका के सभी रिकॉर्ड लौटाता है, चाहे मेल न खाएं", "दोनों एक ही तरह से कार्य करते हैं", "'LEFT JOIN' केवल मेल खाते रिकॉर्ड लौटाता है", "'INNER JOIN' बाएँ तालिका के सभी रिकॉर्ड लौटाता है" ], "correct": 0, "explanation": "'INNER JOIN' केवल उन रिकॉर्ड्स को लौटाता है जो दोनों तालिकाओं में मेल खाते हैं, जबकि 'LEFT JOIN' बाएँ तालिका के सभी रिकॉर्ड्स को लौटाता है, चाहे मेल न खाएं।" }, { "question": "NoSQL डेटाबेस में से कौन-सा प्रकार की डेटाबेस स्कीमा-लेस होती है?", "options": [ "रिलेशनल डेटाबेस", "Document-Oriented डेटाबेस", "स्ट्रक्चर्ड डेटाबेस", "ऑब्जेक्ट-ओरिएंटेड डेटाबेस" ], "correct": 1, "explanation": "Document-Oriented NoSQL डेटाबेस स्कीमा-लेस होते हैं, जिससे विभिन्न दस्तावेज़ों में विभिन्न संरचनाएँ हो सकती हैं।" }, { "question": "SQL में 'SELECT DISTINCT' का उपयोग क्या करता है?", "options": [ "डेटा को समूहित करने के लिए", "एक ही तालिका से सभी रिकॉर्ड्स को चयनित करने के लिए", "कॉलम में से केवल अद्वितीय (यूनिक) मानों को चयनित करने के लिए", "डेटा को अपडेट करने के लिए" ], "correct": 2, "explanation": "'SELECT DISTINCT' का उपयोग कॉलम में से केवल अद्वितीय मानों को चयनित करने के लिए किया जाता है, जिससे डुप्लिकेट मानों को हटाया जा सके।" }, { "question": "NoSQL डेटाबेस में 'Key-Value Store' किस प्रकार का डेटाबेस है?", "options": [ "रिलेशनल डेटाबेस", "डॉक्युमेंट-आधारित डेटाबेस", "ग्राफ डेटाबेस", "की-वैल्यू डेटाबेस जो कुंजी और मान के जोड़े में डेटा संग्रहित करता है" ], "correct": 3, "explanation": "'Key-Value Store' NoSQL डेटाबेस में डेटा को कुंजी और मान के जोड़े के रूप में संग्रहित करता है, जैसे कि Redis।" }, { "question": "ट्रांजेक्शन प्रबंधन में 'Rollback' का क्या अर्थ है?", "options": [ "ट्रांजेक्शन को पूरा करना", "ट्रांजेक्शन के दौरान हुए परिवर्तनों को पूर्ववत करना", "ट्रांजेक्शन की गति बढ़ाना", "ट्रांजेक्शन को अटेंड करना" ], "correct": 1, "explanation": "'Rollback' का अर्थ है ट्रांजेक्शन के दौरान हुए परिवर्तनों को पूर्ववत करना, जिससे डेटाबेस की स्थिति ट्रांजेक्शन से पहले की स्थिति में लौट आ जाती है।" }, { "question": "डेटाबेस डिज़ाइन में 'Normalization Forms' का उद्देश्य क्या है?", "options": [ "डेटाबेस की प्रदर्शन क्षमता बढ़ाना", "डेटाबेस की संरचना को व्यवस्थित करना ताकि डेटा डुप्लिकेशन और अनावश्यक निर्भरता को कम किया जा सके", "डेटाबेस को एन्क्रिप्ट करना", "डेटाबेस के आकार को बढ़ाना" ], "correct": 1, "explanation": "Normalization Forms डेटाबेस की संरचना को व्यवस्थित करने के लिए होती हैं, जिससे डेटा डुप्लिकेशन और अनावश्यक निर्भरता को कम किया जा सके।" }, { "question": "NoSQL डेटाबेस में 'Column-Family Store' का उपयोग किसके लिए किया जाता है?", "options": [ "सिर्फ टेक्स्ट डेटा के लिए", "ग्राफ संबंधों को संग्रहित करने के लिए", "डेटा को स्तंभों के परिवारों में संग्रहीत करने के लिए, जैसे कि Cassandra", "इमेज डेटा के लिए" ], "correct": 2, "explanation": "'Column-Family Store' NoSQL डेटाबेस में डेटा को स्तंभों के परिवारों में संग्रहीत करता है, जिससे बड़ी मात्रा में डेटा को कुशलतापूर्वक प्रबंधित किया जा सके।" }, { "question": "SQL में 'WHERE' क्लॉज का उपयोग क्या करता है?", "options": [ "डेटा को समूहित करने के लिए", "डेटा को सॉर्ट करने के लिए", "क्वेरी में केवल उन रिकॉर्ड्स को शामिल करने के लिए जो विशिष्ट शर्तों को पूरा करते हैं", "डेटा को अपडेट करने के लिए" ], "correct": 2, "explanation": "'WHERE' क्लॉज का उपयोग SQL क्वेरी में केवल उन रिकॉर्ड्स को शामिल करने के लिए किया जाता है जो विशिष्ट शर्तों को पूरा करते हैं।" }, { "question": "रिलेशनल डेटाबेस में 'SQL Injection' क्या है?", "options": [ "डेटाबेस को तेजी से चलाने की प्रक्रिया", "एक प्रकार का सुरक्षा हमले जिसमें दुर्भावनापूर्ण SQL कोड को क्वेरी में सम्मिलित किया जाता है", "डेटाबेस में डेटा जोड़ने की विधि", "डेटाबेस को बैकअप करने की प्रक्रिया" ], "correct": 1, "explanation": "SQL Injection एक सुरक्षा हमला है जिसमें हमलावर दुर्भावनापूर्ण SQL कोड को क्वेरी में सम्मिलित करता है, जिससे डेटाबेस में अनधिकृत पहुँच प्राप्त की जा सकती है।" }, { "question": "NoSQL डेटाबेस में 'CAP Theorem' क्या कहता है?", "options": [ "डेटाबेस की गति को निर्धारित करता है", "Consistency, Availability, और Partition tolerance में से किसी दो को प्राप्त किया जा सकता है", "डेटाबेस को एन्क्रिप्ट करना", "डेटाबेस की संरचना को निर्दिष्ट करता है" ], "correct": 1, "explanation": "CAP Theorem कहता है कि किसी भी वितरित डेटाबेस सिस्टम में Consistency, Availability, और Partition tolerance में से केवल दो को ही एक साथ प्राप्त किया जा सकता है।" }, { "question": "SQL में 'INDEX' का क्या उपयोग है?", "options": [ "डेटा को एन्क्रिप्ट करने के लिए", "डेटा तक तेज़ पहुँच प्रदान करने के लिए तालिका के एक या अधिक स्तंभ पर इंडेक्स बनाना", "डेटा को ग्रुप करने के लिए", "डेटाबेस को सॉर्ट करने के लिए" ], "correct": 1, "explanation": "'INDEX' का उपयोग तालिका के एक या अधिक स्तंभ पर इंडेक्स बनाकर डेटा तक तेज़ पहुँच प्रदान करने के लिए किया जाता है, जिससे क्वेरी की गति बढ़ती है।" }, { "question": "ट्रांजेक्शन में 'Atomicity' गुण का क्या अर्थ है?", "options": [ "ट्रांजेक्शन को विभाजित करना", "ट्रांजेक्शन का एकमात्र निष्पादन सुनिश्चित करना, अर्थात् या तो पूरी तरह से सफल हो या पूरी तरह से विफल", "ट्रांजेक्शन के परिणामों को स्थायी बनाना", "ट्रांजेक्शन को अलग रखना" ], "correct": 1, "explanation": "Atomicity गुण यह सुनिश्चित करता है कि ट्रांजेक्शन का कार्य या तो पूरी तरह से सफल होता है या कोई भी बदलाव नहीं होता, जिससे डेटा की अखंडता बनी रहती है।" }, { "question": "डेटाबेस मॉडल्स में से कौन-सा मॉडल डेटा को वस्तुओं के रूप में संग्रहीत करता है?", "options": [ "रिलेशनल मॉडल", "हायरेरकी मॉडल", "ऑब्जेक्ट-ओरिएंटेड मॉडल", "नेटवर्क मॉडल" ], "correct": 2, "explanation": "ऑब्जेक्ट-ओरिएंटेड डेटाबेस मॉडल में डेटा को वस्तुओं के रूप में संग्रहीत किया जाता है, जिसमें डेटा के साथ उसके व्यवहार को भी परिभाषित किया जाता है।" }, { "question": "SQL में 'ALTER TABLE' का उपयोग क्या करता है?", "options": [ "तालिका को मर्ज करने के लिए", "तालिका के ढांचे में परिवर्तन करने के लिए, जैसे स्तंभ जोड़ना या हटाना", "तालिका के डेटा को सॉर्ट करने के लिए", "तालिका को बैकअप करने के लिए" ], "correct": 1, "explanation": "'ALTER TABLE' का उपयोग तालिका के ढांचे में परिवर्तन करने के लिए किया जाता है, जैसे कि नए स्तंभ जोड़ना, मौजूदा स्तंभ को संशोधित करना, या स्तंभ हटाना।" }, { "question": "NoSQL डेटाबेस में 'Cassandra' किस प्रकार का डेटाबेस है?", "options": [ "डॉक्युमेंट-आधारित", "ग्राफ डेटाबेस", "की-वैल्यू स्टोर", "कॉलम-फैमिली डेटाबेस" ], "correct": 3, "explanation": "Cassandra एक कॉलम-फैमिली स्टोर प्रकार का NoSQL डेटाबेस है, जो बड़ी मात्रा में डेटा को कुशलतापूर्वक प्रबंधित करता है।" }, { "question": "SQL में 'VIEW' का क्या उपयोग है?", "options": [ "डेटाबेस को एन्क्रिप्ट करने के लिए", "डेटाबेस में डेटा जोड़ने के लिए", "एक वर्चुअल टेबल बनाने के लिए जो एक या अधिक तालिकाओं से डेटा प्राप्त करती है", "डेटाबेस को बैकअप करने के लिए" ], "correct": 2, "explanation": "'VIEW' एक वर्चुअल टेबल होती है जो एक या अधिक तालिकाओं से डेटा प्राप्त करती है, जिससे जटिल क्वेरीज़ को सरल बनाया जा सकता है।" }, { "question": "डेटाबेस डिज़ाइन में 'Entity' और 'Relationship' क्या दर्शाते हैं?", "options": [ "Entity डेटा का प्रकार और Relationship डेटा की संरचना को दर्शाता है", "Entity वस्तुएं या वास्तविक चीजें हैं और Relationship उनके बीच के संबंधों को दर्शाता है", "Entity और Relationship दोनों डेटा को जोड़ने के लिए उपयोग किए जाते हैं", "Entity केवल टेक्स्ट डेटा को दर्शाता है और Relationship केवल नंबर डेटा को" ], "correct": 1, "explanation": "Entity वस्तुएं या वास्तविक चीजें होती हैं जिन्हें डेटाबेस में संग्रहित किया जाता है, जबकि Relationship उनके बीच के संबंधों को दर्शाता है।" }, { "question": "SQL में 'HAVING' क्लॉज का उपयोग कब किया जाता है?", "options": [ "डेटा को फिल्टर करने के लिए", "डेटा को सॉर्ट करने के लिए", "गर्म समूहों पर शर्तें लगाने के लिए, 'GROUP BY' के बाद", "नई तालिकाएँ बनाने के लिए" ], "correct": 2, "explanation": "'HAVING' क्लॉज का उपयोग 'GROUP BY' क्लॉज के साथ किया जाता है ताकि समूहों पर शर्तें लागू की जा सकें।" }, { "question": "NoSQL डेटाबेस में 'Graph Database' किस प्रकार के संबंधों को बेहतर ढंग से संभालता है?", "options": [ "एक साधारण कनेक्शन", "जटिल और कई-स्तरीय संबंध", "केवल एक-कनेक्शन संबंध", "डेटा को केवल टेबल में संग्रहित करना" ], "correct": 1, "explanation": "Graph Database जटिल और कई-स्तरीय संबंधों को बेहतर ढंग से संभालता है, जैसे सोशल नेटवर्क या सप्लाई चेन नेटवर्क।" }, { "question": "SQL में 'INSERT INTO' का क्या उपयोग है?", "options": [ "डेटा को अपडेट करने के लिए", "तालिका से डेटा हटाने के लिए", "तालिका में नए रिकॉर्ड्स जोड़ने के लिए", "तालिका को संशोधित करने के लिए" ], "correct": 2, "explanation": "'INSERT INTO' का उपयोग तालिका में नए रिकॉर्ड्स जोड़ने के लिए किया जाता है।" }, { "question": "डेटाबेस में 'Primary Key' और 'Unique Key' में क्या अंतर है?", "options": [ "'Primary Key' एक तालिका में केवल एक हो सकता है, जबकि 'Unique Key' कई हो सकते हैं", "'Unique Key' एक तालिका में केवल एक हो सकता है, जबकि 'Primary Key' कई हो सकते हैं", "दोनों में कोई अंतर नहीं", "'Primary Key' NULL मान स्वीकार करता है, जबकि 'Unique Key' नहीं" ], "correct": 0, "explanation": "'Primary Key' एक तालिका में केवल एक ही हो सकता है और यह NULL मान स्वीकार नहीं करता, जबकि 'Unique Key' कई हो सकते हैं और यह NULL मान स्वीकार कर सकते हैं।" }, { "question": "NoSQL डेटाबेस में 'Redis' किस प्रकार का डेटाबेस है?", "options": [ "डॉक्युमेंट-आधारित", "ग्राफ डेटाबेस", "की-वैल्यू स्टोर", "कॉलम-फैमिली डेटाबेस" ], "correct": 2, "explanation": "Redis एक की-वैल्यू स्टोर प्रकार का NoSQL डेटाबेस है, जो तेज़ डेटा एक्सेस प्रदान करता है।" }, { "question": "SQL में 'DELETE FROM' का उपयोग क्या करता है?", "options": [ "डेटा को जोड़ने के लिए", "डेटा को अपडेट करने के लिए", "तालिका से एक या अधिक रिकॉर्ड्स हटाने के लिए", "नई तालिकाएँ बनाने के लिए" ], "correct": 2, "explanation": "'DELETE FROM' का उपयोग तालिका से एक या अधिक रिकॉर्ड्स हटाने के लिए किया जाता है।" }, { "question": "डेटाबेस में 'Normalization' के कौन से फॉर्म में पहली फॉर्म नॉर्मलाइजेशन (1NF) होती है?", "options": [ "डेटाबेस को पहली बार डिज़ाइन करना", "तालिका में प्रत्येक कॉलम में केवल एक ही मान होना", "तालिका को द्वितीयक स्तर पर लाना", "डेटाबेस में डेटा को जोड़ना" ], "correct": 1, "explanation": "पहली फॉर्म नॉर्मलाइजेशन (1NF) यह सुनिश्चित करती है कि तालिका में प्रत्येक कॉलम में केवल एक ही मान हो, जिससे डेटा संरचना सरल और सटीक बनती है।" }, { "question": "NoSQL डेटाबेस में 'CouchDB' किस प्रकार का डेटाबेस है?", "options": [ "कॉलम-फैमिली स्टोर", "की-वैल्यू स्टोर", "डॉक्युमेंट-आधारित", "ग्राफ डेटाबेस" ], "correct": 2, "explanation": "CouchDB एक डॉक्युमेंट-आधारित NoSQL डेटाबेस है, जो JSON दस्तावेज़ों में डेटा संग्रहित करता है।" }, { "question": "SQL में 'UPDATE' स्टेटमेंट का उपयोग क्या करता है?", "options": [ "तालिका में नए रिकॉर्ड्स जोड़ने के लिए", "तालिका से रिकॉर्ड्स हटाने के लिए", "तालिका में मौजूदा रिकॉर्ड्स को संशोधित करने के लिए", "तालिका की संरचना बदलने के लिए" ], "correct": 2, "explanation": "'UPDATE' स्टेटमेंट का उपयोग तालिका में मौजूदा रिकॉर्ड्स को संशोधित करने के लिए किया जाता है।" }, { "question": "रिलेशनल डेटाबेस में 'Foreign Key' का महत्व क्या है?", "options": [ "डेटा को एन्क्रिप्ट करना", "तालिकाओं के बीच संबंध स्थापित करना", "डेटा को स्टोर करने का एक तरीका", "डेटाबेस को तेज़ करने के लिए" ], "correct": 1, "explanation": "Foreign Key का उपयोग तालिकाओं के बीच संबंध स्थापित करने के लिए किया जाता है, जिससे डेटा में सुसंगतता और अखंडता बनी रहती है।" }, { "question": "NoSQL डेटाबेस में 'BASE' क्या है?", "options": [ "डेटा की संरचना का एक मॉडल", "Consistency, Availability, Partition tolerance का विपरीत मॉडल", "Basically Available, Soft state, Eventual consistency", "एक प्रकार का SQL प्रोटोकॉल" ], "correct": 2, "explanation": "BASE का मतलब है Basically Available, Soft state, Eventual consistency, जो NoSQL डेटाबेस की लचीली संगतता मॉडल को दर्शाता है।" }, { "question": "SQL में 'INNER JOIN' और 'OUTER JOIN' में मुख्य अंतर क्या है?", "options": [ "'INNER JOIN' केवल मेल खाते रिकॉर्ड लौटाता है, जबकि 'OUTER JOIN' मेल न खाते रिकॉर्ड भी लौटाता है", "दोनों एक ही तरह से कार्य करते हैं", "'OUTER JOIN' केवल मेल खाते रिकॉर्ड लौटाता है", "'INNER JOIN' बाएँ तालिका के सभी रिकॉर्ड्स लौटाता है" ], "correct": 0, "explanation": "'INNER JOIN' केवल उन रिकॉर्ड्स को लौटाता है जो दोनों तालिकाओं में मेल खाते हैं, जबकि 'OUTER JOIN' मेल न खाते रिकॉर्ड्स को भी शामिल कर सकता है।" }, { "question": "डेटाबेस प्रबंधन प्रणाली में 'Backup' का क्या महत्व है?", "options": [ "डेटा को तेज़ी से एक्सेस करने के लिए", "डेटा को एन्क्रिप्ट करने के लिए", "डेटा की सुरक्षा और पुनर्प्राप्ति सुनिश्चित करने के लिए", "डेटा को नेटवर्क पर ट्रांसमिट करने के लिए" ], "correct": 2, "explanation": "Backup डेटा की सुरक्षा के लिए महत्वपूर्ण है, जिससे किसी भी डेटा हानि या सिस्टम फेल होने पर डेटा को पुनर्प्राप्त किया जा सके।" }, { "question": "NoSQL डेटाबेस में 'Eventual Consistency' क्या दर्शाता है?", "options": [ "डेटा हमेशा एकसमान रहता है", "डेटा कभी एकसमान नहीं होता", "कुछ समय के बाद डेटा एकसमान हो जाता है", "डेटा को एन्क्रिप्ट करता है" ], "correct": 2, "explanation": "'Eventual Consistency' का मतलब है कि कुछ समय के बाद डेटा सभी नोड्स पर एकसमान हो जाता है, हालांकि तुरंत नहीं।" }, { "question": "रिलेशनल डेटाबेस में 'Secondary Index' का क्या उपयोग है?", "options": [ "प्राइमरी की को बदलने के लिए", "डेटा को एन्क्रिप्ट करने के लिए", "तालिका में किसी अन्य स्तंभ पर तेज़ खोज प्रदान करने के लिए", "डेटाबेस को बैकअप करने के लिए" ], "correct": 2, "explanation": "'Secondary Index' तालिका के किसी अन्य स्तंभ पर तेज़ खोज प्रदान करने के लिए बनाया जाता है, जिससे क्वेरी प्रदर्शन में सुधार होता है।" }, { "question": "SQL में 'UNION' का क्या उपयोग है?", "options": [ "दो तालिकाओं को जोड़ने के लिए", "दो क्वेरी के परिणामों को एक साथ मिलाने के लिए, जो समान कॉलम की संख्या और प्रकार रखते हों", "डेटा को समूहित करने के लिए", "डेटा को अपडेट करने के लिए" ], "correct": 1, "explanation": "'UNION' का उपयोग दो क्वेरी के परिणामों को एक साथ मिलाने के लिए किया जाता है, बशर्ते दोनों क्वेरी में समान कॉलम की संख्या और प्रकार हों।" }, { "question": "NoSQL डेटाबेस में 'Couchbase' किस प्रकार का डेटाबेस है?", "options": [ "ग्राफ डेटाबेस", "डॉक्युमेंट-आधारित", "की-वैल्यू स्टोर", "कॉलम-फैमिली डेटाबेस" ], "correct": 1, "explanation": "Couchbase एक डॉक्युमेंट-आधारित NoSQL डेटाबेस है, जो JSON दस्तावेज़ों में डेटा संग्रहित करता है।" }, { "question": "SQL में 'GROUP BY' और 'ORDER BY' में क्या अंतर है?", "options": [ "'GROUP BY' डेटा को समूहित करता है, जबकि 'ORDER BY' डेटा को सॉर्ट करता है", "दोनों एक ही कार्य करते हैं", "'ORDER BY' डेटा को समूहित करता है, जबकि 'GROUP BY' डेटा को सॉर्ट करता है", "दोनों को एक साथ नहीं इस्तेमाल किया जा सकता" ], "correct": 0, "explanation": "'GROUP BY' का उपयोग डेटा को समूहित करने के लिए किया जाता है, जबकि 'ORDER BY' का उपयोग डेटा को सॉर्ट करने के लिए किया जाता है।" }, { "question": "NoSQL डेटाबेस में 'CAP Theorem' किस बारे में बताता है?", "options": [ "डेटाबेस की सुरक्षा", "Consistency, Availability, Partition tolerance में से किसी दो को प्राप्त किया जा सकता है", "डेटाबेस की गति", "डेटाबेस के प्रकार" ], "correct": 1, "explanation": "CAP Theorem कहता है कि किसी भी वितरित डेटाबेस सिस्टम में Consistency, Availability, और Partition tolerance में से केवल दो को ही एक साथ प्राप्त किया जा सकता है।" }, { "question": "SQL में 'TRANSACTION' का क्या महत्व है?", "options": [ "डेटा को सॉर्ट करने के लिए", "डेटाबेस में डेटा जोड़ने के लिए", "डेटाबेस में एक या अधिक ऑपरेशनों को एक एकीकृत यूनिट के रूप में निष्पादित करने के लिए, जिससे डेटा की अखंडता बनी रहे", "डेटाबेस को एन्क्रिप्ट करने के लिए" ], "correct": 2, "explanation": "'TRANSACTION' डेटाबेस में एक या अधिक ऑपरेशनों को एक एकीकृत यूनिट के रूप में निष्पादित करता है, जिससे डेटा की अखंडता सुनिश्चित होती है।" }, { "question": "रिलेशनल डेटाबेस में 'JOIN' के कितने प्रकार होते हैं?", "options": [ "दो", "चार", "तीन", "पाँच" ], "correct": 1, "explanation": "रिलेशनल डेटाबेस में मुख्यतः चार प्रकार के JOIN होते हैं: INNER JOIN, LEFT JOIN, RIGHT JOIN, और FULL OUTER JOIN।" }, { "question": "NoSQL डेटाबेस में 'Document Store' का एक उदाहरण क्या है?", "options": [ "Cassandra", "MongoDB", "Redis", "Neo4j" ], "correct": 1, "explanation": "MongoDB एक डॉक्युमेंट स्टोर प्रकार का NoSQL डेटाबेस है, जो JSON जैसे दस्तावेज़ों में डेटा संग्रहित करता है।" }, { "question": "SQL में 'SUBQUERY' क्या है?", "options": [ "एक अलग डेटाबेस में क्वेरी", "एक क्वेरी के अंदर लिखी गई दूसरी क्वेरी", "एक क्वेरी को दोबारा लिखना", "डेटाबेस को बैकअप करना" ], "correct": 1, "explanation": "'SUBQUERY' एक क्वेरी के अंदर लिखी गई दूसरी क्वेरी होती है, जिसे मुख्य क्वेरी के लिए डेटा प्रदान करने के लिए उपयोग किया जाता है।" }, { "question": "डेटाबेस में 'Index Scan' और 'Table Scan' में क्या अंतर है?", "options": [ "'Index Scan' तालिका को स्कैन करता है, जबकि 'Table Scan' इंडेक्स को", "'Index Scan' इंडेक्स का उपयोग करके डेटा तक पहुंचता है, जबकि 'Table Scan' पूरी तालिका को स्कैन करता है", "दोनों एक ही तरह से कार्य करते हैं", "'Table Scan' तेज होता है" ], "correct": 1, "explanation": "'Index Scan' इंडेक्स का उपयोग करके डेटा तक पहुंचता है, जिससे क्वेरी की गति बढ़ती है, जबकि 'Table Scan' पूरी तालिका को स्कैन करता है, जिससे समय अधिक लगता है।" }, { "question": "NoSQL डेटाबेस में 'Elasticsearch' किस प्रकार का डेटाबेस है?", "options": [ "ग्राफ डेटाबेस", "डॉक्युमेंट-आधारित", "की-वैल्यू स्टोर", "स्ट्रक्चर्ड डेटाबेस" ], "correct": 1, "explanation": "Elasticsearch एक डॉक्युमेंट-आधारित NoSQL डेटाबेस है, जो टेक्स्ट-आधारित डेटा के तेज़ खोज के लिए उपयोग किया जाता है।" }, { "question": "SQL में 'BETWEEN' क्लॉज का उपयोग क्या करता है?", "options": [ "डेटा को सॉर्ट करने के लिए", "डेटा को फिल्टर करने के लिए एक निर्दिष्ट सीमा के भीतर", "डेटा को समूहित करने के लिए", "डेटा को अपडेट करने के लिए" ], "correct": 1, "explanation": "'BETWEEN' क्लॉज का उपयोग SQL क्वेरी में रिकॉर्ड्स को फिल्टर करने के लिए किया जाता है जो एक निर्दिष्ट सीमा के भीतर होते हैं।" }, { "question": "रिलेशनल डेटाबेस में 'Referential Integrity' का क्या अर्थ है?", "options": [ "डेटाबेस की सुरक्षा", "तालिकाओं के बीच संबंधों की अखंडता सुनिश्चित करना", "डेटा की एन्क्रिप्शन", "डेटाबेस की गति बढ़ाना" ], "correct": 1, "explanation": "Referential Integrity यह सुनिश्चित करती है कि तालिकाओं के बीच संबंधों में कोई असंगतता न हो, जैसे कि Foreign Key हमेशा मौजूदा Primary Key को संदर्भित करता है।" }, { "question": "NoSQL डेटाबेस में 'GraphQL' का क्या उपयोग है?", "options": [ "डेटा को स्टोर करने के लिए", "डेटा को एन्क्रिप्ट करने के लिए", "API के माध्यम से डेटा को क्वेरी करने और मैनिपुलेट करने के लिए", "डेटाबेस को बैकअप करने के लिए" ], "correct": 2, "explanation": "GraphQL एक क्वेरी लैंग्वेज है जो API के माध्यम से डेटा को क्वेरी करने और मैनिपुलेट करने के लिए उपयोग की जाती है।" }, { "question": "SQL में 'COALESCE' फ़ंक्शन का क्या उपयोग है?", "options": [ "डेटा को एन्क्रिप्ट करने के लिए", "सबसे पहले नॉन-NULL मान को लौटाने के लिए", "डेटा को सॉर्ट करने के लिए", "डेटा को जोड़ने के लिए" ], "correct": 1, "explanation": "'COALESCE' फ़ंक्शन SQL में सबसे पहले नॉन-NULL मान को लौटाता है, जो विभिन्न स्तंभों से चुनने में उपयोगी होता है।" }, { "question": "रिलेशनल डेटाबेस में 'Normalization' की कितनी फॉर्म्स होती हैं?", "options": [ "तीन", "पांच", "चार", "दो" ], "correct": 2, "explanation": "Normalization में आमतौर पर पाँच फॉर्म्स होती हैं: 1NF, 2NF, 3NF, BCNF, और 4NF।" }, { "question": "NoSQL डेटाबेस में 'MongoDB' किस प्रकार का डेटाबेस है?", "options": [ "ग्राफ डेटाबेस", "डॉक्युमेंट-आधारित", "की-वैल्यू स्टोर", "कॉलम-फैमिली डेटाबेस" ], "correct": 1, "explanation": "MongoDB एक डॉक्युमेंट-आधारित NoSQL डेटाबेस है, जो JSON जैसे दस्तावेज़ों में डेटा संग्रहित करता है।" }, { "question": "SQL में 'TRANSACTION' की चार मुख्य विशेषताएँ कौन सी हैं?", "options": [ "Atomicity, Consistency, Isolation, Durability", "Accuracy, Consistency, Integrity, Availability", "Atomicity, Consistency, Integrity, Security", "Accuracy, Consistency, Isolation, Durability" ], "correct": 0, "explanation": "SQL में ट्रांजेक्शन की चार मुख्य विशेषताएँ ACID हैं: Atomicity, Consistency, Isolation, Durability।" }, { "question": "NoSQL डेटाबेस में 'Riak' किस प्रकार का डेटाबेस है?", "options": [ "ग्राफ डेटाबेस", "डॉक्युमेंट-आधारित", "की-वैल्यू स्टोर", "कॉलम-फैमिली डेटाबेस" ], "correct": 2, "explanation": "Riak एक की-वैल्यू स्टोर प्रकार का NoSQL डेटाबेस है, जो स्केलेबिलिटी और उच्च उपलब्धता प्रदान करता है।" }, { "question": "SQL में 'CASE' स्टेटमेंट का उपयोग क्या करता है?", "options": [ "डेटा को सॉर्ट करने के लिए", "कंडीशनल लॉजिक लागू करने के लिए", "डेटा को जोड़ने के लिए", "डेटा को अपडेट करने के लिए" ], "correct": 1, "explanation": "'CASE' स्टेटमेंट SQL में कंडीशनल लॉजिक लागू करने के लिए उपयोग किया जाता है, जिससे क्वेरी में विभिन्न शर्तों के आधार पर विभिन्न परिणाम प्राप्त किए जा सकते हैं।" } // More questions as needed... ]; let currentQuestionIndex = 0; // Track current question let userAnswers = Array(quizData.length).fill(null); // Track user's answers // Timer variables let totalQuizTime = quizData.length * 30; // total seconds = 30 seconds * no. of questions let timeLeft = totalQuizTime; let timerInterval; // On page load, initialize quiz window.onload = function() { generateQuestionNav(); // Generate the question navigation circles loadQuestion(); startTimer(); // Start the countdown }; // Start the countdown timer function startTimer() { updateTimerDisplay(timeLeft); timerInterval = setInterval(() => { timeLeft--; updateTimerDisplay(timeLeft); if (timeLeft <= 0) { clearInterval(timerInterval); showResults(); // Force show results if time is up } }, 1000); } // Update timer on the screen in mm:ss format function updateTimerDisplay(seconds) { const timerEl = document.getElementById("timer"); const mins = Math.floor(seconds / 60).toString().padStart(2, '0'); const secs = (seconds % 60).toString().padStart(2, '0'); timerEl.innerText = `Time: ${mins}:${secs}`; } // Toggle the question nav when hamburger is pressed const hamburgerBtn = document.getElementById('hamburgerBtn'); hamburgerBtn.addEventListener('click', () => { document.getElementById('questionNavOverlay').classList.toggle('show'); }); // Close hamburger menu if user clicks outside the nav and menu document.addEventListener('click', (e) => { const navOverlay = document.getElementById('questionNavOverlay'); const hamburger = document.getElementById('hamburgerBtn'); // If the menu is open, and the click is outside both the overlay and the hamburger, close it if ( navOverlay.classList.contains('show') && !navOverlay.contains(e.target) && !hamburger.contains(e.target) ) { navOverlay.classList.remove('show'); } }); // Create small clickable circles for each question function generateQuestionNav() { const navContainer = document.getElementById("questionNav"); navContainer.innerHTML = ""; // clear old items if any quizData.forEach((_, index) => { const circle = document.createElement("div"); circle.classList.add("circle-number"); circle.innerText = index + 1; // Show question number (1-based) circle.onclick = () => jumpToQuestion(index); navContainer.appendChild(circle); }); } // Jump to a specific question function jumpToQuestion(qIndex) { currentQuestionIndex = qIndex; // Hide the nav on mobile after selection document.getElementById('questionNavOverlay').classList.remove('show'); // Reset submission/next button state document.getElementById("submitAnswerButton").classList.remove("hidden"); document.getElementById("nextButton").classList.add("hidden"); loadQuestion(); } // Load current question function loadQuestion() { highlightCurrentCircle(); // Hide explanation area and Next button initially document.getElementById("explanation").classList.add("hidden"); document.getElementById("nextButton").classList.add("hidden"); const questionData = quizData[currentQuestionIndex]; document.getElementById("question").innerText = questionData.question; document.getElementById("questionCounter").innerText = `${currentQuestionIndex + 1}/${quizData.length}`; // Clear old choices const choicesContainer = document.getElementById("choices"); choicesContainer.innerHTML = ""; // Populate choices questionData.options.forEach((option, index) => { const choiceElement = document.createElement("div"); choiceElement.className = "choice"; choiceElement.innerText = option; // If previously selected, mark it if (userAnswers[currentQuestionIndex] === index) { choiceElement.classList.add("selected"); } // On clicking a choice choiceElement.onclick = () => { // Clear all selections first document.querySelectorAll(".choice").forEach(c => c.classList.remove("selected")); // Mark this one as selected choiceElement.classList.add("selected"); userAnswers[currentQuestionIndex] = index; }; choicesContainer.appendChild(choiceElement); }); // Handle Previous button visibility document.getElementById("prevButton").style.display = currentQuestionIndex === 0 ? "none" : "inline-block"; } // Highlight the current question circle function highlightCurrentCircle() { const circles = document.querySelectorAll(".circle-number"); circles.forEach((circle, idx) => { circle.classList.remove("active"); if (idx === currentQuestionIndex) { circle.classList.add("active"); } }); } // Submit the current question's answer function submitAnswer() { const questionData = quizData[currentQuestionIndex]; const userAnswer = userAnswers[currentQuestionIndex]; // Show the explanation div const explanationDiv = document.getElementById("explanation"); explanationDiv.classList.remove("hidden"); // Clear previous correctness classes and disable further selection document.querySelectorAll(".choice").forEach((c) => { c.classList.add("disabled"); c.onclick = null; }); // Determine correctness or skipping if (userAnswer === null) { explanationDiv.innerHTML = "You Skipped the question.<br/><br/>व्याख्या: " + questionData.explanation; showPopupMessage("You Skipped the question", false); } else if (userAnswer === questionData.correct) { explanationDiv.innerHTML = "You got it right!<br/><br/>व्याख्या: " + questionData.explanation; showPopupMessage("You got it right", true); // Highlight correct choice document.querySelectorAll(".choice")[userAnswer].classList.add("correct"); } else { explanationDiv.innerHTML = "You got it wrong.<br/><br/>व्याख्या: " + questionData.explanation; showPopupMessage("You got it wrong", false); // Highlight correct choice document.querySelectorAll(".choice")[questionData.correct].classList.add("correct"); // Mark the chosen one as incorrect document.querySelectorAll(".choice")[userAnswer].classList.add("incorrect"); } // Hide the submit button, show the next button document.getElementById("submitAnswerButton").classList.add("hidden"); document.getElementById("nextButton").classList.remove("hidden"); } // Go to the next question or show final results function nextQuestion() { currentQuestionIndex++; if (currentQuestionIndex >= quizData.length) { // Show results if no more questions showResults(); } else { // Reset buttons document.getElementById("submitAnswerButton").classList.remove("hidden"); document.getElementById("nextButton").classList.add("hidden"); loadQuestion(); } } // Go to the previous question function previousQuestion() { if (currentQuestionIndex > 0) { currentQuestionIndex--; document.getElementById("submitAnswerButton").classList.remove("hidden"); document.getElementById("nextButton").classList.add("hidden"); loadQuestion(); } } // Show final quiz results function showResults() { // Stop the timer if it's still running clearInterval(timerInterval); // Calculate correct answers const correctAnswersCount = userAnswers.filter( (ans, i) => ans === quizData[i].correct ).length; // Hide quiz content document.getElementById("quizContent").classList.add("hidden"); // Show results document.getElementById("resultContent").classList.remove("hidden"); const percentage = (correctAnswersCount / quizData.length) * 100; let resultHTML = ""; if (percentage >= 60) { resultHTML = `<div class="congrats">🎉 बधाई हो! आपने ${percentage.toFixed( 2 )}% स्कोर किया है!</div>`; } else { resultHTML = `<div class="sad">😢 आपने ${percentage.toFixed( 2 )}% स्कोर किया है। अगली बार के लिए शुभकामनाएं!</div>`; } document.getElementById("resultMessage").innerHTML = resultHTML; document.getElementById("scoreMessage").innerText = `आपने कुल ${quizData.length} में से ${correctAnswersCount} प्रश्न सही उत्तर दिए हैं।`; } // Optional popup message function showPopupMessage(message, isCorrect) { const popup = document.getElementById('popupMessage'); popup.innerText = message; popup.className = ''; popup.classList.add('show'); popup.classList.add(isCorrect ? 'correct' : 'incorrect'); setTimeout(() => { popup.classList.remove('show'); popup.classList.add('hidden'); }, 2000); } // Button event listeners document.getElementById('prevButton').addEventListener('click', previousQuestion); document.getElementById('submitAnswerButton').addEventListener('click', submitAnswer); document.getElementById('nextButton').addEventListener('click', nextQuestion); // Predefined Darker Color Themes const themes = [ { header: '#a31645', headerText: '#ffffff', container: '#e8c4d6', containerText: '#6e0c36', headings: '#6e0c36' }, // Berry Delight { header: '#00574b', headerText: '#ffffff', container: '#b3dfd7', containerText: '#00382e', headings: '#00382e' }, // Ocean Breeze { header: '#c95a00', headerText: '#ffffff', container: '#dca865', containerText: '#7a3400', headings: '#7a3400' }, // Sunset Glow { header: '#4a0f6f', headerText: '#ffffff', container: '#cdb5e3', containerText: '#320b4a', headings: '#320b4a' }, // Calming Lavender { header: '#1e4d2b', headerText: '#ffffff', container: '#98c1a3', containerText: '#122417', headings: '#122417' }, // Forest Retreat { header: '#c99800', headerText: '#ffffff', container: '#e8d18a', containerText: '#6c4f00', headings: '#6c4f00' }, // Golden Elegance { header: '#01477e', headerText: '#ffffff', container: '#86b9e4', containerText: '#00223d', headings: '#00223d' }, // Sky Calm { header: '#5a3b2e', headerText: '#ffffff', container: '#b8a89c', containerText: '#32211a', headings: '#32211a' }, // Retro Rust { header: '#b34727', headerText: '#ffffff', container: '#f2c29d', containerText: '#6a2915', headings: '#6a2915' }, // Warm Peach { header: '#0f4c43', headerText: '#ffffff', container: '#92c3b8', containerText: '#072822', headings: '#072822' }, // Cool Mint ]; // Apply Random Darker Theme function applyRandomTheme() { const header = document.querySelector('.header'); const container = document.querySelector('.content-container'); const headings = document.querySelectorAll('.content-container h2'); // Select a random theme const randomTheme = themes[Math.floor(Math.random() * themes.length)]; // Apply Header Colors header.style.backgroundColor = randomTheme.header; header.style.color = randomTheme.headerText; // Apply Container Colors container.style.backgroundColor = randomTheme.container; container.style.color = randomTheme.containerText; // Apply Heading Colors headings.forEach((heading) => { heading.style.color = randomTheme.headings; heading.style.borderBottom = `2px solid ${randomTheme.headings}`; }); } // Apply the theme on page load window.onload = function () { applyRandomTheme(); // Set random theme generateQuestionNav(); // Generate question navigation loadQuestion(); // Load the first question startTimer(); // Start the countdown timer }; </script> </body> </html> <!-- /wp:html -->