ÿþ<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Class XI Mathematics Sample Paper Generator</title> <link href="img/logo1.jpg" rel="icon"> <!-- Add jsPDF library --> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> :root { --primary: #4361ee; --primary-dark: #3f37c9; --secondary: #4895ef; --danger: #f72585; --success: #4cc9f0; --light: #f8f9fa; --dark: #212529; --gray: #6c757d; --border-radius: 12px; --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); --transition: all 0.3s ease; } * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } body { background: linear-gradient(135deg, #f5f7fa 0%, #e2e8f0 100%); min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 20px; color: var(--dark); line-height: 1.6; } .container { width: 100%; max-width: 900px; background: white; border-radius: var(--border-radius); box-shadow: var(--box-shadow); overflow: hidden; transition: var(--transition); animation: fadeIn 0.5s ease-out; } @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .header { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 30px 20px; text-align: center; position: relative; overflow: hidden; } .header::before { content: ''; position: absolute; top: -50px; right: -50px; width: 150px; height: 150px; background: rgba(255, 255, 255, 0.1); border-radius: 50%; } .header h1 { font-size: 2rem; margin-bottom: 10px; font-weight: 700; position: relative; z-index: 1; } .header p { font-size: 1rem; opacity: 0.9; position: relative; z-index: 1; } .content-area { padding: 30px; } .hidden { display: none !important; } .btn { display: inline-block; padding: 12px 28px; border-radius: 50px; font-weight: 600; cursor: pointer; transition: var(--transition); border: none; text-align: center; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); margin: 10px 5px; } .btn-primary { background: var(--primary); color: white; } .btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 8px 15px rgba(67, 97, 238, 0.3); } .btn-success { background: var(--success); color: white; } .btn-success:hover { background: #3ab0d6; transform: translateY(-2px); box-shadow: 0 8px 15px rgba(76, 201, 240, 0.3); } .btn-danger { background: var(--danger); color: white; } .btn-danger:hover { background: #d3166b; transform: translateY(-2px); box-shadow: 0 8px 15px rgba(247, 37, 133, 0.3); } .btn-group { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 20px 0; } .section-title { text-align: center; margin-bottom: 25px; color: var(--primary-dark); font-size: 1.5rem; position: relative; padding-bottom: 10px; } .section-title::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 80px; height: 3px; background: var(--secondary); border-radius: 3px; } .checkbox-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; margin: 25px 0; } .checkbox-item { display: flex; align-items: center; } .checkbox-item input { margin-right: 10px; width: 18px; height: 18px; cursor: pointer; } .checkbox-item label { cursor: pointer; font-size: 0.95rem; } .generated-paper { padding: 30px; } .paper-header { text-align: center; margin-bottom: 30px; border-bottom: 2px solid var(--primary); padding-bottom: 20px; } .paper-header h2 { color: var(--primary-dark); margin-bottom: 5px; font-size: 1.8rem; } .paper-header h3 { color: var(--gray); margin-bottom: 5px; font-size: 1.2rem; font-weight: 500; } .paper-meta { display: flex; justify-content: space-between; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid #eee; font-weight: 500; } .instructions { margin-bottom: 30px; padding: 20px; background: #f8f9fa; border-radius: var(--border-radius); } .instructions ol { padding-left: 20px; margin-top: 10px; } .instructions li { margin-bottom: 8px; } .question-section { margin-bottom: 30px; } .section-heading { font-weight: 600; color: var(--primary-dark); margin-bottom: 15px; padding-bottom: 5px; border-bottom: 1px solid #eee; } .question { margin-bottom: 20px; page-break-inside: avoid; } .question-text { font-weight: 500; margin-bottom: 8px; } .option { margin-left: 20px; margin-bottom: 5px; } .action-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; margin-top: 40px; } @media (max-width: 768px) { .header h1 { font-size: 1.6rem; } .content-area { padding: 20px; } .checkbox-container { grid-template-columns: 1fr; } .btn { padding: 10px 20px; font-size: 0.9rem; } .paper-header h2 { font-size: 1.4rem; } .paper-header h3 { font-size: 1rem; } } @media (max-width: 480px) { .header { padding: 20px 15px; } .section-title { font-size: 1.3rem; } .paper-meta { flex-direction: column; gap: 10px; } .action-buttons { flex-direction: column; align-items: center; } .btn { width: 100%; max-width: 250px; } } @media print { body { background: none; padding: 0; } .container { box-shadow: none; max-width: 100%; } .action-buttons { display: none; } .question { page-break-inside: avoid; } } </style> <style> /* Ensure header styling is preserved */ .header { background: linear-gradient(135deg, #4361ee, #3f37c9) !important; color: white !important; padding: 30px 20px !important; text-align: center !important; position: relative !important; overflow: hidden !important; width: 100% !important; } .header h1, .header h2, .header h3 { color: white !important; font-weight: bold !important; } .temp-pdf-container { font-family: Arial, sans-serif; line-height: 1.5; } .temp-pdf-container * { max-width: 100% !important; background-color: white !important; color: black !important; } /* Page break control */ .question { page-break-inside: avoid; break-inside: avoid; } .question-section { page-break-after: auto; } @media print { body { margin: 0 !important; padding: 0 !important; background: white !important; } .container { width: 100% !important; margin: 0 !important; padding: 0 !important; box-shadow: none !important; } .header { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; } } /* Home icon styles */ .home-icon { position: absolute; top: 20px; left: 20px; color: white; font-size: 24px; cursor: pointer; transition: var(--transition); z-index: 2; } .home-icon:hover { transform: scale(1.1); color: rgba(255, 255, 255, 0.8); } @media (max-width: 480px) { .home-icon { font-size: 20px; top: 15px; left: 15px; } } @media print { .home-icon { display: none; } } </style> </head> <body> <div class="container" id="startContainer"> <div class="header"> <a href="cbse-class-9-to-12-exam-paper-generator.html" class="home-icon"> <i class="fas fa-home"></i> </a> <h1>Class XI Mathematics</h1> <p>Generate Customized Sample Papers</p> </div> <div class="content-area"> <div id="startScreen"> <h2 class="section-title">Mathematics Paper Generator</h2> <div class="btn-group"> <button class="btn btn-primary" onclick="showChapterSelection()">Start Generating</button> </div> </div> <div id="chapterSelection" class="hidden"> <h2 class="section-title">Select Chapters for Mathematics</h2> <form id="chapterForm"> <div class="checkbox-container"> <div class="checkbox-item"> <input type="checkbox" id="fullPaper" name="chapter" value="Full Paper" onchange="toggleChapters()"> <label for="fullPaper">Full Paper (All Chapters)</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter1" name="chapter" value="Chapter 1"> <label for="chapter1">1. Sets</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter2" name="chapter" value="Chapter 2"> <label for="chapter2">2. Relations and Functions</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter3" name="chapter" value="Chapter 3"> <label for="chapter3">3. Trigonometric Functions</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter4" name="chapter" value="Chapter 4"> <label for="chapter4">4. Principle of Mathematical Induction</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter5" name="chapter" value="Chapter 5"> <label for="chapter5">5. Complex Number and Quadratic Equations</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter6" name="chapter" value="Chapter 6"> <label for="chapter6">6. Linear Inequalities</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter7" name="chapter" value="Chapter 7"> <label for="chapter7">7. Permutations and Combinations</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter8" name="chapter" value="Chapter 8"> <label for="chapter8">8. Binomial Theorem</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter9" name="chapter" value="Chapter 9"> <label for="chapter9">9. Sequences and Series</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter10" name="chapter" value="Chapter 10"> <label for="chapter10">10. Straight Lines</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter11" name="chapter" value="Chapter 11"> <label for="chapter11">11. Conic Sections</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter12" name="chapter" value="Chapter 12"> <label for="chapter12">12. Introduction to Three Dimensional Geometry</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter13" name="chapter" value="Chapter 13"> <label for="chapter13">13. Limits and Derivatives</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter14" name="chapter" value="Chapter 14"> <label for="chapter14">14. Mathematical Reasoning</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter15" name="chapter" value="Chapter 15"> <label for="chapter15">15. Statistics</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter16" name="chapter" value="Chapter 16"> <label for="chapter16">16. Probability</label> </div> </div> </form> <div id="message" class="hidden"></div> <div class="btn-group"> <button class="btn btn-danger" onclick="backToStart()">Back to Start</button> <button class="btn btn-success" onclick="promptSchoolName()">Generate Paper</button> </div> </div> </div> </div> <div class="container hidden" id="generatedPaperContainer"></div> <script> // Initialize jsPDF const { jsPDF } = window.jspdf; let schoolName = ''; let questionCounter = 1; let sessionYear = ''; const questions = { mathematics: { "Chapter 1": { mcq: [ { question: "If A = {1, 3, 5, 7, 9} and B = {2, 3, 5, 7}, then A )" B is:", options: ["{3, 5, 7}", "{1, 2, 3, 5, 7, 9}", "{1, 9}", "{2}"], answer: "{3, 5, 7}" }, { question: "The set {x: x is a positive integer less than 6 and 3x - 1 is an even number} is equal to:", options: ["{1, 2, 3, 4, 5}", "{1, 3, 5}", "{2, 4}", "{1, 2, 3}"], answer: "{1, 3, 5}" }, { question: "If A and B are two sets such that n(A) = 15, n(B) = 21 and n(A *" B) = 29, then n(A )" B) is:", options: ["6", "7", "8", "9"], answer: "7" }, { question: "Which of the following is a finite set?", options: ["The set of lines parallel to the x-axis", "The set of letters in the English alphabet", "The set of numbers divisible by 5", "The set of animals living on earth"], answer: "The set of letters in the English alphabet" }, { question: "If A = {a, b, c, d} and B = {c, d, e, f}, then A - B is:", options: ["{a, b}", "{e, f}", "{a, b, e, f}", "{c, d}"], answer: "{a, b}" } ], assertion: [ { statement1: "Every set is a subset of itself.", statement2: "An empty set is a subset of every set.", options: ["Both true", "Both false", "Only statement 1 is true", "Only statement 2 is true"], answer: "Both true" }, { statement1: "The power set of an empty set has one element.", statement2: "The number of subsets of a set with n elements is 2^n.", options: ["Both true", "Both false", "Only statement 1 is true", "Only statement 2 is true"], answer: "Both true" } ], twoMark: [ "Write the set {x: x is an integer and -3 < x < 4} in roster form.", "If A = {1, 2, 3, 4}, B = {3, 4, 5, 6}, find A *" B and A )" B.", "If U = {1, 2, 3, 4, 5, 6, 7, 8, 9}, A = {1, 2, 3, 4}, B = {2, 4, 6, 8}, find (A *" B)'.", "If A and B are two sets such that n(A) = 25, n(B) = 20 and n(A )" B) = 10, find n(A *" B)." ], threeMark: [ "In a survey of 500 students, 200 take tea, 150 take coffee and 100 take both. How many students take neither tea nor coffee?", "If A = {1, 2, 3, 4, 5}, B = {4, 5, 6, 7, 8}, C = {7, 8, 9, 10} and D = {9, 10, 11, 12}, find (A *" B) )" (C *" D).", "Using properties of sets, show that for any two sets A and B, A *" (B - A) = A *" B." ], fiveMark: [ "In a survey of 600 students in a school, 150 students were found to be taking tea and 225 taking coffee, 100 were taking both tea and coffee. Find how many students were taking neither tea nor coffee? Represent the given information in a Venn diagram.", "In a class of 35 students, 17 have taken Mathematics, 10 have taken Mathematics but not Economics. Find the number of students who have taken both Mathematics and Economics and the number of students who have taken Economics but not Mathematics, if it is given that each student has taken either Mathematics or Economics or both.", "Let A, B and C be three sets. If A " B and B ‚" C, is it true that A ‚" C? If not, give an example." ], caseStudy: [ { case: "In a school, out of 100 students, 60 students drink tea, 50 drink coffee and 30 drink both tea and coffee. Based on this information, answer the following questions:", questions: ["Find the number of students who drink only tea.", "Find the number of students who drink only coffee.", "How many students drink at least one of the two drinks?"] } ] }, "Chapter 2": { mcq: [ { question: "If A = {1, 2, 3} and B = {4, 5}, then the number of relations from A to B is:", options: ["8", "16", "32", "64"], answer: "64" }, { question: "The domain of the function f(x) = "(4 - x²) is:", options: ["[-2, 2]", "(-", -2] *" [2, ")", "(-", -2) *" (2, ")", "(-2, 2)"], answer: "[-2, 2]" }, { question: "If f(x) = x² - 1/x², then f(x) + f(1/x) is equal to:", options: ["0", "1", "x²", "1/x²"], answer: "0" }, { question: "The range of the function f(x) = |x - 1| is:", options: ["[0, ")", "(0, ")", "[1, ")", "(-", ")"], answer: "[0, ")" }, { question: "If f = {(1, 2), (2, 3), (3, 4)} and g = {(2, 1), (3, 2), (4, 3)}, then g o f is:", options: ["{(1, 1), (2, 2), (3, 3)}", "{(1, 2), (2, 3), (3, 4)}", "{(2, 1), (3, 2), (4, 3)}", "{(1, 3), (2, 4)}"], answer: "{(1, 1), (2, 2), (3, 3)}" } ], assertion: [ { statement1: "Every relation is a function.", statement2: "Every function is a relation.", options: ["Both true", "Both false", "Only statement 1 is true", "Only statement 2 is true"], answer: "Only statement 2 is true" }, { statement1: "The function f(x) = x³ is one-one.", statement2: "The function f(x) = x² is one-one.", options: ["Both true", "Both false", "Only statement 1 is true", "Only statement 2 is true"], answer: "Only statement 1 is true" } ], twoMark: [ "Find the domain of the function f(x) = "(x - 1) + "(3 - x).", "If f(x) = x², find [f(1.1) - f(1)] / (1.1 - 1).", "Let A = {1, 2, 3, 4} and B = {5, 6, 7, 8}. Determine whether {(1, 5), (2, 6), (3, 7), (4, 8)} is a function from A to B or not.", "Find the range of the function f(x) = x² + 2 for all real x." ], threeMark: [ "Let f: R ’! R be defined by f(x) = 3x - 2. Show that f is one-one and onto. Hence find f{ ¹.", "If f(x) = (4x + 3)/(6x - 4), x `" 2/3, show that f o f(x) = x for all x `" 2/3. What is the inverse of f?", "Let A = R - {3} and B = R - {1}. Consider the function f: A ’! B defined by f(x) = (x - 2)/(x - 3). Show that f is bijective." ], fiveMark: [ "Let A = {1, 2, 3, ..., 9} and R be the relation in A × A defined by (a, b) R (c, d) if a + d = b + c for (a, b), (c, d) in A × A. Prove that R is an equivalence relation. Also obtain the equivalence class [(2, 5)].", "Let f: N ’! N be defined by f(n) = { (n+1)/2, if n is odd; n/2, if n is even } for all n " N. State whether the function f is bijective. Justify your answer.", "Let A = R - {3} and B = R - {1}. Consider the function f: A ’! B defined by f(x) = (x - 2)/(x - 3). Show that f is one-one and onto. Hence find f{ ¹." ], caseStudy: [ { case: "A relation R is defined on the set A = {1, 2, 3, 4, 5, 6} as R = {(x, y): y is divisible by x}. Based on this information, answer the following questions:", questions: ["Write R in roster form.", "Find the domain and range of R.", "Is R reflexive, symmetric or transitive?"] } ] }, // ... (other chapters follow similar pattern with updated content) "Chapter 16": { mcq: [ { question: "A die is thrown once. The probability of getting a number greater than 3 is:", options: ["1/2", "1/3", "1/4", "1/6"], answer: "1/2" }, { question: "Three coins are tossed simultaneously. The probability of getting exactly two heads is:", options: ["1/8", "3/8", "1/2", "5/8"], answer: "3/8" }, { question: "A card is drawn from a well-shuffled deck of 52 cards. The probability of getting a red king is:", options: ["1/26", "1/13", "1/52", "1/4"], answer: "1/26" }, { question: "If P(A) = 0.4, P(B) = 0.5 and P(A )" B) = 0.3, then P(A *" B) is:", options: ["0.6", "0.7", "0.8", "0.9"], answer: "0.6" }, { question: "If A and B are two events such that P(A) = 0.6, P(B) = 0.3 and P(A )" B) = 0.2, then P(A|B) is:", options: ["1/3", "2/3", "1/2", "1/4"], answer: "2/3" } ], assertion: [ { statement1: "The probability of an event can never be negative.", statement2: "The probability of a sure event is 1.", options: ["Both true", "Both false", "Only statement 1 is true", "Only statement 2 is true"], answer: "Both true" }, { statement1: "If A and B are independent events, then P(A )" B) = P(A) + P(B).", statement2: "If A and B are mutually exclusive, then P(A *" B) = P(A) + P(B).", options: ["Both true", "Both false", "Only statement 1 is true", "Only statement 2 is true"], answer: "Only statement 2 is true" } ], twoMark: [ "A die is thrown twice. What is the probability that the sum of the numbers appearing is 8?", "A card is drawn at random from a well-shuffled deck of 52 cards. Find the probability that it is neither a heart nor a king.", "If P(A) = 0.6, P(B) = 0.5 and P(A *" B) = 0.8, find P(A )" B).", "A coin is tossed three times. Find the probability of getting at least two tails." ], threeMark: [ "A box contains 10 red marbles, 20 blue marbles and 30 green marbles. If one marble is drawn at random from the box, what is the probability that it will be (i) red (ii) blue (iii) not green?", "In a lottery, a person chooses 6 different numbers from 1 to 20. If these numbers match with the numbers fixed by the lottery committee, he wins the prize. What is the probability of winning the prize?", "The probability that a student will pass in Mathematics is 3/5 and the probability that he will pass in English is 1/3. If the probability that he will pass in both subjects is 1/8, what is the probability that he will pass in at least one subject?" ], fiveMark: [ "A bag contains 5 red and 3 black balls. Another bag contains 4 red and 5 black balls. One ball is transferred from the first bag to the second bag and then a ball is drawn from the second bag. Find the probability that the ball drawn is red.", "In a class of 60 students, 30 opted for NCC, 32 opted for NSS and 24 opted for both NCC and NSS. If one of these students is selected at random, find the probability that (i) the student opted for NCC or NSS (ii) the student has opted for neither NCC nor NSS (iii) the student has opted for NSS but not NCC.", "Three letters are written to three different persons and addresses on three envelopes are also written. Without looking at the addresses, the letters are kept in these envelopes. What is the probability that (i) all letters go to correct envelopes (ii) no letter goes to correct envelope (iii) exactly one letter goes to correct envelope?" ], caseStudy: [ { case: "In a survey of 100 students, it was found that 50 students play cricket, 40 play football and 10 play both cricket and football. Based on this information, answer the following questions:", questions: ["What is the probability that a randomly selected student plays cricket or football?", "What is the probability that a student plays neither cricket nor football?", "If a student plays football, what is the probability that he also plays cricket?"] } ] } } }; function getRandomQuestions(selectedChapters, type, count) { let allQuestions = []; if (selectedChapters.includes("Full Paper")) { for (let chapter in questions.mathematics) { if (questions.mathematics[chapter][type]) { allQuestions = allQuestions.concat(questions.mathematics[chapter][type]); } } } else { selectedChapters.forEach(chapter => { if (questions.mathematics[chapter] && questions.mathematics[chapter][type]) { allQuestions = allQuestions.concat(questions.mathematics[chapter][type]); } }); } allQuestions = allQuestions.sort(() => Math.random() - 0.5); return allQuestions.slice(0, count); } function showChapterSelection() { document.getElementById('startScreen').classList.add('hidden'); document.getElementById('chapterSelection').classList.remove('hidden'); } function toggleChapters() { const fullPaperCheckbox = document.getElementById('fullPaper'); const checkboxes = document.querySelectorAll('input[name="chapter"]:not(#fullPaper)'); checkboxes.forEach(cb => cb.disabled = fullPaperCheckbox.checked); } function backToStart() { document.getElementById('generatedPaperContainer').classList.add('hidden'); document.getElementById('startContainer').classList.remove('hidden'); document.getElementById('chapterSelection').classList.add('hidden'); document.getElementById('startScreen').classList.remove('hidden'); questionCounter = 1; } function promptSchoolName() { schoolName = prompt("Write your school/institute name").toUpperCase(); if (!schoolName) { alert("School/Institute name is required!"); } else { promptSession(); } } function promptSession() { sessionYear = prompt("Enter the academic session (e.g., 2023-24)").toUpperCase(); if (!sessionYear) { alert("Academic session is required!"); } else { generatePaper(); } } function generatePaper() { document.getElementById('startContainer').classList.add('hidden'); const generatedPaperContainer = document.getElementById('generatedPaperContainer'); generatedPaperContainer.classList.remove('hidden'); generatedPaperContainer.innerHTML = ''; let paperContent = ` <div class="header"> <h2>${schoolName}</h2> </div> <div class="content-area"> <div class="paper-header"> <h3>MATHEMATICS-041</h3> <h3>CLASS - XI</h3> <h3>Session: ${sessionYear}</h3> </div> <div class="paper-meta"> <div>Max. Marks: 80</div> <div>Time Allowed: 3 hours</div> </div> <div class="instructions"> <p><strong>General Instructions:</strong></p> <p>Read the following instructions carefully and follow them:</p> <ol> <li>This Question paper contains 38 questions. All questions are compulsory.</li> <li>This Question paper is divided into five Sections - A, B, C, D and E.</li> <li>In Section A, Questions no. 1 to 18 are multiple choice questions (MCQs) and Questions no. 19 and 20 are Assertion-Reason based questions of 1 mark each.</li> <li>In Section B, Questions no. 21 to 25 are Very Short Answer (VSA)-type questions, carrying 2 marks each.</li> <li>In Section C, Questions no. 26 to 31 are Short Answer (SA)-type questions, carrying 3 marks each.</li> <li>In Section D, Questions no. 32 to 35 are Long Answer (LA)-type questions, carrying 5 marks each.</li> <li>In Section E, Questions no. 36 to 38 are Case study-based questions, carrying 4 marks each.</li> <li>There is no overall choice. However, an internal choice has been provided in 2 questions in Section B, 3 questions in Section C, 2 questions in Section D and one subpart each in 2 questions of Section E.</li> <li>Use of calculators is not allowed.</li> </ol> </div> `; const selectedChapters = document.getElementById('fullPaper').checked ? ["Full Paper"] : Array.from(document.querySelectorAll('input[name="chapter"]:checked')).map(cb => cb.value); // Section A - MCQs const mcqs = getRandomQuestions(selectedChapters, 'mcq', 18); paperContent += ` <div class="question-section"> <h4 class="section-heading">Section A - Multiple Choice Questions (1 mark each)</h4> <p>Question 1 to 18 are multiple choice questions. Only one of the choices is correct. Select and write the correct choice as well as the answer to these questions.</p> `; mcqs.forEach((q, i) => { paperContent += ` <div class="question"> <p class="question-text">${questionCounter++}. ${q.question}</p> ${q.options.map((opt, j) => `<p class="option">${String.fromCharCode(65 + j)}. ${opt}</p>` ).join('')} </div> `; }); // Section A - Assertion Reasoning const assertions = getRandomQuestions(selectedChapters, 'assertion', 2); paperContent += ` <h4 class="section-heading" style="margin-top: 30px;">Section A - Assertion Reasoning Questions (1 mark each)</h4> <p>Question No. 19 to 20 consist of two statements  Assertion (A) and Reason (R). Answer these questions by selecting the appropriate option given below:</p> `; assertions.forEach((q, i) => { paperContent += ` <div class="question"> <p class="question-text">${questionCounter++}. Assertion: ${q.statement1}</p> <p class="option">Reason: ${q.statement2}</p> ${q.options.map((opt, j) => `<p class="option">${String.fromCharCode(65 + j)}. ${opt}</p>` ).join('')} </div> `; }); // Section B - 2 marks const twoMarks = getRandomQuestions(selectedChapters, 'twoMark', 5); paperContent += ` </div> <div class="question-section"> <h4 class="section-heading">Section B - Very Short Answer Questions (2 marks each)</h4> <p>Question No. 21 to 25 are very short answer questions</p> `; twoMarks.forEach(q => { paperContent += ` <div class="question"> <p class="question-text">${questionCounter++}. ${q}</p> </div> `; }); // Section C - 3 marks const threeMarks = getRandomQuestions(selectedChapters, 'threeMark', 6); paperContent += ` </div> <div class="question-section"> <h4 class="section-heading">Section C - Short Answer Questions (3 marks each)</h4> <p>Question No. 26 to 31 are short answer questions</p> `; threeMarks.forEach(q => { paperContent += ` <div class="question"> <p class="question-text">${questionCounter++}. ${q}</p> </div> `; }); // Section D - 5 marks const fiveMarks = getRandomQuestions(selectedChapters, 'fiveMark', 4); paperContent += ` </div> <div class="question-section"> <h4 class="section-heading">Section D - Long Answer Questions (5 marks each)</h4> <p>Question No. 32 to 35 are long answer questions</p> `; fiveMarks.forEach(q => { paperContent += ` <div class="question"> <p class="question-text">${questionCounter++}. ${q}</p> </div> `; }); // Section E - Case Studies const caseStudies = getRandomQuestions(selectedChapters, 'caseStudy', 3); paperContent += ` </div> <div class="question-section"> <h4 class="section-heading">Section E - Case Study Based Questions (4 marks each)</h4> <p>Question No. 36 to 38 are case-based/data-based questions.</p> `; caseStudies.forEach(cs => { paperContent += ` <div class="question"> <p class="question-text">${questionCounter++}. ${cs.case}</p> ${cs.questions.map((subQ, j) => `<p class="option">${j + 1}. ${subQ}</p>` ).join('')} </div> `; }); // Add buttons below the generated paper paperContent += ` </div> <div class="action-buttons"> <button class="btn btn-primary" onclick="downloadPDF()">Download as PDF</button> <button class="btn btn-success" onclick="window.print()">Print</button> <button class="btn btn-danger" onclick="backToStart()">Back to Start</button> </div> </div> `; generatedPaperContainer.innerHTML = paperContent; } async function downloadPDF() { const element = document.getElementById('generatedPaperContainer'); // Create a temporary div with optimized settings const tempDiv = document.createElement('div'); tempDiv.style.position = 'absolute'; tempDiv.style.left = '-9999px'; tempDiv.style.width = '794px'; // A4 width in pXels (210mm) tempDiv.style.backgroundColor = 'white'; tempDiv.style.padding = '20px'; tempDiv.innerHTML = element.innerHTML; document.body.appendChild(tempDiv); try { const pdf = new jsPDF('p', 'mm', 'a4'); const pageWidth = pdf.internal.pageSize.getWidth() - 25.4; // 0.5" margins const pageHeight = pdf.internal.pageSize.getHeight() - 25.4; // Split content into pages let position = 12.7; // Start with 0.5" top margin let remainingHeight = tempDiv.scrollHeight; let pageNum = 1; while (remainingHeight > 0) { // Capture the current page section const canvas = await html2canvas(tempDiv, { scale: 2, windowHeight: pageHeight * 3.78, // mm to px windowWidth: pageWidth * 3.78, y: position * 3.78, // mm to px height: pageHeight * 3.78, useCORS: true, backgroundColor: '#ffffff', logging: false }); const imgData = canvas.toDataURL('image/jpeg', 0.92); // Add page to PDF if (pageNum > 1) { pdf.addPage('a4', 'portrait'); } pdf.addImage(imgData, 'JPEG', 12.7, 12.7, pageWidth, canvas.height * pageWidth / canvas.width); position += pageHeight; remainingHeight -= pageHeight * 3.78; // px pageNum++; } document.body.removeChild(tempDiv); pdf.save(`${schoolName}_Mathematics_Paper.pdf`); } catch (error) { console.error('PDF generation error:', error); alert('Error generating PDF. Please try again.'); document.body.removeChild(tempDiv); } } </script> </body> </html>