#!/usr/bin/env python3 """ General Awareness Question Generator for SSC CGL. Generates ~20,000+ questions from curated fact banks covering History, Geography, Polity, Economics, Science, and Static GK. """ import random import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) from generators.base import make_question, get_qtid, get_db, insert_questions_batch SUBJECT = "General Awareness" # ============ FACT BANKS ============ ANCIENT_INDIA = [ ("The Indus Valley Civilization was discovered in", "1921", ["1911", "1931", "1901"]), ("Harappa was discovered by", "Daya Ram Sahni", ["R.D. Banerji", "John Marshall", "Mortimer Wheeler"]), ("Mohenjo-daro was discovered by", "R.D. Banerji", ["Daya Ram Sahni", "John Marshall", "Alexander Cunningham"]), ("The Great Bath was found at", "Mohenjo-daro", ["Harappa", "Lothal", "Kalibangan"]), ("The founder of the Maurya dynasty was", "Chandragupta Maurya", ["Ashoka", "Bindusara", "Bimbisara"]), ("Ashoka embraced Buddhism after the battle of", "Kalinga", ["Hydaspes", "Plassey", "Panipat"]), ("The author of Arthashastra was", "Kautilya", ["Kalidasa", "Banabhatta", "Vishakhadatta"]), ("Who was the court poet of Chandragupta Vikramaditya?", "Kalidasa", ["Banabhatta", "Harisena", "Amarsimha"]), ("The capital of the Chola dynasty was", "Thanjavur", ["Madurai", "Kanchipuram", "Hampi"]), ("The Iron Pillar at Delhi was erected by", "Chandragupta II", ["Ashoka", "Kanishka", "Samudragupta"]), ("Nalanda University was founded by", "Kumaragupta I", ["Ashoka", "Harsha", "Chandragupta II"]), ("The Gupta period is known as the", "Golden Age of India", ["Silver Age", "Bronze Age", "Iron Age"]), ("Sangam literature belongs to", "Tamil Nadu", ["Kerala", "Karnataka", "Andhra Pradesh"]), ("The first Jain council was held at", "Pataliputra", ["Vaishali", "Rajgir", "Vallabhi"]), ("Gautama Buddha attained enlightenment at", "Bodh Gaya", ["Sarnath", "Kushinagar", "Lumbini"]), ("The Ajanta caves are famous for", "Paintings", ["Sculptures", "Architecture", "Inscriptions"]), ("Who built the Sanchi Stupa?", "Ashoka", ["Kanishka", "Harsha", "Chandragupta"]), ("The Vedic period is divided into how many parts?", "Two (Early and Later)", ["Three", "Four", "Five"]), ("The oldest Veda is", "Rigveda", ["Samaveda", "Yajurveda", "Atharvaveda"]), ("Alexander invaded India in", "326 BC", ["321 BC", "331 BC", "316 BC"]), ] MEDIEVAL_INDIA = [ ("The Delhi Sultanate was established in", "1206", ["1192", "1210", "1290"]), ("Who founded the Mughal Empire in India?", "Babur", ["Akbar", "Humayun", "Shah Jahan"]), ("The Battle of Panipat (1526) was fought between", "Babur and Ibrahim Lodi", ["Akbar and Hemu", "Babur and Rana Sanga", "Humayun and Sher Shah"]), ("Taj Mahal was built by", "Shah Jahan", ["Akbar", "Jahangir", "Aurangzeb"]), ("Akbar founded the religion", "Din-i-Ilahi", ["Islam", "Sikhism", "Jainism"]), ("The court language of the Mughals was", "Persian", ["Urdu", "Arabic", "Hindi"]), ("Who built the Red Fort in Delhi?", "Shah Jahan", ["Akbar", "Aurangzeb", "Babur"]), ("The last Mughal emperor was", "Bahadur Shah Zafar", ["Aurangzeb", "Shah Alam II", "Muhammad Shah"]), ("Sher Shah Suri introduced", "Rupee coin", ["Gold coin", "Copper coin", "Silver coin"]), ("Who built Qutub Minar?", "Qutb-ud-din Aibak", ["Iltutmish", "Alauddin Khilji", "Muhammad Tughlaq"]), ("The Bhakti movement was started by", "Ramanuja", ["Kabir", "Nanak", "Tulsidas"]), ("Vijayanagara Empire was founded by", "Harihara and Bukka", ["Krishna Deva Raya", "Rama Raya", "Sangama"]), ("The capital of Vijayanagara was", "Hampi", ["Thanjavur", "Madurai", "Warangal"]), ("Who introduced the Mansabdari system?", "Akbar", ["Babur", "Shah Jahan", "Aurangzeb"]), ("The famous poet Amir Khusrau was associated with", "Alauddin Khilji", ["Akbar", "Babur", "Iltutmish"]), ] MODERN_INDIA = [ ("Who is known as the Father of the Nation?", "Mahatma Gandhi", ["Jawaharlal Nehru", "Subhas Chandra Bose", "B.R. Ambedkar"]), ("The first war of Indian Independence was in", "1857", ["1847", "1867", "1877"]), ("Who gave the slogan 'Do or Die'?", "Mahatma Gandhi", ["Subhas Chandra Bose", "Bal Gangadhar Tilak", "Bhagat Singh"]), ("The Indian National Congress was founded in", "1885", ["1875", "1895", "1905"]), ("Who founded the Indian National Congress?", "A.O. Hume", ["Dadabhai Naoroji", "Surendranath Banerjee", "W.C. Bonnerjee"]), ("The Jallianwala Bagh massacre occurred in", "1919", ["1920", "1918", "1921"]), ("The Salt March took place in", "1930", ["1929", "1931", "1932"]), ("India gained independence on", "15 August 1947", ["26 January 1947", "15 August 1946", "26 January 1950"]), ("Who was the first President of India?", "Dr. Rajendra Prasad", ["Dr. S. Radhakrishnan", "Jawaharlal Nehru", "B.R. Ambedkar"]), ("Who was the first Prime Minister of India?", "Jawaharlal Nehru", ["Sardar Patel", "Dr. Rajendra Prasad", "Mahatma Gandhi"]), ("The Quit India Movement was launched in", "1942", ["1940", "1943", "1945"]), ("Who gave the slogan 'Jai Hind'?", "Subhas Chandra Bose", ["Mahatma Gandhi", "Jawaharlal Nehru", "Bhagat Singh"]), ("The Rowlatt Act was passed in", "1919", ["1918", "1920", "1921"]), ("The Non-Cooperation Movement was launched in", "1920", ["1919", "1921", "1922"]), ("Who was known as the Iron Man of India?", "Sardar Vallabhbhai Patel", ["Subhas Chandra Bose", "Bhagat Singh", "Lal Bahadur Shastri"]), ("The Partition of Bengal took place in", "1905", ["1903", "1907", "1909"]), ("Who founded the Arya Samaj?", "Swami Dayanand Saraswati", ["Swami Vivekananda", "Raja Ram Mohan Roy", "Ramakrishna"]), ("The Lucknow Pact was signed in", "1916", ["1915", "1917", "1918"]), ("Who wrote 'Vande Mataram'?", "Bankim Chandra Chattopadhyay", ["Rabindranath Tagore", "Kazi Nazrul Islam", "Sarojini Naidu"]), ("Who composed the National Anthem of India?", "Rabindranath Tagore", ["Bankim Chandra", "Sarojini Naidu", "Muhammad Iqbal"]), ] GEOGRAPHY_FACTS = [ ("The largest continent by area is", "Asia", ["Africa", "North America", "Europe"]), ("The longest river in the world is", "Nile", ["Amazon", "Yangtze", "Mississippi"]), ("The highest peak in the world is", "Mount Everest", ["K2", "Kangchenjunga", "Lhotse"]), ("The largest ocean is", "Pacific Ocean", ["Atlantic Ocean", "Indian Ocean", "Arctic Ocean"]), ("The largest desert in the world is", "Sahara", ["Arabian", "Gobi", "Kalahari"]), ("The longest river in India is", "Ganga", ["Godavari", "Krishna", "Brahmaputra"]), ("The highest peak in India is", "Kangchenjunga", ["Nanda Devi", "K2", "Annapurna"]), ("Which state in India has the longest coastline?", "Gujarat", ["Maharashtra", "Tamil Nadu", "Andhra Pradesh"]), ("The Tropic of Cancer passes through how many Indian states?", "8", ["6", "7", "9"]), ("The largest freshwater lake in India is", "Wular Lake", ["Dal Lake", "Chilika Lake", "Loktak Lake"]), ("Which Indian state is known as the 'Spice Garden of India'?", "Kerala", ["Karnataka", "Tamil Nadu", "Goa"]), ("The Western Ghats are also known as", "Sahyadri", ["Vindhya", "Aravalli", "Nilgiri"]), ("The northernmost point of India is", "Indira Col", ["Kanyakumari", "Rann of Kutch", "Indira Point"]), ("Which river is known as the 'Sorrow of Bengal'?", "Damodar", ["Hooghly", "Teesta", "Mahanadi"]), ("The largest state in India by area is", "Rajasthan", ["Madhya Pradesh", "Maharashtra", "Uttar Pradesh"]), ("The Thar Desert is located in", "Rajasthan", ["Gujarat", "Haryana", "Punjab"]), ("The capital of Arunachal Pradesh is", "Itanagar", ["Shillong", "Imphal", "Kohima"]), ("Chilika Lake is located in", "Odisha", ["Andhra Pradesh", "Tamil Nadu", "Kerala"]), ("The Deccan Plateau lies in", "Southern India", ["Northern India", "Eastern India", "Western India"]), ("The soil best suited for cotton cultivation is", "Black soil", ["Red soil", "Alluvial soil", "Laterite soil"]), ] POLITY_FACTS = [ ("The Constitution of India came into effect on", "26 January 1950", ["15 August 1947", "26 November 1949", "15 August 1950"]), ("How many Fundamental Rights are there?", "6", ["5", "7", "8"]), ("Right to Education was added by which amendment?", "86th Amendment", ["42nd Amendment", "44th Amendment", "91st Amendment"]), ("The Preamble declares India as a", "Sovereign Socialist Secular Democratic Republic", ["Federal Republic", "Parliamentary Republic", "Constitutional Monarchy"]), ("Who is known as the Father of Indian Constitution?", "Dr. B.R. Ambedkar", ["Jawaharlal Nehru", "Mahatma Gandhi", "Rajendra Prasad"]), ("The total number of members in Lok Sabha is", "545", ["250", "500", "552"]), ("Rajya Sabha members are elected for", "6 years", ["5 years", "4 years", "3 years"]), ("The minimum age to become President of India is", "35 years", ["25 years", "30 years", "40 years"]), ("The Chief Justice of India is appointed by", "The President", ["The Prime Minister", "The Parliament", "The Law Minister"]), ("Which Article deals with the Right to Equality?", "Article 14", ["Article 19", "Article 21", "Article 32"]), ("Article 21 deals with", "Right to Life and Personal Liberty", ["Right to Freedom", "Right to Equality", "Right against Exploitation"]), ("The Directive Principles are in which Part of the Constitution?", "Part IV", ["Part III", "Part V", "Part VI"]), ("How many schedules are there in the Indian Constitution?", "12", ["8", "10", "14"]), ("The Vice President is the ex-officio Chairman of", "Rajya Sabha", ["Lok Sabha", "Parliament", "NITI Aayog"]), ("Emergency provisions are in which Article?", "Article 352", ["Article 356", "Article 360", "Article 370"]), ("The 73rd Amendment is related to", "Panchayati Raj", ["Municipal Corporation", "Fundamental Rights", "DPSP"]), ("Who appoints the Governor of a state?", "The President", ["The Prime Minister", "The Chief Minister", "The Parliament"]), ("The Finance Commission is appointed every", "5 years", ["3 years", "4 years", "6 years"]), ("Judicial review is the power of", "Supreme Court", ["Parliament", "President", "Prime Minister"]), ("The CAG is appointed by", "The President", ["The Prime Minister", "The Parliament", "The Finance Minister"]), ] ECONOMICS_FACTS = [ ("The Reserve Bank of India was established in", "1935", ["1947", "1950", "1921"]), ("The current GST council is chaired by", "Union Finance Minister", ["Prime Minister", "RBI Governor", "Revenue Secretary"]), ("Which Five Year Plan focused on rapid industrialization?", "Second Five Year Plan", ["First Plan", "Third Plan", "Fourth Plan"]), ("NITI Aayog was established in", "2015", ["2014", "2016", "2017"]), ("NITI Aayog replaced", "Planning Commission", ["Finance Commission", "UGC", "UPSC"]), ("GDP stands for", "Gross Domestic Product", ["Grand Domestic Product", "General Domestic Product", "Gross Development Product"]), ("The fiscal year in India starts from", "April 1", ["January 1", "March 1", "July 1"]), ("WTO was established in", "1995", ["1947", "1991", "2000"]), ("IMF headquarters is in", "Washington D.C.", ["New York", "Geneva", "London"]), ("World Bank headquarters is in", "Washington D.C.", ["New York", "Geneva", "Paris"]), ("BRICS includes India, Brazil, Russia, China and", "South Africa", ["Sri Lanka", "Singapore", "Saudi Arabia"]), ("National income is calculated by", "Central Statistics Office", ["RBI", "NITI Aayog", "Finance Ministry"]), ("The first bank in India was", "Bank of Hindustan", ["State Bank of India", "Bank of Bombay", "RBI"]), ("SBI was formed from", "Imperial Bank of India", ["Bank of Bengal", "Bank of Bombay", "Bank of Madras"]), ("Repo rate is the rate at which", "RBI lends to commercial banks", ["Banks lend to public", "Government borrows", "FDI flows"]), ("CRR stands for", "Cash Reserve Ratio", ["Central Reserve Ratio", "Cash Recovery Rate", "Credit Reserve Ratio"]), ("The currency of Japan is", "Yen", ["Yuan", "Won", "Baht"]), ("Which organization gives the 'Ease of Doing Business' ranking?", "World Bank", ["IMF", "WTO", "UN"]), ("Make in India was launched in", "2014", ["2015", "2016", "2013"]), ("Digital India was launched in", "2015", ["2014", "2016", "2017"]), ] SCIENCE_FACTS = [ ("The SI unit of force is", "Newton", ["Joule", "Watt", "Pascal"]), ("The speed of light is approximately", "3 × 10⁸ m/s", ["3 × 10⁶ m/s", "3 × 10¹⁰ m/s", "3 × 10⁵ m/s"]), ("The chemical formula of water is", "H₂O", ["H₂O₂", "HO₂", "H₃O"]), ("Photosynthesis occurs in", "Chloroplast", ["Mitochondria", "Ribosome", "Nucleus"]), ("The powerhouse of the cell is", "Mitochondria", ["Nucleus", "Ribosome", "Chloroplast"]), ("The hardest natural substance is", "Diamond", ["Quartz", "Topaz", "Ruby"]), ("The chemical symbol for gold is", "Au", ["Ag", "Fe", "Go"]), ("Blood is purified in", "Kidneys", ["Liver", "Heart", "Lungs"]), ("The largest organ of the human body is", "Skin", ["Liver", "Brain", "Heart"]), ("The total number of bones in an adult human body is", "206", ["208", "204", "210"]), ("Vitamin C deficiency causes", "Scurvy", ["Rickets", "Beriberi", "Night blindness"]), ("Vitamin D deficiency causes", "Rickets", ["Scurvy", "Beriberi", "Pellagra"]), ("The gas responsible for global warming is", "Carbon dioxide", ["Oxygen", "Nitrogen", "Hydrogen"]), ("Sound travels fastest in", "Solids", ["Liquids", "Gases", "Vacuum"]), ("The pH of pure water is", "7", ["5", "8", "6"]), ("Newton's first law is also known as", "Law of Inertia", ["Law of Acceleration", "Law of Action-Reaction", "Law of Gravity"]), ("The center of an atom is called", "Nucleus", ["Electron", "Proton", "Neutron"]), ("Insulin is produced by", "Pancreas", ["Liver", "Kidney", "Thyroid"]), ("The boiling point of water is", "100°C", ["90°C", "110°C", "120°C"]), ("The chemical formula of common salt is", "NaCl", ["KCl", "NaOH", "HCl"]), ("The study of fungi is called", "Mycology", ["Zoology", "Botany", "Virology"]), ("The gas used in fire extinguishers is", "CO₂", ["O₂", "N₂", "H₂"]), ("The lightest gas is", "Hydrogen", ["Helium", "Oxygen", "Nitrogen"]), ("The element with atomic number 1 is", "Hydrogen", ["Helium", "Lithium", "Carbon"]), ("Malaria is caused by", "Plasmodium", ["Bacteria", "Virus", "Fungus"]), ("The human heart has how many chambers?", "4", ["2", "3", "5"]), ("The instrument used to measure atmospheric pressure is", "Barometer", ["Thermometer", "Hygrometer", "Anemometer"]), ("Who discovered Penicillin?", "Alexander Fleming", ["Louis Pasteur", "Edward Jenner", "Robert Koch"]), ("The study of earthquake is called", "Seismology", ["Geology", "Volcanology", "Meteorology"]), ("DNA stands for", "Deoxyribonucleic Acid", ["Deoxyribose Nucleic Acid", "Dinucleic Acid", "Deoxyribo Amino Acid"]), ] COMPUTER_FACTS = [ ("The full form of CPU is", "Central Processing Unit", ["Central Program Unit", "Computer Processing Unit", "Central Process Utility"]), ("RAM stands for", "Random Access Memory", ["Read Access Memory", "Random Alloc Memory", "Read All Memory"]), ("The father of computers is", "Charles Babbage", ["Alan Turing", "John von Neumann", "Tim Berners-Lee"]), ("HTML stands for", "HyperText Markup Language", ["HyperText Machine Language", "High Text Markup Language", "Hyper Transfer Markup Language"]), ("Which shortcut key is used to copy?", "Ctrl + C", ["Ctrl + V", "Ctrl + X", "Ctrl + Z"]), ("Which shortcut key is used to undo?", "Ctrl + Z", ["Ctrl + Y", "Ctrl + X", "Ctrl + C"]), ("The brain of the computer is", "CPU", ["RAM", "Hard Disk", "Monitor"]), ("1 KB equals", "1024 bytes", ["1000 bytes", "512 bytes", "2048 bytes"]), ("An IP address is used to", "Identify a device on a network", ["Store data", "Display web pages", "Send emails"]), ("HTTP stands for", "HyperText Transfer Protocol", ["High Text Transfer Protocol", "Hyper Transfer Text Protocol", "HyperText Transport Protocol"]), ("The extension of a Word document is", ".docx", [".xlsx", ".pptx", ".pdf"]), ("Which software is used for spreadsheets?", "MS Excel", ["MS Word", "MS PowerPoint", "MS Access"]), ("A computer virus is a", "Malicious software program", ["Hardware defect", "Network issue", "Browser plugin"]), ("Wi-Fi stands for", "Wireless Fidelity", ["Wireless Finder", "Wide Fidelity", "Wired Fidelity"]), ("The first search engine on the internet was", "Archie", ["Google", "Yahoo", "Bing"]), ("URL stands for", "Uniform Resource Locator", ["Universal Resource Link", "Uniform Retrieval Locator", "Universal Resource Locator"]), ("LAN stands for", "Local Area Network", ["Large Area Network", "Long Access Network", "Local Access Network"]), ("Which key is used to refresh a web page?", "F5", ["F1", "F2", "F12"]), ("The default file extension for Excel is", ".xlsx", [".docx", ".pptx", ".csv"]), ("Phishing is a type of", "Cyber fraud", ["Computer virus", "Software update", "Network protocol"]), ] STATIC_GK = [ ("The national bird of India is", "Peacock", ["Sparrow", "Parrot", "Eagle"]), ("The national animal of India is", "Tiger", ["Lion", "Elephant", "Leopard"]), ("The national flower of India is", "Lotus", ["Rose", "Jasmine", "Sunflower"]), ("The national game of India is", "Hockey", ["Cricket", "Football", "Badminton"]), ("The national fruit of India is", "Mango", ["Apple", "Banana", "Guava"]), ("The national river of India is", "Ganga", ["Yamuna", "Godavari", "Brahmaputra"]), ("India's national currency is", "Indian Rupee", ["Dollar", "Pound", "Euro"]), ("World Environment Day is celebrated on", "June 5", ["March 22", "April 22", "October 16"]), ("International Women's Day is observed on", "March 8", ["February 14", "May 1", "June 21"]), ("World Health Day is celebrated on", "April 7", ["March 7", "May 7", "June 7"]), ("Teachers' Day in India is celebrated on", "September 5", ["November 14", "October 2", "January 26"]), ("Children's Day in India is celebrated on", "November 14", ["September 5", "October 2", "January 26"]), ("Republic Day is celebrated on", "January 26", ["August 15", "October 2", "November 14"]), ("Who wrote the book 'Wings of Fire'?", "A.P.J. Abdul Kalam", ["Jawaharlal Nehru", "Mahatma Gandhi", "R.K. Narayan"]), ("Who wrote 'Discovery of India'?", "Jawaharlal Nehru", ["Mahatma Gandhi", "Rabindranath Tagore", "S. Radhakrishnan"]), ("The Nobel Prize for Literature was won by Rabindranath Tagore in", "1913", ["1910", "1920", "1930"]), ("The Olympic Games are held every", "4 years", ["2 years", "3 years", "5 years"]), ("The headquarters of UN is in", "New York", ["Geneva", "London", "Washington D.C."]), ("Who was the first Indian woman to win an Olympic medal?", "Karnam Malleswari", ["P.T. Usha", "Saina Nehwal", "Mary Kom"]), ("The Booker Prize is associated with", "Literature", ["Science", "Peace", "Economics"]), ("The Grammy Award is associated with", "Music", ["Films", "Literature", "Sports"]), ("The first Indian satellite was", "Aryabhata", ["Bhaskara", "INSAT-1A", "Rohini"]), ("ISRO headquarters is in", "Bengaluru", ["Chennai", "Hyderabad", "New Delhi"]), ("Who was the first Indian in space?", "Rakesh Sharma", ["Kalpana Chawla", "Sunita Williams", "Ravish Malhotra"]), ("The Bharat Ratna is the highest", "Civilian award", ["Military award", "Sports award", "Literary award"]), ] GOVT_SCHEMES = [ ("Swachh Bharat Mission was launched in", "2014", ["2015", "2016", "2013"]), ("Pradhan Mantri Jan Dhan Yojana provides", "Bank accounts for all", ["Free healthcare", "Education scholarship", "Housing"]), ("Ayushman Bharat scheme provides", "Health insurance coverage", ["Bank accounts", "Education", "Housing"]), ("PM Kisan scheme provides", "₹6000 per year to farmers", ["Free seeds", "Loan waiver", "Insurance"]), ("Beti Bachao Beti Padhao focuses on", "Girl child welfare and education", ["Boy child education", "Senior citizens", "Farmers"]), ("Start-up India was launched in", "2016", ["2015", "2017", "2014"]), ("Skill India Mission aims at", "Training youth in skills", ["Providing jobs", "Building schools", "Health camps"]), ("MUDRA scheme provides", "Loans for small businesses", ["Education loans", "Home loans", "Car loans"]), ("Ujjwala Yojana provides", "Free LPG connections", ["Free electricity", "Free water", "Free internet"]), ("Atal Pension Yojana is for", "Retirement pension for unorganized sector", ["Health insurance", "Education", "Housing"]), ] SPORTS_FACTS = [ ("The Cricket World Cup 2023 was held in", "India", ["England", "Australia", "South Africa"]), ("The FIFA World Cup 2022 was held in", "Qatar", ["Russia", "Brazil", "Japan"]), ("The Ranji Trophy is associated with", "Cricket", ["Football", "Hockey", "Tennis"]), ("The Davis Cup is associated with", "Tennis", ["Cricket", "Football", "Badminton"]), ("The Thomas Cup is associated with", "Badminton", ["Tennis", "Table Tennis", "Cricket"]), ("The Durand Cup is the oldest football tournament in", "Asia", ["Europe", "Africa", "South America"]), ("Wimbledon is played on", "Grass court", ["Clay court", "Hard court", "Carpet court"]), ("A marathon race covers a distance of", "42.195 km", ["40 km", "45 km", "50 km"]), ("The term 'Grand Slam' is used in", "Tennis", ["Cricket", "Football", "Hockey"]), ("How many players are there in a cricket team?", "11", ["9", "13", "15"]), ("How many players are there in a football team?", "11", ["9", "13", "15"]), ("The term 'Checkmate' is used in", "Chess", ["Cricket", "Football", "Hockey"]), ("The Summer Olympics 2024 was held in", "Paris", ["Tokyo", "Los Angeles", "London"]), ("Who holds the record for most centuries in international cricket?", "Sachin Tendulkar", ["Virat Kohli", "Ricky Ponting", "Kumar Sangakkara"]), ("The Dronacharya Award is given to", "Sports coaches", ["Players", "Scientists", "Teachers"]), ] def _generate_from_facts(conn, facts, subtopic, topic, qtype_name, multiplier=3): """Generate questions from a fact bank with variations.""" questions = [] qtid = get_qtid(conn, SUBJECT, subtopic, topic, qtype_name) if not qtid: return questions for _ in range(len(facts) * multiplier): q_text, correct, wrongs = random.choice(facts) difficulty = random.choice([1, 1, 2]) questions.append(make_question(qtid, q_text, correct, wrongs, f"Answer: {correct}", difficulty)) return questions def gen_history(conn, count_per=600): q = [] q.extend(_generate_from_facts(conn, ANCIENT_INDIA, "History", "Ancient India", "Who/What/When", 50)) q.extend(_generate_from_facts(conn, MEDIEVAL_INDIA, "History", "Medieval India", "Who/What/When", 50)) q.extend(_generate_from_facts(conn, MODERN_INDIA, "History", "Modern India", "Freedom fighter identification", 50)) return q def gen_geography(conn, count=2000): return _generate_from_facts(conn, GEOGRAPHY_FACTS, "Geography", "Indian Geography", "River system", 130) def gen_polity(conn, count=2000): return _generate_from_facts(conn, POLITY_FACTS, "Indian Polity", "Indian Constitution", "Article identification", 130) def gen_economics(conn, count=2000): return _generate_from_facts(conn, ECONOMICS_FACTS, "Economics", "Indian Economy Basics", "Economic indicator", 130) def gen_science(conn, count=3000): return _generate_from_facts(conn, SCIENCE_FACTS, "Science", "Physics", "Law/principle identification", 135) def gen_computer(conn, count=2000): return _generate_from_facts(conn, COMPUTER_FACTS, "Science", "Computer Awareness", "Term definition", 100) def gen_static_gk(conn, count=2000): return _generate_from_facts(conn, STATIC_GK, "Static GK", "National Symbols and Firsts", "Identify symbol", 80) def gen_schemes(conn, count=1000): return _generate_from_facts(conn, GOVT_SCHEMES, "Economics", "Government Schemes", "Scheme objective", 100) def gen_sports(conn, count=1000): return _generate_from_facts(conn, SPORTS_FACTS, "Static GK", "Sports", "Trophy-sport", 70) def generate_all(conn): """Generate all General Awareness questions.""" generators = [ ("History", gen_history), ("Geography", gen_geography), ("Polity", gen_polity), ("Economics", gen_economics), ("Science", gen_science), ("Computer Awareness", gen_computer), ("Static GK", gen_static_gk), ("Govt Schemes", gen_schemes), ("Sports", gen_sports), ] total = 0 all_questions = [] for name, gen_func in generators: questions = gen_func(conn) all_questions.extend(questions) print(f" {name}: {len(questions)} questions") total += len(questions) batch_size = 5000 for i in range(0, len(all_questions), batch_size): insert_questions_batch(conn, all_questions[i:i+batch_size]) print(f" TOTAL General Awareness: {total}") return total if __name__ == '__main__': conn = get_db() print("Generating General Awareness questions...") generate_all(conn) conn.close()