9th Chemistry Ch-9 Paper Generator - BISE Sahiwal /* --- 1. RESET & BASICS --- */ * { box-sizing: border-box; } html, body { margin: 0; padding: 0; background-color: #525659; /* Grey background for screen */ font-family: 'Times New Roman', serif; -webkit-print-color-adjust: exact; } /* --- 2. CONTROL PANEL --- */ #ui-controls { background: white; padding: 25px; max-width: 900px; margin: 20px auto; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); border-top: 5px solid #28a745; } .control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; text-align: left; } .input-group label { display: block; font-weight: bold; margin-bottom: 8px; color: #333; } .input-group input, .input-group select { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 14px; } .btn-container { display: flex; gap: 15px; } .btn { flex: 1; background-color: #28a745; color: white; border: none; padding: 12px; font-size: 16px; border-radius: 5px; cursor: pointer; font-weight: bold; transition: 0.3s; } .btn:hover { background-color: #218838; } .btn-dl { background-color: #007bff; } .btn-dl:hover { background-color: #0069d9; } /* --- 3. PAPER PREVIEW (Screen Mode) --- */ #paper-preview { width: 210mm; min-height: 297mm; margin: 0 auto 50px auto; background: white; padding: 10mm 12mm; /* Reduced top padding slightly */ box-shadow: 0 0 20px rgba(0,0,0,0.5); position: relative; height: auto; } /* --- 4. PRINTING MODE (Fix for Blank Page) --- */ /* These styles apply when the 'printing-mode' class is added */ body.printing-mode { background: white; } body.printing-mode #ui-controls { display: none !important; } body.printing-mode #paper-preview { margin: 0 !important; box-shadow: none !important; width: 100% !important; min-height: auto !important; padding: 0 !important; /* Let PDF margins handle padding */ } /* --- 5. TYPOGRAPHY & URDU --- */ .urdu-text { font-family: 'Noto Nastaliq Urdu', serif; direction: rtl; display: inline-block; font-size: 14px; line-height: 1.6; margin-left: 10px; vertical-align: middle; } /* --- 6. PAPER LAYOUT ELEMENTS --- */ .header-sec { text-align: center; border-bottom: 2px solid #000; padding-bottom: 5px; margin-bottom: 10px; margin-top: 0; /* Important for first page */ } .bise-title { font-size: 22px; font-weight: 900; text-transform: uppercase; margin: 0; letter-spacing: 1px; } .sub-title { font-size: 16px; font-weight: bold; margin: 5px 0; } .meta-table { width: 100%; border-collapse: collapse; margin-top: 5px; border-top: 1px solid #000; } .meta-table td { padding: 4px 0; font-weight: bold; font-size: 14px; vertical-align: bottom; } .roll-no-box { border-bottom: 1px dotted #000; display: inline-block; width: 150px; } .section-header { background-color: #000; color: #fff; padding: 4px 10px; font-weight: bold; font-size: 15px; margin: 10px 0 8px 0; display: flex; justify-content: space-between; align-items: center; -webkit-print-color-adjust: exact; } .mcq-container { column-count: 2; column-gap: 15px; } .mcq-box { break-inside: avoid; margin-bottom: 8px; border-bottom: 1px dashed #ccc; padding-bottom: 4px; font-size: 13px; } .mcq-q { font-weight: bold; display: flex; justify-content: space-between; align-items: baseline; } .mcq-opts { display: flex; flex-wrap: wrap; justify-content: space-between; margin-top: 3px; font-size: 12px; } .mcq-opt { width: 48%; } .sub-heading { font-weight: bold; text-decoration: underline; font-size: 15px; margin: 15px 0 5px 0; } .short-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .short-item { border: 1px solid #ddd; padding: 4px 6px; font-size: 13px; background: #fdfdfd; break-inside: avoid; } .long-item { margin-bottom: 12px; border-bottom: 1px solid #000; padding-bottom: 8px; break-inside: avoid; } /* --- 7. NATIVE PRINT --- */ @media print { body { background: white; margin: 0; } #ui-controls { display: none; } #paper-preview { margin: 0; box-shadow: none; width: 100%; padding: 0; } } ⚗️ 9th Chemistry Paper Generator (Chapter 9) Syllabus: New Curriculum 2025-26 (Group Properties & Elements) Institute Name / Title: Paper Type: Full Paper (Obj + Subj) Objective Only (12 Marks) Subjective Only (48 Marks) 🔄 Generate New Paper 📄 Download PDF // ============================================ // 1. DATABASE (Chapter 9: Group Properties and Elements) // ============================================ const db_mcqs = [ { q: "Which element is the most abundant in Earth's crust?", u: "زمین کی سطح میں کون سا عنصر سب سے زیادہ پایا جاتا ہے؟", o: ["Silicon", "Oxygen", "Aluminium", "Iron"], k: "B" }, { q: "Which non-metal is lustrous?", u: "کون سی نان میٹل چمکدار ہوتی ہے؟", o: ["Sulphur", "Phosphorus", "Iodine", "Carbon"], k: "C" }, { q: "Which halogen is a liquid at room temperature?", u: "کون سا ہیلوجن کمرے کے درجہ حرارت پر مائع ہے؟", o: ["Fluorine", "Chlorine", "Bromine", "Iodine"], k: "C" }, { q: "Sodium metal is stored in:", u: "سوڈیم میٹل کو محفوظ کیا جاتا ہے:", o: ["Water", "Alcohol", "Kerosene Oil", "Vinegar"], k: "C" }, { q: "The general valence shell configuration of alkali metals is:", u: "الکلی میٹلز کی ویلنس شیل کنفیگریشن کیا ہے؟", o: ["ns1", "ns2", "np5", "np6"], k: "A" }, { q: "Which Group 17 element is the most reactive?", u: "گروپ 17 کا کون سا عنصر سب سے زیادہ ری ایکٹو ہے؟", o: ["Fluorine", "Chlorine", "Bromine", "Iodine"], k: "A" }, { q: "Which form of Carbon is used as a lubricant?", u: "کاربن کی کون سی شکل لیوبریکنٹ کے طور پر استعمال ہوتی ہے؟", o: ["Diamond", "Graphite", "Coal", "Coke"], k: "B" }, { q: "The color of Chlorine gas is:", u: "کلورین گیس کا رنگ ہے:", o: ["Pale Yellow", "Greenish Yellow", "Reddish Brown", "Purple"], k: "B" }, { q: "Magnesium belongs to which group?", u: "میگنیشیم کا تعلق کس گروپ سے ہے؟", o: ["Alkali Metals", "Alkaline Earth Metals", "Halogens", "Noble Gases"], k: "B" }, { q: "Which gas is used in advertising neon signs?", u: "اشتہاری نیون سائنز میں کون سی گیس استعمال ہوتی ہے؟", o: ["Helium", "Neon", "Argon", "Radon"], k: "B" }, { q: "The atomic number of Sodium is:", u: "سوڈیم کا ایٹمی نمبر ہے:", o: ["11", "12", "19", "20"], k: "A" }, { q: "Which element forms a basic oxide?", u: "کون سا عنصر بنیادی آکسائیڈ بناتا ہے؟", o: ["Sulphur", "Carbon", "Sodium", "Chlorine"], k: "C" }, { q: "Hydrogen Fluoride (HF) is a weak acid due to:", u: "ہائیڈروجن فلورائیڈ (HF) کس وجہ سے کمزور تیزاب ہے؟", o: ["Ionic bond", "Strong Hydrogen Bonding", "Covalent bond", "Van der Waals forces"], k: "B" }, { q: "Down the group, the reactivity of alkali metals:", u: "گروپ میں نیچے جاتے ہوئے الکلی میٹلز کی ری ایکٹیوٹی:", o: ["Increases", "Decreases", "Remains same", "None"], k: "A" }, { q: "Which halogen exists as a solid?", u: "کون سا ہیلوجن ٹھوس حالت میں پایا جاتا ہے؟", o: ["Chlorine", "Fluorine", "Bromine", "Iodine"], k: "D" }, { q: "The oxidation state of Group 2 elements is:", u: "گروپ 2 کے عناصر کی آکسیڈیشن سٹیٹ ہے:", o: ["+1", "+2", "+3", "-1"], k: "B" } ]; const db_shorts = [ { q: "Why are alkali metals kept in kerosene oil?", u: "الکلی میٹلز کو مٹی کے تیل میں کیوں رکھا جاتا ہے؟" }, { q: "Write two uses of Sodium.", u: "سوڈیم کے دو استعمال لکھیں۔" }, { q: "Why is HF a weak acid?", u: "HF ایک کمزور تیزاب کیوں ہے؟" }, { q: "Define Electropositivity.", u: "الیکٹروپوزیٹیوٹی کی تعریف کریں۔" }, { q: "Why is Magnesium harder than Sodium?", u: "میگنیشیم سوڈیم سے زیادہ سخت کیوں ہے؟" }, { q: "Write two uses of Calcium.", u: "کیلشیم کے دو استعمال لکھیں۔" }, { q: "Why are Noble gases non-reactive?", u: "نوبل گیسیں غیر عامل کیوں ہوتی ہیں؟" }, { q: "What is the trend of Ionization Energy in Group 1?", u: "گروپ 1 میں آئونائزیشن انرجی کا رجحان کیا ہے؟" }, { q: "Differentiate between Alkali and Alkaline Earth Metals.", u: "الکلی اور الکلائن ارتھ میٹلز میں فرق بیان کریں۔" }, { q: "Why does the melting point of halogens increase down the group?", u: "ہیلوجنز کے پگھلاؤ کا درجہ نیچے کی طرف کیوں بڑھتا ہے؟" }, { q: "State the physical states of F, Cl, Br, and I.", u: "F, Cl, Br اور I کی طبعی حالتیں بیان کریں۔" }, { q: "How does Sodium react with water? Write equation.", u: "سوڈیم پانی کے ساتھ کیسے ری ایکشن کرتا ہے؟ مساوات لکھیں۔" }, { q: "Why is Iodine a solid while Chlorine is a gas?", u: "آیوڈین ٹھوس جبکہ کلورین گیس کیوں ہے؟" }, { q: "Write the electronic configuration of Neon.", u: "نیون کی الیکٹرانک کنفیگریشن لکھیں۔" }, { q: "What happens when Magnesium is burnt in air?", u: "جب میگنیشیم کو ہوا میں جلایا جاتا ہے تو کیا ہوتا ہے؟" }, { q: "Write two uses of Noble Gases.", u: "نوبل گیسوں کے دو استعمالات لکھیں۔" }, { q: "Why is Fluorine the most reactive non-metal?", u: "فلورین سب سے زیادہ ری ایکٹو نان میٹل کیوں ہے؟" }, { q: "Define Group Trends.", u: "گروپ ٹرینڈز کی تعریف کریں۔" }, { q: "Why do alkali metals form +1 ions?", u: "الکلی میٹلز +1 آئن کیوں بناتی ہیں؟" }, { q: "What is 'Lustre'? Name a lustrous non-metal.", u: "'چمک' کیا ہے؟ ایک چمکدار نان میٹل کا نام لکھیں۔" } ]; const db_longs = [ { q: "Explain the trends in physical properties (Atomic size, Ionization energy) of Group 1 elements.", u: "گروپ 1 کے عناصر کی طبعی خصوصیات (ایٹمی سائز، آئونائزیشن انرجی) کے رجحانات بیان کریں۔", marks: 5 }, { q: "Discuss the reaction of Halogens with Hydrogen and Water with chemical equations.", u: "ہیلوجنز کا ہائیڈروجن اور پانی کے ساتھ ری ایکشن تفصیل سے بیان کریں۔", marks: 5 }, { q: "Compare the chemical properties of Alkali Metals and Alkaline Earth Metals.", u: "الکلی میٹلز اور الکلائن ارتھ میٹلز کی کیمیائی خصوصیات کا موازنہ کریں۔", marks: 5 }, { q: "Write a detailed note on the significance and uses of Noble Gases.", u: "نوبل گیسوں کی اہمیت اور استعمالات پر تفصیلی نوٹ لکھیں۔", marks: 4 }, { q: "Explain the electropositive character of metals with examples.", u: "میٹلز کے الیکٹروپوزیٹو کردار کی مثالوں کے ساتھ وضاحت کریں۔", marks: 5 }, { q: "Describe the reaction of Sodium and Magnesium with Oxygen and Water.", u: "سوڈیم اور میگنیشیم کا آکسیجن اور پانی کے ساتھ ری ایکشن بیان کریں۔", marks: 4 } ]; // ============================================ // 2. LOGIC FUNCTIONS // ============================================ function shuffle(array) { let currentIndex = array.length, randomIndex; while (currentIndex != 0) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex--; [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]]; } return array; } function getDualText(eng, urdu) { if (!urdu || eng.trim() == urdu.trim()) return `${eng}`; return `${eng} ${urdu}`; } function generatePaper() { const preview = document.getElementById('paper-preview'); const instName = document.getElementById('instName').value; const pType = document.getElementById('paperType').value; // --- PREPARE DATA --- // 1. MCQs const mcqs = shuffle([...db_mcqs]).slice(0, 12); // 2. Shorts let shortsPool = shuffle([...db_shorts]); // Ensure enough questions while(shortsPool.length < 24) { shortsPool = shortsPool.concat(db_shorts); } const q2 = shortsPool.slice(0, 8); const q3 = shortsPool.slice(8, 16); const q4 = shortsPool.slice(16, 24); // 3. Longs let longsPool = shuffle([...db_longs]); const longQs = [ { a: longsPool[0], b: longsPool[1] }, { a: longsPool[2], b: longsPool[3] } ]; // --- MARKS & TIME --- let timeAllowed = "2:10 Hours"; let totalMarks = "60"; if(pType === 'obj') { timeAllowed = "15 Mins"; totalMarks = "12"; } if(pType === 'subj') { timeAllowed = "1:55 Hours"; totalMarks = "48"; } // --- BUILD HTML --- let html = ` ${instName} CHEMISTRY - 9th Class (Ch-9: Group Properties & Elements) Time Allowed: ${timeAllowed} Total Marks: ${totalMarks} Name: ______________________ Roll No: `; // --- PART I: OBJECTIVE --- if (pType === 'full' || pType === 'obj') { html += ` PART - I (Objective) Marks: 12 Q.1: Choose the correct answer. (12 x 1 = 12) ${mcqs.map((m, i) => ` ${i+1}. ${m.q} ${m.u} (A) ${getDualText(m.o[0], m.o[0])} (B) ${getDualText(m.o[1], m.o[1])} (C) ${getDualText(m.o[2], m.o[2])} (D) ${getDualText(m.o[3], m.o[3])} `).join('')} `; } // --- PART II: SUBJECTIVE --- if (pType === 'full' || pType === 'subj') { if(pType === 'full') html += ``; html += ` PART - II (Subjective) Marks: 48 SECTION - I Note: Attempt any FIVE parts from each question. (5 x 2 = 10 each) ${renderShortBlock(2, q2)} ${renderShortBlock(3, q3)} ${renderShortBlock(4, q4)} SECTION - II Note: Attempt any TWO questions. (9 x 2 = 18) ${longQs.map((q, i) => ` Q.${5+i} (a): ${q.a.q} (${q.a.marks}) ${q.a.u} (b): ${q.b.q} (${q.b.marks}) ${q.b.u} `).join('')} `; } preview.innerHTML = html; } function renderShortBlock(qNum, questions) { return ` Q.${qNum}: ${questions.map((q, i) => ` (${i+1}) ${q.q} ${q.u} `).join('')} `; } function downloadPDF() { const element = document.getElementById('paper-preview'); // Add printing mode class to Body (removes UI, resets margins) document.body.classList.add('printing-mode'); // Delay slighty to ensure layout recalculation setTimeout(() => { const opt = { margin: [10, 10, 10, 10], filename: 'Chemistry-9th-Ch9-Paper.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2, useCORS: true, scrollY: 0 }, jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }, pagebreak: { mode: ['avoid-all', 'css', 'legacy'] } }; html2pdf().from(element).set(opt).save().then(() => { // Remove printing mode after save document.body.classList.remove('printing-mode'); }); }, 100); } // Initialize on load window.onload = generatePaper;