``` **Explanation of Choices:** * **``:** This is the most important SEO tag. It's concise, includes the core topic (`Memory Mapped I/O`), context (`Microprocessor Question`), exam relevance (`GATE BME 2020`), and brand (`Examprev`). * **`<meta name="description">`:** A compelling summary that encourages clicks. It clearly states the topic, the context (GATE Biomedical Engineering), and highlights the key takeaway (I/O devices addressed as memory locations) while implying a solution is available. * **`<meta name="keywords">`:** While less impactful for ranking than in the past, still good for defining the page's topic. Includes core concepts, exam details, and related broader fields. * **`<link rel="canonical">`:** Prevents duplicate content issues by telling search engines that this is the primary version of the page. * **Open Graph (`og:`) Tags:** Crucial for how the content appears when shared on social media platforms (Facebook, LinkedIn, etc.). They provide a rich snippet with a specific title, description, and potentially an image. * **Twitter Card Tags:** Similar to Open Graph, but specifically for Twitter, allowing for a more visually appealing tweet when the link is shared. * **`robots`:** Explicitly tells search engine crawlers to index and follow links on the page (this is usually the default, but good to be explicit). * **`author`:** Credits the website/publisher. <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet"> <style> :root { --primary: #6366f1; --primary-dark: #4f46e5; --primary-light: #e0e7ff; --success: #10b981; --error: #ef4444; --warning: #f59e0b; --dark: #0f172a; --dark-light: #1e293b; --gray: #64748b; --gray-light: #f1f5f9; --white: #ffffff; --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25); --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.25); --border-radius: 16px; --border-radius-sm: 8px; } body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; min-height: 100vh; color: var(--dark); line-height: 1.6; } .background-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: radial-gradient(circle at 25% 25%, rgba(99, 102, 241, 0.1) 0%, transparent 50%), radial-gradient(circle at 75% 75%, rgba(168, 85, 247, 0.1) 0%, transparent 50%); pointer-events: none; z-index: -1; } .container { max-width: 1024px; margin: 0 auto; padding: 0 20px; } .progress-container { flex: 1; max-width: 300px; margin: 0 20px; } .progress-bar { width: 100%; height: 8px; background: var(--gray-light); border-radius: 20px; overflow: hidden; margin-bottom: 4px; } .progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); border-radius: 20px; width: 20%; transition: width 0.3s ease; } .progress-text { font-size: 12px; color: var(--gray); text-align: center; } .question-meta { display: flex; align-items: center; gap: 12px; } .question-number { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); } .difficulty { padding: 6px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; } .difficulty.easy { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #166534; } .difficulty.medium { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; } .difficulty.hard { background: linear-gradient(135deg, #fecaca, #fca5a5); color: #dc2626; } /* Main Content */ .main-content { padding: 32px 0; } .content-wrapper { display: grid; grid-template-columns: 1fr 8fr 1fr; gap: 24px; align-items: start; } .left-spacer, .right-spacer { /* Empty spacer columns for large screens */ } .question-card { background: var(--white); border-radius: var(--border-radius); padding: 20px; margin-bottom: 24px; box-shadow: var(--shadow-lg); border: 1px solid rgba(229, 231, 235, 0.2); grid-column: 2; } /* Question Badge with Menu */ .question-badge-container { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; position: relative; } .question-type-badge { display: inline-flex; align-items: center; gap: 8px; background: var(--primary-light); color: var(--primary-dark); padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; flex: 1; } .menu-button { background: none; border: none; color: var(--gray); font-size: 18px; padding: 8px; border-radius: 50%; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; position: relative; } .menu-button:hover { background: var(--gray-light); color: var(--dark); } .menu-button.active { background: var(--primary-light); color: var(--primary-dark); } /* Dropdown Menu */ .dropdown-menu { position: absolute; top: 100%; right: 0; background: var(--white); border-radius: var(--border-radius-sm); box-shadow: var(--shadow-lg); border: 1px solid rgba(229, 231, 235, 0.3); min-width: 200px; z-index: 1000; opacity: 0; transform: translateY(-10px); pointer-events: none; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); } .dropdown-menu.show { opacity: 1; transform: translateY(0); pointer-events: auto; } .dropdown-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--dark); text-decoration: none; font-size: 14px; font-weight: 500; border: none; background: none; width: 100%; text-align: left; cursor: pointer; transition: background-color 0.2s ease; border-bottom: 1px solid rgba(229, 231, 235, 0.3); } .dropdown-item:last-child { border-bottom: none; } .dropdown-item:hover { background: var(--gray-light); } .dropdown-item i { color: var(--gray); width: 16px; text-align: center; } .dropdown-item.contributor { cursor: default; color: var(--gray); font-weight: 400; } .dropdown-item.contributor:hover { background: none; } .dropdown-item.contributor .contributor-name { color: var(--primary-dark); font-weight: 600; } .dropdown-item.report:hover { background: rgba(16, 185, 129, 0.1); color: var(--success); } .dropdown-item.copyright:hover { background: rgba(239, 68, 68, 0.1); color: var(--error); } /* Overlay for closing dropdown */ .dropdown-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 999; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; } .dropdown-overlay.show { opacity: 1; pointer-events: auto; } .question-text { font-size: 17px; font-weight: 600; color: var(--dark); margin-bottom: 32px; line-height: 1.4; } /* Enhanced MCQ Options */ .mcq-options { display: grid; gap: 10px; margin-bottom: 32px; } .option { background: var(--white); border: 2px solid rgba(99, 102, 241, 0.1); border-radius: var(--border-radius); padding: 10px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; align-items: center; gap: 16px; position: relative; overflow: hidden; } .option::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--primary); transform: scaleY(0); transition: transform 0.3s ease; } .option:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); } .option:hover::before { transform: scaleY(1); } .option.selected { background: var(--primary-light); border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-lg); } .option.selected::before { transform: scaleY(1); } .option.correct { background: linear-gradient(135deg, #f0fdf4, #dcfce7) !important; border-color: var(--success) !important; animation: correctPulse 0.6s ease; } .option.incorrect { background: linear-gradient(135deg, #fef2f2, #fecaca) !important; border-color: var(--error) !important; animation: incorrectShake 0.6s ease; } .option-label { width: 40px; height: 40px; border-radius: 50%; background: var(--gray-light); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--gray); flex-shrink: 0; transition: all 0.3s ease; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } .option.selected .option-label { background: var(--primary); color: white; transform: scale(1.1); } .option.correct .option-label { background: var(--success); color: white; } .option.incorrect .option-label { background: var(--error); color: white; } .option-text { flex: 1; font-size: 14px; font-weight: 500; } /* Action Buttons */ .actions { display: flex; gap: 16px; justify-content: center; } .btn { padding: 14px 28px; border-radius: var(--border-radius); border: none; font-weight: 600; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-size: 16px; display: flex; align-items: center; gap: 10px; text-decoration: none; position: relative; overflow: hidden; } .btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); transition: left 0.5s; } .btn:hover::before { left: 100%; } .btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; box-shadow: var(--shadow); } .btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); } .btn-secondary { background: var(--white); color: var(--gray); border: 2px solid rgba(100, 116, 139, 0.2); } .btn-secondary:hover { background: var(--gray-light); transform: translateY(-1px); } /* Explanation Card */ .explanation { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border: 1px solid #bbf7d0; border-radius: var(--border-radius); padding: 0; margin-top: 0; max-height: 0; opacity: 0; overflow: hidden; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); } .explanation.show { max-height: 200px; opacity: 1; padding: 24px; margin-top: 24px; } .explanation h4 { color: #166534; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; } .explanation p { color: #15803d; line-height: 1.7; font-size: 15px; } /* Similar Questions */ .similar-section { background: var(--white); border-radius: var(--border-radius); padding: 32px; margin-bottom: 24px; box-shadow: var(--shadow-lg); border: 1px solid rgba(229, 231, 235, 0.2); grid-column: 2; } .section-title { font-size: 20px; font-weight: 700; color: var(--dark); margin-bottom: 24px; display: flex; align-items: center; gap: 12px; } .similar-questions-grid { display: grid; gap: 16px; } .similar-question { background: var(--white); border: 1px solid rgba(99, 102, 241, 0.1); border-radius: var(--border-radius-sm); padding: 20px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; overflow: hidden; } .similar-question::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--primary); transform: scaleY(0); transition: transform 0.3s ease; } .similar-question:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); } .similar-question:hover::before { transform: scaleY(1); } .similar-question-text { font-size: 16px; color: var(--dark); margin-bottom: 12px; font-weight: 500; line-height: 1.5; } .similar-question-meta { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--gray); } .question-id { font-weight: 600; color: var(--primary); } /* Tags */ .tags-section { background: var(--white); border-radius: var(--border-radius); padding: 32px; box-shadow: var(--shadow-lg); border: 1px solid rgba(229, 231, 235, 0.2); grid-column: 2; } .tags-grid { display: flex; flex-wrap: wrap; gap: 12px; } .tag { background: var(--white); color: var(--primary-dark); padding: 10px 18px; border-radius: 20px; font-size: 14px; font-weight: 500; border: 2px solid var(--primary-light); cursor: pointer; transition: all 0.3s ease; position: relative; overflow: hidden; } .tag::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent); transition: left 0.5s; } .tag:hover::before { left: 100%; } .tag:hover { background: var(--primary); color: white; transform: translateY(-2px); box-shadow: var(--shadow); } /* Animations */ @keyframes correctPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } } @keyframes incorrectShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } } /* Responsive Design */ @media (max-width: 768px) { .container { padding: 0 16px; } .content-wrapper { grid-template-columns: 1fr; gap: 16px; } .question-card, .similar-section, .tags-section { grid-column: 1; padding: 24px 20px; } .header-content { flex-wrap: wrap; } .progress-container { order: 3; flex-basis: 100%; max-width: none; margin: 12px 0 0 0; } .question-text { font-size: 17px; } .option { padding: 16px; gap: 12px; } .option-label { width: 36px; height: 36px; } .actions { flex-direction: column; } .btn { width: 100%; justify-content: center; } .section-title { font-size: 18px; } .main-content { padding: 24px 0; } .dropdown-menu { right: -10px; min-width: 180px; } } @media (max-width: 480px) { .logo { font-size: 20px; } .question-number { padding: 6px 12px; font-size: 12px; } .question-text { font-size: 18px; } .option { padding: 14px; gap: 10px; } .option-label { width: 32px; height: 32px; font-size: 14px; } .btn { padding: 12px 20px; font-size: 15px; } .content-wrapper { grid-template-columns: 1fr; gap: 12px; } .question-card, .similar-section, .tags-section { grid-column: 1; padding: 20px 16px; } } /* Loading state */ .loading { display: inline-block; width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, 0.3); border-radius: 50%; border-top-color: #fff; animation: spin 1s ease-in-out infinite; } @keyframes spin { to { transform: rotate(360deg); } } </style> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="csrf-token" content="JVZT2x84oe0asKJFA8Z5xWqOHb9X7Uy5nqE2SFcl"> <link rel="icon" href="/image/logo.jpg" type="image/x-icon" alt="logo of ExamPrev"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4999327676889242" crossorigin="anonymous"></script> <link href="https://examprev.com/css/contribute.css" rel="stylesheet" type="text/css"> </head> <body> <nav class="navbar navbar-expand-lg navbar-light bg-light"> <a class="navbar-brand" href="/"><img src="https://examprev.com/image/examprev.png" class="examprev-logo" alt="ExamPrev Logo"></a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav"> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-graduation-cap me-1"></i> <span class="heading">Exams</span> </a> <ul class="dropdown-menu" aria-labelledby="navbarDropdown"> <li><a onclick="window.location.href = '/gate-exam'"><i class="fas fa-cogs"></i>Gate Exam</a></li> <li><a onclick="window.location.href = '/ssc-exam'"><i class="fas fa-landmark"></i>SSC Exam</a></li> <li><a onclick="window.location.href = '/ies-ese-exam'"><i class="fas fa-microchip"></i>IES/ESE Exam</a></li> <li><a onclick="window.location.href = '/upse-exam'"><i class="fas fa-balance-scale"></i>UPSE Exam</a></li> <li><a onclick="window.location.href = 'https://examprev.com/exams'"><i class="fas fa-ellipsis-h"></i>See More</a></li> </ul> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> <i class="fas fa-hands-helping me-1"></i>Contribute </a> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="/contribute-question-with-examprev"><i class="fas fa-question-circle me-2"></i>Contribute Questions</a></li> <li><a class="dropdown-item" href="/contribute-answer-with-examprev"><i class="fas fa-lightbulb me-2"></i>Contribute Answers</a></li> <li><a class="dropdown-item" href="/correct-the-question-answer-contribute-with-examprev"><i class="fas fa-edit me-2"></i>Contribute Corrections</a></li> </ul> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="aptitudeDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-brain me-1"></i> <span class="heading">Aptitude</span> </a> <ul class="dropdown-menu" aria-labelledby="aptitudeDropdown"> <li><a onclick="window.location.href = '/quantitative-aptitude'"><i class="fas fa-calculator"></i>Quantitative Aptitude</a></li> <li><a onclick="window.location.href = '/logical-reasoning'"><i class="fas fa-puzzle-piece"></i>Logical Reasoning</a></li> <li><a onclick="window.location.href = '/verbal-ability'"><i class="fas fa-comment-alt"></i>Verbal Ability</a></li> </ul> </li> <!-- New Sections Menu --> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="sectionsDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fas fa-th-large me-1"></i> <span class="heading">Sections</span> </a> <ul class="dropdown-menu" aria-labelledby="sectionsDropdown"> <li><a href="/practice-tests"><i class="fas fa-clipboard-list"></i>Practice Tests</a></li> <li><a href="/mock-exams"><i class="fas fa-file-alt"></i>Mock Exams</a></li> <li><a href="/study-materials"><i class="fas fa-book"></i>Study Materials</a></li> <li><a href="/video-lectures"><i class="fas fa-play-circle"></i>Video Lectures</a></li> <li><a href="/current-affairs"><i class="fas fa-newspaper"></i>Current Affairs</a></li> </ul> </li> <li class="nav-item"> <a class="nav-link" href="/contact"> <i class="fas fa-envelope me-1"></i> <strong>Contact Us</strong> </a> </li> </ul> <!-- Profile Section --> <div class="profile-section"> <!-- Search Box --> <div class="search-container"> <i class="fas fa-search search-icon"></i> <input type="text" class="search-input" placeholder="Search questions, topics..."> </div> <!-- Notifications --> <div class="notification-dropdown"> <button class="notification-btn" id="notificationBtn"> <i class="fas fa-bell"></i> <span class="notification-badge" id="notificationBadge" style="display: none;">0</span> </button> <div class="notification-menu" id="notificationMenu"> <!-- Content will be populated by JavaScript --> </div> </div> <!-- Profile Dropdown --> <div class="profile-dropdown"> <button class="profile-btn" id="profileBtn"> <i class="fas fa-user"></i> </button> <div class="profile-menu" id="profileMenu"> </div> </div> </div> </div> </nav> <div class="main-body"> <div class="background-overlay"></div> <!-- Main Content --> <main class="main-content"> <div class="container"> <div class="content-wrapper"> <div class="left-spacer"></div> <!-- Question Card --> <section class="question-card"> <div class="question-badge-container"> <div class="question-type-badge"> <i class="fas fa-route"></i> Biomedical Engineering > GATE 2020 > Input/Output </div> <div class="menu-container"> <button class="menu-button" onclick="toggleDropdown()" id="menuButton"> <i class="fas fa-ellipsis-v"></i> </button> <div class="dropdown-menu" id="dropdownMenu"> <div class="dropdown-item contributor"> <i class="fas fa-user"></i> <span>Contributed by: <span class="contributor-name">Dr. Sarah Chen</span></span> </div> <button class="dropdown-item report" onclick="reportCorrect()"> <i class="fas fa-flag"></i> <span>Report Correct</span> </button> <button class="dropdown-item copyright" onclick="copyrightClaim()"> <i class="fas fa-copyright"></i> <span>Copyright Claim</span> </button> </div> </div> </div> <div class="question-text"> In microprocessor systems with memory mapped I/O, which of the following is true? </div> <!-- MCQ Options --> <div class="mcq-options"> <div class="option" onclick="selectOption(this, 'A')"> <div class="option-label">A</div> <div class="option-text">Only I/O devices with internal memory can be interfaced.</div> </div> <div class="option" onclick="selectOption(this, 'B')"> <div class="option-label">B</div> <div class="option-text">I/O devices can be accessed using IN and OUT instructions</div> </div> <div class="option" onclick="selectOption(this, 'C')"> <div class="option-label">C</div> <div class="option-text">Each I/O device can be addressed as a memory location</div> </div> <div class="option" onclick="selectOption(this, 'D')"> <div class="option-label">D</div> <div class="option-text">Arithmetic and logic operations cannot be directly performed with the I/O data</div> </div> </div> <div class="actions"> <button class="btn btn-primary" onclick="checkAnswer()"> <i class="fas fa-check"></i> Check Answer </button> </div> <div class="explanation" id="explanation"> <h4> <i class="fas fa-lightbulb"></i> Explanation </h4> <p>Correct : c</p> <p></p> </div> </section> <!-- Similar Questions --> <section class="similar-section"> <h2 class="section-title"> <i class="fas fa-link"></i> Similar Questions </h2> <div class="similar-questions-grid"> <div class="similar-question" onclick="loadQuestion(23)"> <div class="similar-question-text"> What is the worst-case time complexity of insertion in an AVL tree? </div> <div class="similar-question-meta"> <span class="question-id">Question #23</span> <span>Medium</span> </div> </div> <div class="similar-question" onclick="loadQuestion(31)"> <div class="similar-question-text"> Which operations on a binary search tree have O(h) complexity? </div> <div class="similar-question-meta"> <span class="question-id">Question #31</span> <span>Easy</span> </div> </div> <div class="similar-question" onclick="loadQuestion(47)"> <div class="similar-question-text"> Compare search complexities of sorted array vs balanced BST. </div> <div class="similar-question-meta"> <span class="question-id">Question #47</span> <span>Hard</span> </div> </div> </div> </section> <!-- Tags Section --> <section class="tags-section"> <h2 class="section-title"> <i class="fas fa-tags"></i> Related Topics </h2> <div class="tags-grid"> <span class="tag" onclick="filterByTag('Data Structures')">Data Structures</span> <span class="tag" onclick="filterByTag('Binary Search Tree')">Binary Search Tree</span> <span class="tag" onclick="filterByTag('Time Complexity')">Time Complexity</span> <span class="tag" onclick="filterByTag('Algorithm Analysis')">Algorithm Analysis</span> <span class="tag" onclick="filterByTag('Tree Algorithms')">Tree Algorithms</span> <span class="tag" onclick="filterByTag('Computer Science')">Computer Science</span> </div> </section> <div class="right-spacer"></div> </div> </div> </main> <!-- Dropdown Overlay --> <div class="dropdown-overlay" id="dropdownOverlay" onclick="closeDropdown()"></div> <script> // Question data const questionData = { id: 10, type: 'mcq', correct_answers: ['B'], explanation: 'In a balanced binary search tree, the search operation has O(log n) time complexity.' }; let selectedOptions = []; let answered = false; let dropdownOpen = false; // Dropdown functionality function toggleDropdown() { const menu = document.getElementById('dropdownMenu'); const overlay = document.getElementById('dropdownOverlay'); const button = document.getElementById('menuButton'); if (dropdownOpen) { closeDropdown(); } else { openDropdown(); } } function openDropdown() { const menu = document.getElementById('dropdownMenu'); const overlay = document.getElementById('dropdownOverlay'); const button = document.getElementById('menuButton'); menu.classList.add('show'); overlay.classList.add('show'); button.classList.add('active'); dropdownOpen = true; } function closeDropdown() { const menu = document.getElementById('dropdownMenu'); const overlay = document.getElementById('dropdownOverlay'); const button = document.getElementById('menuButton'); menu.classList.remove('show'); overlay.classList.remove('show'); button.classList.remove('active'); dropdownOpen = false; } function reportCorrect() { closeDropdown(); showToast('Thank you for reporting. We will review this question.', 'info'); } function copyrightClaim() { closeDropdown(); showToast('Copyright claim submitted. Our team will investigate.', 'warning'); } function selectOption(element, option) { if (answered) return; // Clear previous selections for single choice document.querySelectorAll('.option').forEach(opt => opt.classList.remove('selected')); // Select current option element.classList.add('selected'); selectedOptions = [option]; } function checkAnswer() { answered = true; // Update button with loading state const btn = document.querySelector('.btn-primary'); btn.innerHTML = '<div class="loading"></div> Checking...'; btn.disabled = true; setTimeout(() => { checkMCQAnswer(); document.getElementById('explanation').classList.add('show'); // Update button btn.innerHTML = '<i class="fas fa-arrow-right"></i> Next Question'; btn.onclick = nextQuestion; btn.disabled = false; }, 1000); } function checkMCQAnswer() { document.querySelectorAll('.option').forEach(opt => { const optionLetter = opt.querySelector('.option-label').textContent; if (questionData.correct_answers.includes(optionLetter)) { opt.classList.add('correct'); } else if (selectedOptions.includes(optionLetter)) { opt.classList.add('incorrect'); } }); // Show appropriate message based on user's selection if (selectedOptions.length === 0) { showToast('No answer selected. Correct answer is highlighted!', 'info'); } else if (selectedOptions.some(option => questionData.correct_answers.includes(option))) { showToast('Correct! Well done!', 'success'); } else { showToast('Incorrect. The correct answer is highlighted.', 'error'); } } function nextQuestion() { // Add page transition effect document.body.style.opacity = '0.5'; setTimeout(() => { window.location.href = `/questions/${questionData.id + 1}`; }, 300); } function loadQuestion(questionId) { window.location.href = `/questions/${questionId}`; } function filterByTag(tag) { window.location.href = `/questions?tag=${encodeURIComponent(tag)}`; } function showToast(message, type) { // Create toast notification const toast = document.createElement('div'); toast.style.cssText = ` position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 8px; color: white; font-weight: 600; z-index: 1000; transform: translateX(100%); transition: transform 0.3s ease; ${type === 'success' ? 'background: #10b981;' : type === 'error' ? 'background: #ef4444;' : type === 'info' ? 'background: #3b82f6;' : 'background: #f59e0b;'} `; toast.textContent = message; document.body.appendChild(toast); // Animate in setTimeout(() => { toast.style.transform = 'translateX(0)'; }, 100); // Remove after 3 seconds setTimeout(() => { toast.style.transform = 'translateX(100%)'; setTimeout(() => { document.body.removeChild(toast); }, 300); }, 3000); } // Close dropdown when clicking outside document.addEventListener('click', function(event) { const menu = document.getElementById('dropdownMenu'); const button = document.getElementById('menuButton'); if (!menu.contains(event.target) && !button.contains(event.target)) { closeDropdown(); } }); // Initialize document.addEventListener('DOMContentLoaded', function() { // Any initialization code can go here }); </script> <div class="login-modal-overlay" id="loginModalOverlay"> <div class="login-modal" id="loginModal"> <div class="login-modal-header"> <h5>Sign in to ExamPrev</h5> <button class="close-btn" id="closeLoginModal"> <i class="fas fa-times"></i> </button> </div> <div class="login-modal-body"> <div class="social-container small"> <!-- Google Icon --> <div class="social-circle"> <a href="https://examprev.com/auth/google"> <svg class="social-icon" viewBox="0 0 24 24"> <path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/> <path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/> <path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/> <path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/> </svg> </a> </div> <!-- Facebook Icon --> <div class="social-circle"> <svg class="social-icon" viewBox="0 0 24 24"> <path fill="#1877F2" d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/> <path fill="#FFFFFF" d="M16.671 15.543l.532-3.47h-3.328v-2.25c0-.949.465-1.874 1.956-1.874h1.513V5.996s-1.374-.235-2.686-.235c-2.741 0-4.533 1.662-4.533 4.669v2.632H7.078v3.47h3.047v8.385a12.118 12.118 0 003.75 0v-8.385h2.796z"/> </svg> </div> </div> <div class="login-options"> <form action="/login-post" method="POST"> <input type="hidden" name="_token" value="JVZT2x84oe0asKJFA8Z5xWqOHb9X7Uy5nqE2SFcl"> <div class="mb-3"> <input type="email" class="form-control" placeholder="Enter email" id="login_email" name="email" value="" required> </div> <div class="mb-3"> <input type="password" class="form-control" placeholder="Enter password" id="login_password" name="password" required> </div> <div class="text-center mt-3"> <button class="login-option-btn primary"> <i class="fas fa-sign-in-alt"></i>   Login</button> </div> </form> <div class="text-center mt-3"> <a href="/login?Register">Create Account</a> | <a href="/login?Forgot">Forgot Password?</a> </div> </div> </div> </div> </div> </div> </div> <footer class="footer-section"> <div class="footer-content pt-5 pb-5"> <div class="row"> <div class="col-xl-4 col-lg-4 mb-50"> <div class="footer-widget"> <div class="footer-logo"> <img src="https://examprev.com/image/examprev.png" style="border-radius: 15%;" width="160" height="70" class="d-inline-block align-text-top" alt="ExamPrev Logo"> </div> <div class="footer-text"> <p>ExamPrev : Best Source for Prevoius Year Question</p> </div> <div class="footer-icon-text"> <span id="spanh3">Follow us</span> </div> <div class="footer-social-icon"> <a href="https://www.facebook.com/smallcode023/"><img src="/image/facebook.svg" style="width:35px; height:35px;" alt="ExamPrev Facebook"></a> <a href="https://twitter.com/_SmallCode?s=08"><img src="/image/twitter.svg" style="width:35px; height:35px;" alt="ExamPrev Twitter"></a> <a href="https://www.instagram.com/_smallcode_/"><img src="/image/instagram.svg" style="width:35px; height:35px;" alt="ExamPrev Instagram"></a> <a href="https://www.linkedin.com/company/small-code/"><img src="/image/linkedin.svg" style="width:35px; height:35px;" alt="ExamPrev Linkedin"></a> <a href="https://www.youtube.com/channel/UC7qbMbMZ-pFRUJZq8UlvEfQ"><img src="/image/youtube.svg" style="width:35px; height:35px;" alt="ExamPrev Youtube"></a> </div> <br> </div> </div> <div class="col-xl-4 col-lg-4 col-md-6 mb-30"> <div class="footer-widget"> <div class="footer-widget-heading"> <span id="spanh3">Useful Links</span><br><br> </div> <ul id="foolter-ul"> <li><a href="https://examprev.com">Home</a></li> <li><a href="https://examprev.com/gate-exam">Gate Exam</a></li> <li><a href="https://examprev.com/ssc-exam">SSC Exam</a></li> <li><a href="https://examprev.com/ies-ese-exam">IES/ESE Exam</a></li> <li><a href="https://examprev.com/upse-exam">UPSE Exam</a></li> <li><a href="https://examprev.com/gate-computer-science-and-it">Gate CS/IT</a></li> </ul> </div> </div> <div class="col-xl-4 col-lg-4 col-md-6 mb-50"> <div class="footer-widget"> <div class="footer-widget-heading"> <span id="spanh3">Get Latest Tech. News</span><br><br> </div> <div class="footer-text mb-25"> <p>Donโ€™t miss to subscribe for new News of Technologies.</p> </div> <div class="subscribe-form"> <form action="/subscribe-examprev" method="post"> <input type="hidden" name="_token" value="JVZT2x84oe0asKJFA8Z5xWqOHb9X7Uy5nqE2SFcl"> <input type="email" name='email' placeholder="Email Address" required> <input hidden type="text" name='type' value="Subscribe" placeholder="Email Address" required> <button>Send</button> </form> </div> </div> </div> </div> </div> <div class="copyright-area"> <div class="row"> <div class="col-xl-5 col-lg-5 text-center text-lg-left"> <div class="copyright-text"> <p>Copyright © 2024, All Right Reserved ExamPrev</p> </div> </div> <div class="col-xl-7 col-lg-7 d-lg-block text-right"> <div class="footer-menu"> <ul> <li><a href="https://examprev.com/terms-and-condition">Terms & Condition</a></li> <li><a href="https://examprev.com/privacy">Privacy</a></li> <li><a href="https://examprev.com/disclaimer">Disclaimer</a></li> <li><a href="https://examprev.com/contact">Contact Us</a></li> <li><a href="https://examprev.com/about">About Us</a></li> </ul> </div> </div> </div> </div> </footer> </body> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script> // Get data from Laravel controller const user = null; const sampleNotifications = []; // Global variables to store menu elements let notificationBtn, notificationMenu, notificationOverlay, notificationBadge; // Generate notification content function function generateNotificationContent() { if (!user) { return ` <div class="login-prompt"> <i class="fas fa-user-lock"></i> <h6>Sign in to View Notifications</h6> <p>Login to access your personalized notifications and stay updated with your exam progress.</p> <a href="/login" class="login-btn"> <i class="fas fa-sign-in-alt me-2"></i> Login Now </a> </div> `; } const notifications = sampleNotifications || []; const unreadCount = notifications.filter(n => n.unread).length; let content = ` <div class="notification-header"> <h6 class="notification-title"> <i class="fas fa-bell me-2"></i> Notifications ${unreadCount > 0 ? `<span class="notification-count">${unreadCount} new</span>` : ''} </h6> </div> `; if (notifications.length === 0) { content += ` <div class="notification-empty"> <i class="fas fa-bell-slash"></i> <h6>No Notifications</h6> <p>You're all caught up! New notifications will appear here.</p> </div> `; } else { content += '<div class="notification-body">'; notifications.forEach(notification => { content += ` <div class="notification-item ${notification.unread ? 'unread' : ''}" onclick="markAsRead(${notification.id})"> <div class="notification-icon ${notification.type}"> <i class="${notification.icon}"></i> </div> <div class="notification-content"> <p class="notification-text">${notification.text}</p> <small class="notification-time">${notification.time}</small> </div> </div> `; }); content += '</div>'; } if (notifications.length > 0) { content += ` <div class="notification-footer"> <a href="/notifications">View All Notifications</a> </div> `; } return content; } // Close notification menu function function closeNotificationMenu() { if (notificationMenu) notificationMenu.classList.remove('show'); if (notificationOverlay) notificationOverlay.classList.remove('show'); } // Open notification menu function function openNotificationMenu() { if (typeof closeLoginModal === 'function') { closeLoginModal(); } if (notificationMenu) notificationMenu.classList.add('show'); if (notificationOverlay) notificationOverlay.classList.add('show'); } function initializeNotifications() { // Get DOM elements notificationBtn = document.getElementById('notificationBtn'); notificationMenu = document.getElementById('notificationMenu'); notificationOverlay = document.getElementById('notificationOverlay'); notificationBadge = document.getElementById('notificationBadge'); if (!notificationBtn || !notificationMenu) { console.error('Notification elements not found'); return; } // Populate notification menu notificationMenu.innerHTML = generateNotificationContent(); // Toggle notification dropdown notificationBtn.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); const isOpen = notificationMenu.classList.contains('show'); console.log('Notification button clicked, isOpen:', isOpen); if (isOpen) { closeNotificationMenu(); } else { openNotificationMenu(); } }); // Close notification menu when clicking outside document.addEventListener('click', function(e) { if (!notificationBtn.contains(e.target) && !notificationMenu.contains(e.target)) { closeNotificationMenu(); } }); // Close notification menu when clicking overlay if (notificationOverlay) { notificationOverlay.addEventListener('click', closeNotificationMenu); } // Close notification menu on escape key document.addEventListener('keydown', function(e) { if (e.key === 'Escape') { closeNotificationMenu(); if (typeof closeLoginModal === 'function') { closeLoginModal(); } } }); // Prevent notification menu from closing when clicking inside it notificationMenu.addEventListener('click', function(e) { e.stopPropagation(); }); } // Profile dropdown functionality function initializeProfile() { const profileBtn = document.getElementById('profileBtn'); const profileMenu = document.getElementById('profileMenu'); if (!profileBtn) return; if (!user) { // For unauthenticated users, show login modal profileBtn.addEventListener('click', function(e) { e.stopPropagation(); if (typeof openLoginModal === 'function') { openLoginModal(); } }); } else { // For authenticated users, use hover behavior (handled by CSS) // Additional click handling for mobile profileBtn.addEventListener('click', function(e) { e.stopPropagation(); if (profileMenu) { const isVisible = profileMenu.style.opacity === '1' || window.getComputedStyle(profileMenu).opacity === '1'; if (isVisible) { profileMenu.style.opacity = '0'; profileMenu.style.visibility = 'hidden'; profileMenu.style.transform = 'translateY(10px)'; } else { closeNotificationMenu(); if (typeof closeLoginModal === 'function') { closeLoginModal(); } profileMenu.style.opacity = '1'; profileMenu.style.visibility = 'visible'; profileMenu.style.transform = 'translateY(0)'; } } }); // Close profile menu when clicking outside (mobile) document.addEventListener('click', function(e) { if (window.innerWidth <= 768 && profileMenu && !profileBtn.contains(e.target) && !profileMenu.contains(e.target)) { profileMenu.style.opacity = '0'; profileMenu.style.visibility = 'hidden'; profileMenu.style.transform = 'translateY(10px)'; } }); } } // Login modal functionality function initializeLoginModal() { const loginModalOverlay = document.getElementById('loginModalOverlay'); const loginModal = document.getElementById('loginModal'); const closeLoginBtn = document.getElementById('closeLoginModal'); if (!loginModalOverlay) return; // Only for unauthenticated users // Close login modal window.closeLoginModal = function() { loginModalOverlay.classList.remove('show'); }; // Open login modal window.openLoginModal = function() { closeNotificationMenu(); loginModalOverlay.classList.add('show'); }; // Close button if (closeLoginBtn) { closeLoginBtn.addEventListener('click', window.closeLoginModal); } // Close when clicking overlay loginModalOverlay.addEventListener('click', function(e) { if (e.target === loginModalOverlay) { window.closeLoginModal(); } }); // Prevent modal from closing when clicking inside if (loginModal) { loginModal.addEventListener('click', function(e) { e.stopPropagation(); }); } } // Mark notification as read function markAsRead(notificationId) { if (!user || !sampleNotifications) return; const notification = sampleNotifications.find(n => n.id === notificationId); if (notification && notification.unread) { notification.unread = false; // Update badge count const unreadCount = sampleNotifications.filter(n => n.unread).length; if (notificationBadge) { notificationBadge.textContent = unreadCount; notificationBadge.style.display = unreadCount > 0 ? 'block' : 'none'; } // Refresh notification content if (notificationMenu) { notificationMenu.innerHTML = generateNotificationContent(); } // Send AJAX request to mark notification as read fetch('/notifications/mark-read', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content') }, body: JSON.stringify({ notification_id: notificationId }) }) .then(response => response.json()) .then(data => { if (data.success) { console.log('Notification marked as read'); } }) .catch(error => { console.error('Error marking notification as read:', error); // Revert the change if request failed notification.unread = true; const unreadCount = sampleNotifications.filter(n => n.unread).length; if (notificationBadge) { notificationBadge.textContent = unreadCount; notificationBadge.style.display = unreadCount > 0 ? 'block' : 'none'; } if (notificationMenu) { notificationMenu.innerHTML = generateNotificationContent(); } }); } } // Initialize when DOM is loaded document.addEventListener('DOMContentLoaded', function() { console.log('DOM loaded, initializing...'); initializeNotifications(); initializeProfile(); initializeLoginModal(); }); // Function to add new notification (for testing or real-time updates) function addNewNotification(notification) { if (user && sampleNotifications) { sampleNotifications.unshift(notification); // Update badge and content if (notificationBadge) { const unreadCount = sampleNotifications.filter(n => n.unread).length; notificationBadge.textContent = unreadCount; notificationBadge.style.display = unreadCount > 0 ? 'block' : 'none'; } if (notificationMenu) { notificationMenu.innerHTML = generateNotificationContent(); } } } // Function to refresh notifications from server function refreshNotifications() { if (!user) return; fetch('/notifications/get', { method: 'GET', headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content') } }) .then(response => response.json()) .then(data => { if (data.success && data.notifications) { // Update notifications array sampleNotifications.length = 0; sampleNotifications.push(...data.notifications); // Update UI if (notificationBadge) { const unreadCount = sampleNotifications.filter(n => n.unread).length; notificationBadge.textContent = unreadCount; notificationBadge.style.display = unreadCount > 0 ? 'block' : 'none'; } if (notificationMenu) { notificationMenu.innerHTML = generateNotificationContent(); } } }) .catch(error => { console.error('Error refreshing notifications:', error); }); } // Auto-refresh notifications every 30 seconds if user is logged in if (user) { setInterval(refreshNotifications, 30000); } function updateVisitorCount(count) { const countDiv = document.getElementById('visitorCount'); countDiv.innerHTML = ''; const countString = count.toString(); for (let digit of countString) { const digitSpan = document.createElement('span'); digitSpan.classList.add('digit'); digitSpan.textContent = digit; countDiv.appendChild(digitSpan); } } window.onload = function() { try { const currentUrl = window.location.href; if (currentUrl === "https://examprev.com/contribute-answer-with-examprev") { const branchSelect = document.getElementById('branchSelect'); const selectedBranch = branchSelect.value; fetchQuestions(selectedBranch); } console.log("Page loaded successfully without errors."); } catch(error) { console.error("An error occurred:", error.message); } const csrfToken = document.querySelector('input[name="_token"]')?.value; if (!csrfToken) { console.error('CSRF token not found'); return; } const currentURL = window.location.href; const formData = new FormData(); // Assuming csrf() is a function that returns the CSRF token. formData.append('currentUrl', currentURL); async function fetchVisitorCount() { // Make the function async try { const response = await fetch('/getVisitorCount', { method: 'POST', headers: { 'X-CSRF-TOKEN': csrfToken }, body: formData }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); // Parse the JSON response updateVisitorCount(data.count); // Assuming the response has a 'count' property } catch (error) { console.error("Error fetching visitor count:", error); updateVisitorCount(12345888); // Fallback if fetch fails } } fetchVisitorCount(); // Call the async function }; function scrollPagination(direction) { const container = document.getElementById("paginationContainer"); const scrollAmount = 100; // Adjust scroll distance container.scrollBy({ left: direction * scrollAmount, behavior: "smooth" }); } function ensureActivePageVisible() { const container = document.getElementById("paginationContainer"); const activePage = document.querySelector(".custom-pagination-button.active"); if (activePage) { const containerRect = container.getBoundingClientRect(); const activePageRect = activePage.getBoundingClientRect(); // Check if the active page is outside the visible scroll area if (activePageRect.left < containerRect.left || activePageRect.right > containerRect.right) { container.scrollLeft += (activePageRect.left - containerRect.left) - (container.offsetWidth / 2) + (activePage.offsetWidth / 2); } } } // Ensure current page is visible when the page loads document.addEventListener("DOMContentLoaded", ensureActivePageVisible); document.querySelectorAll(".option").forEach(fieldset => { fieldset.addEventListener("click", function () { let questionId = this.getAttribute("data-question-id"); let messageElement = document.getElementById("message-" + questionId); // Prevent multiple attempts per question if (document.querySelector(`[data-question-id='${questionId}'].correct`) || document.querySelector(`[data-question-id='${questionId}'].incorrect`)) { return; } let legend = this.querySelector("legend"); legend.style.visibility = "visible"; legend.style.fontFamily = "'Poppins', sans-serif"; if (this.getAttribute("data-correct") === "true") { this.classList.add("correct"); legend.innerText = "Correct"; legend.classList.add("correct-text"); messageElement.innerText = "Correct! ๐ŸŽ‰"; messageElement.style.color = "green"; } else { this.classList.add("incorrect"); legend.innerText = "Incorrect"; legend.classList.add("incorrect-text"); messageElement.innerText = "Incorrect! โŒ Try again."; messageElement.style.color = "red"; // Highlight correct answers within the same question document.querySelectorAll(`[data-question-id='${questionId}'][data-correct='true']`).forEach(correctOption => { correctOption.classList.add("correct"); let correctLegend = correctOption.querySelector("legend"); correctLegend.style.visibility = "visible"; correctLegend.innerText = "Correct"; correctLegend.classList.add("correct-text"); }); } }); }); </script></html>