61 lines
2.0 KiB
Python
61 lines
2.0 KiB
Python
import json
|
|
import uuid
|
|
import random
|
|
|
|
subjects = ["Physics", "Chemistry", "Mathematics"]
|
|
types = ["Single_Choice", "Multiple_Choice", "Numerical"]
|
|
|
|
questions = []
|
|
|
|
for subject in subjects:
|
|
for i in range(30):
|
|
q_type = types[i % 3] # Distribute 10 Single, 10 Multi, 10 Num
|
|
|
|
q = {
|
|
"id": str(uuid.uuid4()),
|
|
"section": "General",
|
|
"subject": subject,
|
|
"topic": f"{subject} Topic {i//5 + 1}",
|
|
"subtopic": f"{subject} Subtopic {(i%5) + 1}",
|
|
"difficulty": random.choice(["Medium", "Hard"]),
|
|
"type": q_type,
|
|
"language": "English"
|
|
}
|
|
|
|
if q_type == "Single_Choice":
|
|
q["question_text"] = f"A sample Single Choice question for {subject} #{i+1}."
|
|
q["options"] = {
|
|
"A": "Option 1",
|
|
"B": "Option 2",
|
|
"C": "Option 3",
|
|
"D": "Option 4"
|
|
}
|
|
q["correct_answer"] = {"value": "A"}
|
|
q["solution_text"] = "Explanation for this single choice question."
|
|
|
|
elif q_type == "Multiple_Choice":
|
|
q["question_text"] = f"Which of the following are correct for {subject} #{i+1}?"
|
|
q["options"] = {
|
|
"A": "Statement P is correct",
|
|
"B": "Statement Q is incorrect",
|
|
"C": "Statement R is correct",
|
|
"D": "Statement S is incorrect"
|
|
}
|
|
q["correct_answer"] = {"value": ["A", "C"]}
|
|
q["solution_text"] = "A and C are correct because..."
|
|
|
|
elif q_type == "Numerical":
|
|
q["question_text"] = f"Calculate the required value for {subject} #{i+1}."
|
|
q["options"] = None
|
|
q["correct_answer"] = {"value": "42.5"}
|
|
q["solution_text"] = "Applying the formula yields 42.5."
|
|
|
|
questions.append(q)
|
|
|
|
payload = questions
|
|
|
|
with open("jee_advanced_full_90q.json", "w") as f:
|
|
json.dump(payload, f, indent=2)
|
|
|
|
print("Generated jee_advanced_full_90q.json")
|