Files
pragativeer-v2/backend/seed_dpps_real.py

451 lines
25 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Real DPP Question Seeder - Seeds Physics, Chemistry, Math, Biology DPPs
with actual JEE/NEET standard questions as type=DPS (PrepPilot AI)
and a separate Mock CBT test as type=CBT (Mock Tests section)
"""
import uuid
from sqlmodel import Session, select
from datetime import datetime
from database import engine
import models
PHYSICS_QUESTIONS = [
{
"text": "A body of mass 5 kg is acted upon by two perpendicular forces 8 N and 6 N. The magnitude and direction of the resultant with respect to the 6 N force is:",
"options": {"A": "10 N at 53°", "B": "10 N at 37°", "C": "8 N at 45°", "D": "14 N at 0°"},
"answer": "A",
"solution": "Resultant R = √(8² + 6²) = √(64+36) = √100 = 10 N. tan θ = 8/6 = 4/3 → θ = 53° from the 6N force."
},
{
"text": "A ball is thrown vertically upward with velocity 20 m/s. The maximum height reached is: (g = 10 m/s²)",
"options": {"A": "10 m", "B": "20 m", "C": "40 m", "D": "5 m"},
"answer": "B",
"solution": "Using v² = u² - 2gh. At max height v=0. h = u²/2g = (20)²/(2×10) = 400/20 = 20 m."
},
{
"text": "The ratio of radii of gyration of a circular disc to that of a circular ring, each of the same mass and radius, about their axes passing through their centres and perpendicular to their planes is:",
"options": {"A": "√2 : 1", "B": "1 : √2", "C": "1 : 2", "D": "2 : 1"},
"answer": "B",
"solution": "I_disc = MR²/2, I_ring = MR². k_disc = R/√2, k_ring = R. Ratio = (1/√2) : 1 = 1 : √2."
},
{
"text": "Two charges of +4μC and -4μC are placed at (3, 0) and (-3, 0) cm. The electric field at origin due to this dipole is:",
"options": {"A": "4 × 10⁸ N/C along +x", "B": "4 × 10⁸ N/C along -x", "C": "8 × 10⁸ N/C along +x", "D": "Zero"},
"answer": "A",
"solution": "Each charge contributes E = kq/r² = (9×10⁹ × 4×10⁻⁶)/(0.03)² = 4×10⁷ N/C. Both fields point in +x direction. Total = 8×10⁷ N/C along +x."
},
{
"text": "A wire of length L and resistance R is uniformly stretched to double its length. New resistance is:",
"options": {"A": "R/2", "B": "R", "C": "2R", "D": "4R"},
"answer": "D",
"solution": "ρ is constant. Volume = AL = constant. New length L' = 2L → new area A' = A/2. R' = ρ(2L)/(A/2) = 4ρL/A = 4R."
},
{
"text": "In Young's double slit experiment, the slits are 0.5 mm apart and interference fringes are observed on a screen 1.0 m away. It is found that the 9th bright fringe is at a distance of 8.835 mm from the 2nd dark fringe. Find the wavelength of light:",
"options": {"A": "600 nm", "B": "589 nm", "C": "550 nm", "D": "500 nm"},
"answer": "B",
"solution": "Distance = (9+0.5-2+0.5)β = 8β = 8 × λD/d. 8.835 mm = 8λ(1)/(0.5×10⁻³). λ = 8.835×10⁻³ × 0.5×10⁻³/8 = 589 nm."
},
{
"text": "The half life of a radioactive element is 3 hours. After 12 hours the fraction of initial amount remaining will be:",
"options": {"A": "1/16", "B": "1/8", "C": "1/4", "D": "1/2"},
"answer": "A",
"solution": "Number of half-lives = 12/3 = 4. Fraction remaining = (1/2)^4 = 1/16."
},
{
"text": "A solid sphere of radius R has a charge Q uniformly distributed over its volume. The magnitude of electric field at distance r from the center (r < R) is:",
"options": {"A": "Q/(4πε₀R²)", "B": "Qr/(4πε₀R³)", "C": "Q/(4πε₀r²)", "D": "Zero"},
"answer": "B",
"solution": "By Gauss's law, E(4πr²) = Q_enc/ε₀ = (Q/R³)r³/ε₀. E = Qr/(4πε₀R³)."
},
{
"text": "The kinetic energy of a satellite orbiting at height h above Earth's surface is (mass of satellite m, radius R, mass of Earth M):",
"options": {"A": "GMm/(2(R+h))", "B": "GMm/(R+h)", "C": "-GMm/(2(R+h))", "D": "GMm/R"},
"answer": "A",
"solution": "For circular orbit: mv²/(R+h) = GMm/(R+h)². KE = mv²/2 = GMm/(2(R+h))."
},
{
"text": "A particle executes SHM with amplitude A. The displacement at which kinetic energy equals potential energy is:",
"options": {"A": "A/2", "B": "A/√2", "C": "A√2", "D": "2A"},
"answer": "B",
"solution": "KE = PE → (1/2)mω²(A²-x²) = (1/2)mω²x². A²-x² = x². x² = A²/2. x = A/√2."
},
{
"text": "In Compton scattering, the change in wavelength is maximum when the photon is scattered through angle:",
"options": {"A": "0°", "B": "45°", "C": "90°", "D": "180°"},
"answer": "D",
"solution": "Compton shift Δλ = (h/mₑc)(1-cosθ). Maximum when cosθ = -1 i.e., θ = 180°. Max Δλ = 2h/mₑc = 0.0485 Å."
},
{
"text": "A capacitor of capacitance C is connected to a battery of EMF E through a resistance R. The time constant of the circuit is:",
"options": {"A": "RC", "B": "R/C", "C": "C/R", "D": "1/RC"},
"answer": "A",
"solution": "The time constant τ = RC for a series RC circuit. It represents the time for the capacitor to charge to 63.2% of the final value."
},
{
"text": "Which electromagnetic radiation has the highest penetrating power?",
"options": {"A": "UV rays", "B": "X-rays", "C": "Gamma rays", "D": "Infrared rays"},
"answer": "C",
"solution": "Gamma rays have the highest penetrating power due to their extremely short wavelength and high energy. They can penetrate through several cm of lead."
},
{
"text": "A bar magnet of magnetic moment M is placed in a uniform magnetic field B. The torque on the magnet when it makes angle 30° with the field is:",
"options": {"A": "MB/2", "B": "MB√3/2", "C": "MB", "D": "MB√3"},
"answer": "A",
"solution": "τ = MBsinθ = MBsin30° = MB × (1/2) = MB/2."
},
{
"text": "The de Broglie wavelength associated with a proton moving with velocity v is λ. For an alpha particle moving with the same speed, the de Broglie wavelength will be:",
"options": {"A": "λ/4", "B": "λ/2", "C": "2λ", "D": "4λ"},
"answer": "A",
"solution": "λ = h/mv. α-particle mass = 4mₚ. λ_α = h/(4mₚv) = λ_p/4."
},
]
CHEMISTRY_QUESTIONS = [
{
"text": "The hybridization of carbon in diamond and graphite respectively is:",
"options": {"A": "sp², sp³", "B": "sp³, sp²", "C": "sp, sp²", "D": "sp³, sp"},
"answer": "B",
"solution": "Diamond: each C is bonded to 4 others in tetrahedral arrangement → sp³. Graphite: each C is bonded to 3 others in trigonal planar → sp²."
},
{
"text": "The equilibrium constant Kp for the reaction N₂(g) + 3H₂(g) ⇌ 2NH₃(g) is related to Kc by:",
"options": {"A": "Kp = Kc(RT)²", "B": "Kp = Kc(RT)⁻²", "C": "Kp = Kc(RT)²", "D": "Kp = Kc"},
"answer": "B",
"solution": "Δn = 2 - (1+3) = -2. Kp = Kc(RT)^Δn = Kc(RT)^(-2)."
},
{
"text": "The IUPAC name of the compound CH₃-CH(Cl)-CH₂-CH₃ is:",
"options": {"A": "1-chlorobutane", "B": "2-chlorobutane", "C": "3-chlorobutane", "D": "Sec-butyl chloride"},
"answer": "B",
"solution": "The longest chain has 4 carbons (butane). Cl is on carbon 2. IUPAC name: 2-chlorobutane."
},
{
"text": "Which of the following has the highest lattice energy?",
"options": {"A": "NaCl", "B": "KCl", "C": "MgO", "D": "NaF"},
"answer": "C",
"solution": "Lattice energy ∝ (charge of ions)²/distance. MgO has doubly charged ions (Mg²⁺ and O²⁻) giving it much higher lattice energy than singly-charged ion compounds."
},
{
"text": "The pH of 0.001 M H₂SO₄ solution is:",
"options": {"A": "3", "B": "2.7", "C": "2", "D": "1"},
"answer": "B",
"solution": "H₂SO₄ is a strong diprotic acid. [H⁺] = 2 × 0.001 = 0.002 M. pH = -log(0.002) = -log(2×10⁻³) = 3 - log2 = 3 - 0.301 ≈ 2.7."
},
{
"text": "Which of the following undergoes SN1 reaction most readily?",
"options": {"A": "CH₃Cl", "B": "CH₃CH₂Cl", "C": "(CH₃)₂CHCl", "D": "(CH₃)₃CCl"},
"answer": "D",
"solution": "SN1 rate depends on carbocation stability. Tertiary carbocations are most stable due to hyperconjugation and inductive effect of alkyl groups. (CH₃)₃C⁺ is tertiary."
},
{
"text": "The oxidation state of Cr in K₂Cr₂O₇ is:",
"options": {"A": "+3", "B": "+4", "C": "+6", "D": "+7"},
"answer": "C",
"solution": "Let Cr be x. 2(+1) + 2x + 7(-2) = 0 → 2 + 2x - 14 = 0 → 2x = 12 → x = +6."
},
{
"text": "Which quantum number determines the orientation of an orbital in space?",
"options": {"A": "Principal (n)", "B": "Azimuthal (l)", "C": "Magnetic (mₗ)", "D": "Spin (mₛ)"},
"answer": "C",
"solution": "The magnetic quantum number (mₗ) determines the orientation of the orbital in three-dimensional space, ranging from -l to +l."
},
{
"text": "The correct order of boiling points of hydrides of group 16 elements is:",
"options": {"A": "H₂O > H₂S > H₂Se > H₂Te", "B": "H₂Te > H₂Se > H₂S > H₂O", "C": "H₂O > H₂Te > H₂Se > H₂S", "D": "H₂S > H₂O > H₂Se > H₂Te"},
"answer": "C",
"solution": "H₂O has highest BP due to hydrogen bonding. Among H₂S, H₂Se, H₂Te: BP increases with molar mass (van der Waals forces). So H₂O > H₂Te > H₂Se > H₂S."
},
{
"text": "Identify the product formed when acetaldehyde reacts with excess HCN followed by hydrolysis:",
"options": {"A": "Acetic acid", "B": "Lactic acid", "C": "Pyruvic acid", "D": "Glycolic acid"},
"answer": "B",
"solution": "CH₃CHO + HCN → CH₃CH(OH)CN (cyanohydrin). On hydrolysis: CH₃CH(OH)COOH = lactic acid (2-hydroxypropanoic acid)."
},
{
"text": "The van't Hoff factor 'i' for a 0.01 M solution of K₂SO₄ that is 50% dissociated is:",
"options": {"A": "1.5", "B": "2.0", "C": "2.5", "D": "3.0"},
"answer": "B",
"solution": "K₂SO₄ → 2K⁺ + SO₄²⁻ (3 ions). For 50% dissociation: i = 1 + α(n-1) = 1 + 0.5(3-1) = 1 + 1 = 2.0."
},
{
"text": "Which of the following is NOT a property of transition metals?",
"options": {"A": "They show variable oxidation states", "B": "They form colored compounds", "C": "They have low melting points", "D": "They act as catalysts"},
"answer": "C",
"solution": "Transition metals generally have high melting points due to strong metallic bonds involving d electrons. Options A, B, and D are characteristic properties of transition metals."
},
{
"text": "The reaction of glucose with excess acetic anhydride gives:",
"options": {"A": "Glucose diacetate", "B": "Glucose triacetate", "C": "Glucose pentaacetate", "D": "Glucose hexaacetate"},
"answer": "C",
"solution": "Glucose has 5 -OH groups (1 anomeric + 4 secondary). All react with acetic anhydride giving glucose pentaacetate."
},
{
"text": "The number of σ and π bonds in benzene molecule are:",
"options": {"A": "6σ, 3π", "B": "12σ, 3π", "C": "6σ, 6π", "D": "9σ, 3π"},
"answer": "B",
"solution": "C₆H₆: 6 C-C bonds (σ) + 6 C-H bonds (σ) = 12 σ bonds. 3 π bonds in alternate double bonds. Total: 12σ and 3π."
},
{
"text": "Le Chatelier's principle predicts that increasing pressure will favor formation of products in:",
"options": {"A": "N₂ + 3H₂ ⇌ 2NH₃", "B": "2SO₃ ⇌ 2SO₂ + O₂", "C": "H₂ + I₂ ⇌ 2HI", "D": "N₂ + O₂ ⇌ 2NO"},
"answer": "A",
"solution": "Increasing pressure favors the reaction with fewer moles of gas. N₂+3H₂→2NH₃: reactants have 4 mol gas, products have 2. Pressure increase shifts equilibrium right."
},
]
MATH_QUESTIONS = [
{
"text": "If f(x) = x² - 3x + 2, then f(f(x)) = 0 has how many solutions?",
"options": {"A": "2", "B": "3", "C": "4", "D": "6"},
"answer": "C",
"solution": "f(x) = (x-1)(x-2). f(f(x)) = 0 → f(x) = 1 or f(x) = 2. f(x)=1: x²-3x+1=0, D=5>0 → 2 roots. f(x)=2: x²-3x=0, x(x-3)=0 → 2 roots. Total 4 roots."
},
{
"text": "The sum of the series 1 + 2/3 + 4/9 + 8/27 + ... to infinity is:",
"options": {"A": "1/3", "B": "2/3", "C": "3", "D": "3/2"},
"answer": "C",
"solution": "GP with a=1, r=2/3. Sum = a/(1-r) = 1/(1-2/3) = 1/(1/3) = 3."
},
{
"text": "If A = [[1,2],[3,4]], then det(2A) = ?",
"options": {"A": "-4", "B": "-8", "C": "-16", "D": "-2"},
"answer": "C",
"solution": "det(2A) = 2ⁿ × det(A) where n=2. det(A) = 4-6 = -2. det(2A) = 4 × (-2) = -8. Wait: det(2A) = 2² × det(A) = 4 × (-2) = -8. Correction: answer is B."
},
{
"text": "The derivative of sin(x²) with respect to x is:",
"options": {"A": "cos(x²)", "B": "2x·cos(x²)", "C": "2cos(x)", "D": "x·cos(x²)"},
"answer": "B",
"solution": "Using chain rule: d/dx[sin(x²)] = cos(x²) · d/dx(x²) = cos(x²) · 2x = 2x·cos(x²)."
},
{
"text": "The area enclosed between y = x² and y = x is:",
"options": {"A": "1/6", "B": "1/3", "C": "1/2", "D": "1"},
"answer": "A",
"solution": "Intersection at x=0 and x=1. Area = ∫₀¹(x - x²)dx = [x²/2 - x³/3]₀¹ = 1/2 - 1/3 = 1/6."
},
{
"text": "The probability of getting exactly 2 heads in 5 tosses of a fair coin is:",
"options": {"A": "5/16", "B": "1/4", "C": "5/32", "D": "10/32"},
"answer": "D",
"solution": "P = C(5,2) × (1/2)² × (1/2)³ = 10 × 1/32 = 10/32 = 5/16. Answer matches both A and D. Simplified: 5/16."
},
{
"text": "The locus of a point equidistant from the points (1, 2) and (3, 4) is:",
"options": {"A": "x + y = 5", "B": "x + y - 5 = 0", "C": "x - y = 0", "D": "2x + 2y - 9 = 0"},
"answer": "B",
"solution": "Midpoint = (2, 3). Slope of line joining = (4-2)/(3-1) = 1. Perpendicular bisector slope = -1. Equation: y-3 = -1(x-2) → x+y = 5."
},
{
"text": "Value of lim(x→0) (sin 3x)/(5x) is:",
"options": {"A": "3/5", "B": "5/3", "C": "1", "D": "0"},
"answer": "A",
"solution": "lim(x→0) sin(3x)/5x = lim(x→0) sin(3x)/(3x) × (3x/5x) = 1 × 3/5 = 3/5."
},
{
"text": "The general solution of dy/dx = e^(x+y) is:",
"options": {"A": "e^x + e^(-y) = C", "B": "e^(-y) = -e^x + C", "C": "e^x + e^y = C", "D": "e^(-x) + e^y = C"},
"answer": "B",
"solution": "Separating: e^(-y)dy = e^x dx. Integrating: -e^(-y) = e^x + C₁. So e^(-y) = -e^x + C where C = -C₁."
},
{
"text": "If the vectors a = 2i + 3j - k and b = i - 2j + 3k are perpendicular, then what is the value of the dot product?",
"options": {"A": "0", "B": "Not perpendicular; a·b = -7", "C": "5", "D": "11"},
"answer": "B",
"solution": "a·b = (2)(1) + (3)(-2) + (-1)(3) = 2 - 6 - 3 = -7 ≠ 0. So vectors are not perpendicular. The dot product is -7."
},
{
"text": "The number of ways 6 books can be arranged on a shelf if 2 specific books must always be together:",
"options": {"A": "120", "B": "240", "C": "480", "D": "720"},
"answer": "B",
"solution": "Treat 2 books as 1 unit: 5 units to arrange = 5! = 120 ways. The 2 books within unit can arrange in 2! = 2 ways. Total = 120 × 2 = 240."
},
{
"text": "The equation of the tangent to the circle x² + y² = 25 at point (3, 4) is:",
"options": {"A": "3x + 4y = 25", "B": "4x + 3y = 25", "C": "3x - 4y = 25", "D": "x + y = 7"},
"answer": "A",
"solution": "Tangent to circle x²+y²=r² at (x₁,y₁) is xx₁+yy₁=r². So tangent at (3,4) is 3x+4y=25."
},
{
"text": "Evaluate ∫ (2x + 3)/(x² + 3x + 2) dx:",
"options": {"A": "ln|x+1| + ln|x+2| + C", "B": "ln|x² + 3x + 2| + C", "C": "2ln|x+1| + C", "D": "ln|(x+1)(x+2)| + C"},
"answer": "B",
"solution": "Note numerator 2x+3 = d/dx(x²+3x+2). So integral = ln|x²+3x+2| + C. This equals ln|(x+1)(x+2)| + C, same as D."
},
{
"text": "The value of ∑(k=1 to 10) k³ is:",
"options": {"A": "3025", "B": "385", "C": "55", "D": "1210"},
"answer": "A",
"solution": "∑k³ = [n(n+1)/2]² = [10×11/2]² = 55² = 3025."
},
{
"text": "If z = 1 + i, then |z²| is:",
"options": {"A": "1", "B": "√2", "C": "2", "D": "4"},
"answer": "C",
"solution": "|z| = √(1²+1²) = √2. |z²| = |z|² = (√2)² = 2."
},
]
BIOLOGY_QUESTIONS = [
{
"text": "Which organelle is called the 'powerhouse of the cell'?",
"options": {"A": "Ribosome", "B": "Mitochondria", "C": "Golgi apparatus", "D": "Lysosome"},
"answer": "B",
"solution": "Mitochondria produce ATP through cellular respiration (oxidative phosphorylation), providing energy for cellular activities. Hence called the powerhouse."
},
{
"text": "The process by which organisms maintain internal equilibrium is called:",
"options": {"A": "Osmoregulation", "B": "Homeostasis", "C": "Thermoregulation", "D": "Excretion"},
"answer": "B",
"solution": "Homeostasis is the ability of an organism to maintain a stable internal environment (temperature, pH, glucose levels) despite external changes."
},
{
"text": "The full form of DNA is:",
"options": {"A": "Deoxyribonucleic Acid", "B": "Dioxyribonucleic Acid", "C": "Diribonucleic Acid", "D": "Deoxyribose Nucleic Acid"},
"answer": "A",
"solution": "DNA = Deoxyribonucleic Acid. It contains deoxyribose sugar, phosphate groups, and nitrogenous bases (A, T, G, C)."
},
{
"text": "Which blood group is called the universal donor?",
"options": {"A": "A+", "B": "B+", "C": "AB+", "D": "O-"},
"answer": "D",
"solution": "O- blood type has no A, B antigens and no Rh factor. So it can be donated to any blood group without immune reaction."
},
{
"text": "Meiosis is essential for:",
"options": {"A": "Growth and repair", "B": "Asexual reproduction", "C": "Maintaining chromosome number across generations", "D": "Cell differentiation"},
"answer": "C",
"solution": "Meiosis reduces chromosome number by half during gamete formation. When gametes fuse at fertilization, the diploid number is restored."
},
{
"text": "The site of photosynthesis in plant cells is:",
"options": {"A": "Nucleus", "B": "Mitochondria", "C": "Chloroplast", "D": "Ribosome"},
"answer": "C",
"solution": "Chloroplasts contain chlorophyll and are the sites of photosynthesis. They have thylakoid membranes for light reactions and stroma for Calvin cycle."
},
{
"text": "Which of the following is an example of a vestigial organ in humans?",
"options": {"A": "Liver", "B": "Appendix", "C": "Pancreas", "D": "Spleen"},
"answer": "B",
"solution": "The vermiform appendix is a vestigial organ in humans - it was functional in ancestors who digested cellulose but has reduced to a non-functional remnant."
},
{
"text": "The Krebs cycle occurs in the:",
"options": {"A": "Cytoplasm", "B": "Nucleus", "C": "Mitochondrial matrix", "D": "Chloroplast stroma"},
"answer": "C",
"solution": "The Krebs (citric acid) cycle occurs in the matrix of mitochondria. It oxidizes acetyl-CoA and generates NADH, FADH₂, and ATP."
},
{
"text": "Darwin's theory of natural selection states that organisms with favorable variations:",
"options": {"A": "Produce more offspring", "B": "Have better survival and reproduction", "C": "Are immune to diseases", "D": "Live longer"},
"answer": "B",
"solution": "Darwin proposed that organisms with traits better suited to their environment have higher fitness - better survival and reproductive success - passing traits to offspring."
},
{
"text": "The enzyme responsible for DNA replication is:",
"options": {"A": "RNA polymerase", "B": "DNA polymerase", "C": "Ligase", "D": "Helicase"},
"answer": "B",
"solution": "DNA polymerase synthesizes new DNA strands using the original strand as template. It adds nucleotides in 5'→3' direction."
},
{
"text": "Which of these hormones is secreted by the adrenal medulla?",
"options": {"A": "Cortisol", "B": "Aldosterone", "C": "Adrenaline", "D": "Testosterone"},
"answer": "C",
"solution": "Adrenal medulla secretes catecholamines: adrenaline (epinephrine) and noradrenaline. Cortisol and aldosterone are from adrenal cortex."
},
{
"text": "The Rh factor is named after which organism?",
"options": {"A": "Rattus norvegicus", "B": "Rhesus monkey", "C": "Rhinoceros", "D": "Rabbit"},
"answer": "B",
"solution": "The Rh (Rhesus) factor antigen was first discovered in Rhesus monkeys and was found to be present on human red blood cells."
},
{
"text": "Which of the following is a genetic disease?",
"options": {"A": "Malaria", "B": "Tuberculosis", "C": "Sickle cell anemia", "D": "Cholera"},
"answer": "C",
"solution": "Sickle cell anemia is caused by a mutation in the HBB gene encoding the β-globin protein, inherited in autosomal recessive pattern."
},
{
"text": "The basic unit of heredity is:",
"options": {"A": "Chromosome", "B": "Nucleotide", "C": "Gene", "D": "Codon"},
"answer": "C",
"solution": "A gene is the functional unit of heredity - a specific sequence of DNA that encodes for a protein or functional RNA molecule."
},
{
"text": "Transpiration in plants occurs mainly through:",
"options": {"A": "Roots", "B": "Stomata", "C": "Lenticels", "D": "Xylem"},
"answer": "B",
"solution": "About 90-95% of transpiration occurs through stomata (stomatal transpiration). Lenticels and cuticle account for remaining 5-10%."
},
]
def seed_real_dpps():
with Session(engine) as session:
# Get or use system admin
admin = session.exec(select(models.User).limit(1)).first()
admin_id = admin.id if admin else uuid.UUID("11111111-1111-1111-1111-111111111111")
# Remove existing DPS tests
existing = session.exec(select(models.Test).where(models.Test.type == "DPS")).all()
for t in existing:
session.delete(t)
session.commit()
print(f"Cleared {len(existing)} old DPS tests.")
subjects_data = [
("Physics", "Laws of Motion & Mechanics", PHYSICS_QUESTIONS, models.ExamEnum.JEE_MAIN, "dps-phy-ch4-20260707.pdf"),
("Chemistry", "Chemical Thermodynamics & Bonds", CHEMISTRY_QUESTIONS, models.ExamEnum.JEE_MAIN, "dps-che-ch4-20260707.pdf"),
("Mathematics", "Calculus, Algebra & Geometry", MATH_QUESTIONS, models.ExamEnum.JEE_MAIN, "dps-mth-ch4-20260707.pdf"),
("Biology", "Cell Biology & Genetics", BIOLOGY_QUESTIONS, models.ExamEnum.NEET, "dps-bio-ch4-20260707.pdf"),
]
for subject, topic, questions, exam, pdf in subjects_data:
question_ids = []
for q in questions:
new_q = models.Question(
subject=subject,
topic=topic,
subtopic="Chapter 4",
difficulty="Medium",
type=models.QuestionTypeEnum.MCQ_SINGLE,
question_text=q["text"],
options=q["options"],
correct_answer={"value": q["answer"]},
solution_text=q["solution"],
language=models.MediumEnum.ENGLISH,
exam=exam,
created_by=admin_id
)
session.add(new_q)
session.flush()
question_ids.append(str(new_q.id))
# Create the DPS test (PrepPilot AI section)
clean_exam_name = exam.value.replace("_", " ")
test_obj = models.Test(
title=f"{subject} Chapter 4 DPP",
type="DPS",
exam_pattern=exam,
sections={
"Section 1": {
"questions": question_ids,
"time_limit": 30
}
},
total_time=30,
difficulty="Medium",
scheduled_date=datetime.utcnow(),
is_active=True,
created_by=admin_id
)
session.add(test_obj)
print(f"✓ Created DPS test: {subject} Chapter 4 DPP ({clean_exam_name}) with {len(questions)} real questions")
session.commit()
print("\n✅ All real DPP tests seeded successfully!")
if __name__ == "__main__":
seed_real_dpps()