ÿþ<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Class VIII Social Science Assignment Generator</title> <meta name="description" content="Create chapter-wise Class 8 Social Science assignments online with Routera.in. Generate homework, practice questions, and CBSE SST exercises easily."> <meta name="keywords" content="Class 8 Social Science assignment generator,CBSE Class 8 SST assignment maker,Class 8 SST chapter-wise assignment generator,Online Social Science assignment creator for Class 8,CBSE Class 8 Social Science homework generator,Create Class 8 Social Science assignments online,Class 8 Social Science assignment generator for all chapters,Chapter-wise CBSE Class 8 Social Science assignment creator,Free Class 8 SST assignment generator online,CBSE Class 8 Social Science practice question generator,Customizable Class 8 SST assignments,Generate Social Science exercises for Class 8,CBSE Class 8 Social Science homework maker,Chapter-wise question paper generator for Class 8 Social Science,Interactive Class 8 Social Science assignment creator,Class 8 Social Science MCQ and short answer generator,Online CBSE Class 8 SST practice paper maker,Class 8 Social Science exercise generator,CBSE Class 8 assignment tool,Chapter-wise homework and assignment maker Class 8,Free downloadable Class 8 Social Science assignments,CBSE exam preparation assignment generator for Class 8,Social Science question paper creator for Class 8,Class 8 SST assignment PDF generator"> <meta name="robots" content="index, follow"> <meta name="author" content="Routera.in"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Open Graph Tags --> <meta property="og:site_name" content="routera.in"> <meta property="og:title" content="Class VIII Social Science Assignment Generator"> <meta property="og:description" content="Create chapter-wise Class 8 Social Science assignments online with Routera.in. Generate homework, practice questions, and CBSE SST exercises easily."> <meta property="og:image" content="https://www.routera.in/img/cat-2.png"> <!-- Replace with actual image URL --> <meta property="og:image:width" content="600" /> <meta property="og:image:height" content="400" /> <meta property="og:url" content="https://routera.in/cbse-class-8-Social-Science-assignment-generator.html"> <meta property="og:type" content="website"> <!-- Twitter Card Tags --> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:title" content="Class VIII Social Science Assignment Generator"> <meta name="twitter:description" content="Create chapter-wise Class 8 Social Science assignments online with Routera.in. Generate homework, practice questions, and CBSE SST exercises easily."> <meta name="twitter:image" content="https://www.routera.in/img/cat-2.png"> <!-- Replace with actual image URL --> <!-- Canonical Tag --> <link rel="canonical" href="https://routera.in/cbse-class-8-Social-Science-assignment-generator.html" /> <script type="application/ld+json"> { "@context": "https://schema.org", "@graph": [ { "@type": "WebPage", "name": "Class 8 Social Science Assignment Generator  CBSE SST", "url": "https://routera.in/cbse-class-8-Social-Science-assignment-generator.html", "description": "Generate chapter-wise Class 8 Social Science assignments online with Routera.in. Create MCQs, short-answer, and long-answer questions for CBSE SST.", "inLanguage": "en", "publisher": { "@type": "Organization", "name": "Routera.in", "logo": {"@type": "ImageObject","url": "https://www.routera.in/img/logo1.jpg"} } }, { "@type": "WebSite", "name": "Routera.in", "url": "https://routera.in", "potentialAction": { "@type": "SearchAction", "target": "https://routera.in/search?q={search_term_string}", "query-input": "required name=search_term_string" } }, { "@type": "Organization", "name": "Routera.in", "url": "https://routera.in", "logo": "https://www.routera.in/img/logo1.jpg", "sameAs": [ "https://www.facebook.com/routera.in", "https://twitter.com/routera_in", "https://www.linkedin.com/company/routera-in/" ] }, { "@type": "EducationalOrganization", "name": "Routera.in", "url": "https://routera.in", "logo": "https://www.routera.in/img/logo1.jpg", "contactPoint": { "@type": "ContactPoint", "telephone": "+91-9935197386", "contactType": "Customer Support", "areaServed": "IN" } }, { "@type": "Review", "itemReviewed": {"@type": "WebPage","name": "Class 8 Social Science Assignment Generator"}, "reviewRating": {"@type": "Rating","ratingValue": "4.9","bestRating": "5"}, "author": {"@type": "Person","name": "Routera Editorial Team"}, "reviewBody": "Create chapter-wise CBSE Class 8 Social Science assignments with MCQs, short-answer, and long-answer exercises instantly using the online generator." }, { "@type": "BreadcrumbList", "itemListElement": [ {"@type": "ListItem","position": 1,"name": "Home","item": "https://routera.in"}, {"@type": "ListItem","position": 2,"name": "CBSE Class 8","item": "https://routera.in/cbse-class-8-study-material.html"}, {"@type": "ListItem","position": 3,"name": "Class 8 Social Science Assignment Generator","item": "https://routera.in/cbse-class-8-Social-Science-assignment-generator.html"} ] }, { "@type": "Article", "headline": "Class 8 Social Science Assignment Generator  CBSE SST", "author": {"@type": "Organization","name": "Routera.in"}, "publisher": {"@type": "Organization","name": "Routera.in","logo": {"@type": "ImageObject","url": "https://www.routera.in/img/logo1.jpg"}}, "datePublished": "2025-10-01", "dateModified": "2025-10-01", "mainEntityOfPage": "https://routera.in/cbse-class-8-Social-Science-assignment-generator.html", "description": "Generate chapter-wise CBSE Class 8 Social Science assignments with MCQs, short-answer, and long-answer questions online for homework and practice." }, { "@type": "FAQPage", "mainEntity": [ {"@type": "Question","name": "What is the Class 8 Social Science assignment generator?","acceptedAnswer":{"@type": "Answer","text": "It is an online tool to create chapter-wise CBSE Class 8 Social Science assignments instantly."}}, {"@type": "Question","name": "Is the assignment generator free?","acceptedAnswer":{"@type": "Answer","text": "Yes, the tool is completely free to use online."}}, {"@type": "Question","name": "Which chapters are included?","acceptedAnswer":{"@type": "Answer","text": "All chapters of Class 8 SST book 'Exploring Society: India and Beyond' are included."}}, {"@type": "Question","name": "What question types can be generated?","acceptedAnswer":{"@type": "Answer","text": "MCQs, short-answer, and long-answer questions can be generated."}}, {"@type": "Question","name": "Can assignments be downloaded?","acceptedAnswer":{"@type": "Answer","text": "Yes, assignments can be downloaded as PDFs or printed directly."}}, {"@type": "Question","name": "Is it CBSE syllabus-aligned?","acceptedAnswer":{"@type": "Answer","text": "Yes, all assignments follow the CBSE Class 8 Social Science syllabus."}}, {"@type": "Question","name": "Can teachers use this generator?","acceptedAnswer":{"@type": "Answer","text": "Yes, teachers can generate multiple assignments for classroom use."}}, {"@type": "Question","name": "Does it provide sample answers?","acceptedAnswer":{"@type": "Answer","text": "Yes, suggested answers are provided with assignments."}}, {"@type": "Question","name": "Can I customize the number of questions?","acceptedAnswer":{"@type": "Answer","text": "Yes, the number and type of questions can be customized."}}, {"@type": "Question","name": "Is it mobile-friendly?","acceptedAnswer":{"@type": "Answer","text": "Yes, it works on desktop, tablet, and mobile devices."}} ] }, { "@type": "HowTo", "name": "How to Use Class 8 Social Science Assignment Generator", "step": [ {"@type": "HowToStep","text": "Visit Routera.in and open the Class 8 Social Science Assignment Generator page."}, {"@type": "HowToStep","text": "Select the chapter for which you want to generate an assignment."}, {"@type": "HowToStep","text": "Choose the question type and number of questions."}, {"@type": "HowToStep","text": "Click 'Generate Assignment' to create the assignment instantly."}, {"@type": "HowToStep","text": "Download the assignment in PDF format or print it directly."} ] }, { "@type": "Product", "name": "Class 8 Social Science Assignment Generator", "image": "https://www.routera.in/img/cat-2.png", "description": "Online generator to create chapter-wise CBSE Class 8 Social Science assignments with MCQs, short-answer, and long-answer questions.", "brand": "Routera.in", "offers": {"@type": "Offer","url": "https://routera.in/cbse-class-8-Social-Science-assignment-generator.html","priceCurrency": "INR","price": "0","availability": "https://schema.org/InStock"} }, { "@type": "Course", "name": "Class 8 Social Science Assignment Creation", "description": "Generate chapter-wise assignments, exercises, and practice questions for Class 8 Social Science using the online assignment generator.", "provider": {"@type": "EducationalOrganization","name": "Routera.in","sameAs": "https://routera.in"} }, { "@type": "ItemList", "itemListElement": [ {"@type": "ListItem","position": 1,"name": "Natural Resources and Their Use"}, {"@type": "ListItem","position": 2,"name": "Reshaping India s Political Map"}, {"@type": "ListItem","position": 3,"name": "The Rise of the Marathas"}, {"@type": "ListItem","position": 4,"name": "The Colonial Era in India"}, {"@type": "ListItem","position": 5,"name": "Universal Franchise and India s Electoral System"}, {"@type": "ListItem","position": 6,"name": "Parliamentary System: Legislature and Executive"}, {"@type": "ListItem","position": 7,"name": "Factors of Production"} ] }, { "@type": "EducationalOccupationalProgram", "educationalProgramMode": "online", "name": "Class 8 Social Science Assignment Program", "provider": {"@type": "EducationalOrganization","name": "Routera.in","sameAs": "https://routera.in"}, "programPrerequisites": "Knowledge of Class 7 Social Science", "hasCourse": {"@type": "Course","name": "Class 8 Social Science Assignment Generator","description": "Create chapter-wise CBSE Class 8 Social Science assignments online for homework and exam practice."} } ] } </script> <!-- 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> /* All CSS styles remain the same as before */ :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; width: 794px; /* A4 width in pixels (210mm) */ background-color: white; color: black; } /* 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"> <!-- Home icon added here --> <a href="cbse-class-6-to-8-assignment-generator.html" class="home-icon"> <i class="fas fa-home"></i> </a> <h1>Class VIII Social Science</h1> <p>Generate Customized Assignments</p> </div> <div class="content-area"> <div id="startScreen"> <h2 class="section-title">Social Science Assignment Generator</h2> <div class="btn-group"> <button class="btn btn-primary" id="startGeneratingBtn">Start Generating</button> </div> </div> <div id="subjectOptions" class="hidden"> <h2 class="section-title">Select Social Science Subject</h2> <div class="btn-group"> <button class="btn btn-primary" id="selectSocialScienceBtn">Social Science</button> </div> </div> <div id="chapterSelection" class="hidden"> <h2 class="section-title">Select Chapters</h2> <form id="chapterForm"> <div class="checkbox-container"> <div class="checkbox-item"> <input type="checkbox" id="fullPaper" name="chapter" value="Full Paper"> <label for="fullPaper">Full Syllabus (All Chapters)</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter1" name="chapter" value="Chapter 1"> <label for="chapter1">1. Natural Resources and Their Use</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter2" name="chapter" value="Chapter 2"> <label for="chapter2">2. Reshaping India's Political Map</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter3" name="chapter" value="Chapter 3"> <label for="chapter3">3. The Rise of the Marathas</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter4" name="chapter" value="Chapter 4"> <label for="chapter4">4. The Colonial Era in India</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter5" name="chapter" value="Chapter 5"> <label for="chapter5">5. Universal Franchise and India's Electoral System</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter6" name="chapter" value="Chapter 6"> <label for="chapter6">6. The Parliamentary System: Legislature and Executive</label> </div> <div class="checkbox-item"> <input type="checkbox" id="chapter7" name="chapter" value="Chapter 7"> <label for="chapter7">7. Factors of Production</label> </div> </div> </form> <div id="message" class="hidden"></div> <div class="btn-group"> <button class="btn btn-danger" id="backToStartBtn">Back to Start</button> <button class="btn btn-success" id="generateAssignmentBtn">Generate Assignment</button> </div> </div> </div> </div> <div class="container hidden" id="generatedPaperContainer"></div> <script> // Initialize jsPDF const { jsPDF } = window.jspdf; // DOM Elements const startContainer = document.getElementById('startContainer'); const startScreen = document.getElementById('startScreen'); const subjectOptions = document.getElementById('subjectOptions'); const chapterSelection = document.getElementById('chapterSelection'); const generatedPaperContainer = document.getElementById('generatedPaperContainer'); // Buttons const startGeneratingBtn = document.getElementById('startGeneratingBtn'); const selectSocialScienceBtn = document.getElementById('selectSocialScienceBtn'); const backToStartBtn = document.getElementById('backToStartBtn'); const generateAssignmentBtn = document.getElementById('generateAssignmentBtn'); const fullPaperCheckbox = document.getElementById('fullPaper'); const chapterCheckboxes = document.querySelectorAll('input[name="chapter"]:not(#fullPaper)'); // Event Listeners startGeneratingBtn.addEventListener('click', showSubjectOptions); selectSocialScienceBtn.addEventListener('click', showChapters); backToStartBtn.addEventListener('click', backToStart); generateAssignmentBtn.addEventListener('click', generateAssignment); fullPaperCheckbox.addEventListener('change', toggleChapters); const questions = { "Chapter 1": { mcq: [ { question: "Which of these is NOT a natural resource?", options: ["Coal", "Water", "Plastic", "Forests"], answer: "Plastic" }, { question: "What is the main use of mineral resources?", options: ["Agriculture", "Industrial production", "Transportation", "All of these"], answer: "All of these" }, { question: "Which resource is considered renewable?", options: ["Petroleum", "Natural gas", "Solar energy", "Coal"], answer: "Solar energy" } ], fillBlank: [ { question: "Resources that can be replenished naturally are called __________ resources.", answer: "renewable" }, { question: "The three R's of conservation are Reduce, Reuse, and __________.", answer: "Recycle" } ], trueFalse: [ { question: "Fossil fuels are renewable resources.", answer: "False" }, { question: "Water conservation is important even in areas with abundant rainfall.", answer: "True" } ], veryShort: [ "Name two non-renewable resources.", "What is the primary use of forest resources?" ], short: [ "Explain the difference between renewable and non-renewable resources with examples.", "Describe three ways to conserve water resources." ], long: [ "Discuss the importance of natural resource conservation for sustainable development.", "Explain how human activities are affecting natural resources and suggest measures to reduce the impact." ] }, "Chapter 2": { mcq: [ { question: "When was the States Reorganization Act passed?", options: ["1947", "1950", "1956", "1960"], answer: "1956" }, { question: "Which state was created in 2000?", options: ["Uttarakhand", "Jharkhand", "Chhattisgarh", "All of these"], answer: "All of these" }, { question: "What was the basis for reorganizing states in 1956?", options: ["Language", "Religion", "Economic factors", "Population"], answer: "Language" } ], fillBlank: [ { question: "The first linguistic state formed in India was __________.", answer: "Andhra Pradesh" }, { question: "The States Reorganization Commission was headed by __________.", answer: "Fazal Ali" } ], trueFalse: [ { question: "India had 14 states immediately after independence.", answer: "False" }, { question: "Goa was a Portuguese colony until 1961.", answer: "True" } ], veryShort: [ "Name two states created in 2000.", "What was the capital of Andhra Pradesh before bifurcation?" ], short: [ "Explain the significance of the States Reorganization Act of 1956.", "Describe the process of formation of Telangana state." ], long: [ "Discuss the factors that influenced the reorganization of states in India after independence.", "Analyze the advantages and disadvantages of creating smaller states in India." ] }, "Chapter 3": { mcq: [ { question: "Who was the founder of the Maratha empire?", options: ["Shivaji", "Shahu", "Balaji Vishwanath", "Baji Rao I"], answer: "Shivaji" }, { question: "What was the capital of Shivaji's kingdom?", options: ["Pune", "Raigad", "Satara", "Kolhapur"], answer: "Raigad" }, { question: "Which administrative system was introduced by Shivaji?", options: ["Ashtapradhan", "Mansabdari", "Zamindari", "Ryotwari"], answer: "Ashtapradhan" } ], fillBlank: [ { question: "Shivaji was coronated as king in the year __________.", answer: "1674" }, { question: "The Maratha navy was built to counter the __________ power.", answer: "Portuguese" } ], trueFalse: [ { question: "The Marathas defeated the British in the First Anglo-Maratha War.", answer: "True" }, { question: "Shivaji's administration was based on the Mughal model.", answer: "False" } ], veryShort: [ "Name two important forts of the Maratha empire.", "What was the title given to Shivaji after his coronation?" ], short: [ "Explain the guerrilla warfare tactics used by Shivaji.", "Describe the administrative system of the Maratha empire." ], long: [ "Discuss the factors that contributed to the rise of the Maratha power under Shivaji.", "Analyze the reasons for the decline of the Maratha empire in the 18th century." ] }, "Chapter 4": { mcq: [ { question: "Which European power came to India first?", options: ["Portuguese", "Dutch", "British", "French"], answer: "Portuguese" }, { question: "When did the Battle of Plassey take place?", options: ["1757", "1761", "1764", "1857"], answer: "1757" }, { question: "What was the main economic motive of British colonialism?", options: ["Spread Christianity", "Raw materials for industries", "Spread education", "Military expansion"], answer: "Raw materials for industries" } ], fillBlank: [ { question: "The first English factory was established at __________ in 1613.", answer: "Surat" }, { question: "The __________ system was introduced by Lord Cornwallis.", answer: "Permanent Settlement" } ], trueFalse: [ { question: "The British introduced railways for the benefit of Indians.", answer: "False" }, { question: "The Doctrine of Lapse was introduced by Lord Dalhousie.", answer: "True" } ], veryShort: [ "Name two social reformers of the colonial period.", "What was the main purpose of the Drain of Wealth theory?" ], short: [ "Explain the impact of British land revenue systems on Indian agriculture.", "Describe the educational policies introduced by the British in India." ], long: [ "Discuss the economic impact of British colonial rule in India.", "Analyze how colonial policies contributed to the rise of Indian nationalism." ] }, "Chapter 5": { mcq: [ { question: "What is the minimum voting age in India?", options: ["18", "21", "25", "30"], answer: "18" }, { question: "Which article of the Indian Constitution deals with universal adult franchise?", options: ["Article 324", "Article 326", "Article 356", "Article 370"], answer: "Article 326" }, { question: "What is the full form of EVM?", options: ["Electronic Voting Machine", "Election Verification Method", "Electoral Voting Mechanism", "Electronic Verification Machine"], answer: "Electronic Voting Machine" } ], fillBlank: [ { question: "The Election Commission of India was established in __________.", answer: "1950" }, { question: "The first general elections in India were held in __________.", answer: "1951-52" } ], trueFalse: [ { question: "India adopted universal adult franchise immediately after independence.", answer: "True" }, { question: "The President of India is elected directly by the people.", answer: "False" } ], veryShort: [ "Name two functions of the Election Commission of India.", "What is the Model Code of Conduct?" ], short: [ "Explain the importance of universal franchise in a democracy.", "Describe the electoral process in India." ], long: [ "Discuss the challenges faced by the Election Commission in conducting free and fair elections.", "Analyze how India's electoral system ensures representation of diverse groups." ] }, "Chapter 6": { mcq: [ { question: "Which house of Parliament is directly elected by the people?", options: ["Lok Sabha", "Rajya Sabha", "Both", "Neither"], answer: "Lok Sabha" }, { question: "Who is the head of the Union Executive in India?", options: ["President", "Prime Minister", "Chief Justice", "Speaker"], answer: "President" }, { question: "What is the maximum strength of Lok Sabha?", options: ["543", "545", "550", "552"], answer: "552" } ], fillBlank: [ { question: "The __________ is the presiding officer of Lok Sabha.", answer: "Speaker" }, { question: "The Council of Ministers is collectively responsible to the __________.", answer: "Lok Sabha" } ], trueFalse: [ { question: "Money bills can originate only in the Lok Sabha.", answer: "True" }, { question: "The Vice President is the ex-officio Chairman of Lok Sabha.", answer: "False" } ], veryShort: [ "Name two functions of the Parliament.", "What is the term of office for a Rajya Sabha member?" ], short: [ "Explain the law-making process in the Indian Parliament.", "Differentiate between the roles of the President and the Prime Minister." ], long: [ "Discuss how the parliamentary system ensures accountability of the executive.", "Analyze the relationship between the legislature and executive in India's parliamentary democracy." ] }, "Chapter 7": { mcq: [ { question: "Which is NOT a factor of production?", options: ["Land", "Labor", "Capital", "Money"], answer: "Money" }, { question: "What is the reward for capital as a factor of production?", options: ["Wage", "Rent", "Interest", "Profit"], answer: "Interest" }, { question: "Entrepreneurship combines which factors of production?", options: ["Land and Labor", "Labor and Capital", "All factors", "None"], answer: "All factors" } ], fillBlank: [ { question: "The human effort used in production is called __________.", answer: "labor" }, { question: "__________ is the payment for using land as a factor of production.", answer: "Rent" } ], trueFalse: [ { question: "Capital includes only money used in business.", answer: "False" }, { question: "Entrepreneurs bear the risk of production.", answer: "True" } ], veryShort: [ "Name two characteristics of land as a factor of production.", "What is the difference between fixed and working capital?" ], short: [ "Explain the importance of each factor of production in the economic process.", "Describe how factors of production are interdependent." ], long: [ "Discuss the role of entrepreneurship in economic development with examples.", "Analyze how technological changes affect the factors of production." ] } }; function getRandomQuestions(chapters, type, count) { try { let allQuestions = []; chapters.forEach(chapter => { if (questions[chapter] && questions[chapter][type]) { allQuestions = allQuestions.concat(questions[chapter][type]); } }); allQuestions = allQuestions.sort(() => Math.random() - 0.5); return allQuestions.slice(0, count); } catch (error) { console.error("Error in getRandomQuestions:", error); return []; } } function showSubjectOptions() { startScreen.classList.add('hidden'); subjectOptions.classList.remove('hidden'); } function showChapters() { subjectOptions.classList.add('hidden'); chapterSelection.classList.remove('hidden'); } function toggleChapters() { chapterCheckboxes.forEach(cb => cb.disabled = fullPaperCheckbox.checked); } function backToStart() { generatedPaperContainer.classList.add('hidden'); startContainer.classList.remove('hidden'); chapterSelection.classList.add('hidden'); startScreen.classList.remove('hidden'); } function generateAssignment() { try { console.log("Generating assignment..."); // Hide start container and show assignment container startContainer.classList.add('hidden'); generatedPaperContainer.classList.remove('hidden'); generatedPaperContainer.innerHTML = ''; // Get selected chapters const selectedChapters = fullPaperCheckbox.checked ? Object.keys(questions) : Array.from(document.querySelectorAll('input[name="chapter"]:checked')).map(cb => cb.value); if (selectedChapters.length === 0) { alert("Please select at least one chapter!"); startContainer.classList.remove('hidden'); return; } console.log("Selected chapters:", selectedChapters); const chapterNames = selectedChapters.map(ch => { if (ch === "Full Paper") return "Full Syllabus"; const label = document.querySelector(`label[for="${ch.toLowerCase()}"]`); return label ? ch + ". " + label.textContent.split(". ")[1] : ch; }).join(", "); console.log("Chapter names:", chapterNames); // Create assignment content let paperContent = ` <div class="header"> <h2>Class VIII Social Science Assignment</h2> <h3>${selectedChapters.length === Object.keys(questions).length ? "Full Syllabus" : chapterNames}</h3> </div> <div class="content-area"> <div class="instructions"> <p><strong>General Instructions:</strong></p> <ol> <li>Complete all questions in your notebook.</li> <li>Write answers in your own words.</li> <li>Draw diagrams/maps wherever necessary.</li> <li>Submit the assignment by the due date.</li> <li>Use blue or black ink only.</li> </ol> </div> `; // Get random questions const mcqs = getRandomQuestions(selectedChapters, 'mcq', 10); const fillBlanks = getRandomQuestions(selectedChapters, 'fillBlank', 5); const trueFalse = getRandomQuestions(selectedChapters, 'trueFalse', 5); const veryShort = getRandomQuestions(selectedChapters, 'veryShort', 5); const short = getRandomQuestions(selectedChapters, 'short', 5); const long = getRandomQuestions(selectedChapters, 'long', 5); console.log("Questions retrieved:", { mcqs, fillBlanks, trueFalse, veryShort, short, long }); let questionNumber = 1; // Section A - MCQ paperContent += ` <div class="question-section"> <h4 class="section-heading">Section A - Multiple Choice Questions (1 mark each)</h4> <p>Choose the correct option for each question:</p> `; mcqs.forEach(mcq => { paperContent += ` <div class="question"> <p class="question-text">${questionNumber++}. ${mcq.question}</p> ${mcq.options.map((opt, idx) => `<p class="option">${String.fromCharCode(65 + idx)}. ${opt}</p>` ).join('')} </div> `; }); // Section B - Fill in the blanks paperContent += ` </div> <div class="question-section"> <h4 class="section-heading">Section B - Fill in the Blanks (1 mark each)</h4> <p>Fill in the blanks with appropriate words:</p> `; fillBlanks.forEach(fb => { paperContent += ` <div class="question"> <p class="question-text">${questionNumber++}. ${fb.question}</p> </div> `; }); // Section C - True/False paperContent += ` </div> <div class="question-section"> <h4 class="section-heading">Section C - True/False Questions (1 mark each)</h4> <p>State whether the following statements are True or False:</p> `; trueFalse.forEach(tf => { paperContent += ` <div class="question"> <p class="question-text">${questionNumber++}. ${tf.question}</p> </div> `; }); // Section D - Very Short Questions paperContent += ` </div> <div class="question-section"> <h4 class="section-heading">Section D - Very Short Answer Questions (2 marks each)</h4> `; veryShort.forEach(q => { paperContent += ` <div class="question"> <p class="question-text">${questionNumber++}. ${q}</p> </div> `; }); // Section E - Short Questions paperContent += ` </div> <div class="question-section"> <h4 class="section-heading">Section E - Short Answer Questions (3 marks each)</h4> `; short.forEach(q => { paperContent += ` <div class="question"> <p class="question-text">${questionNumber++}. ${q}</p> </div> `; }); // Section F - Long Questions paperContent += ` </div> <div class="question-section"> <h4 class="section-heading">Section F - Long Answer Questions (5 marks each)</h4> `; long.forEach(q => { paperContent += ` <div class="question"> <p class="question-text">${questionNumber++}. ${q}</p> </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> `; console.log("Final paper content generated"); generatedPaperContainer.innerHTML = paperContent; console.log("Assignment generated successfully"); } catch (error) { console.error("Error generating assignment:", error); alert("An error occurred while generating the assignment. Please check the console for details."); backToStart(); } } 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 pixels (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++; } // Save PDF pdf.save('Class_8_Social_Science_Assignment.pdf'); console.log("PDF saved successfully"); } catch (error) { console.error('PDF generation error:', error); alert('Error generating PDF. Please check the console for details.'); // Remove temporary div if it exists const tempDiv = document.querySelector('.temp-pdf-container'); if (tempDiv) { document.body.removeChild(tempDiv); } } } </script> </body> </html>