WBBSE Physical Science AI Question Answer Generator
English
Bengali
Hindi
Marathi
Gujarati
Tamil
Telugu
Kannada
Malayalam
Punjabi
Class 5
Class 6
Class 7
Class 8
Class 9
Class 10
Easy
Medium
Hard
30
50
80
100
0%
Question Paper
Answer Key
Model Solution
const API_KEY=”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″;
let savedPaper=””;
let progressInterval;
const syllabus={
“Class 5”:[“Matter Around Us”,”Water and Air”,”Light and Shadow”,”Sound”,”Heat”],
“Class 6”:[“Physical and Chemical Changes”,”Elements Compounds and Mixtures”,”Light”,”Electricity and Circuits”,”Magnetism”],
“Class 7”:[“Heat and Temperature”,”Acids Bases and Salts”,”Motion and Time”,”Electric Current”,”Light Reflection”],
“Class 8”:[“Force and Pressure”,”Friction”,”Chemical Effects of Electric Current”,”Sound”,”Light”],
“Class 9”:[“Matter in Our Surroundings”,”Atoms and Molecules”,”Structure of Atom”,”Motion”,”Force and Laws of Motion”],
“Class 10”:[“Chemical Reactions”,”Acids Bases and Salts”,”Metals and Non-metals”,”Electricity”,”Light Reflection and Refraction”]
};
function loadChapters(){
let cls=document.getElementById(“class”).value;
let ch=document.getElementById(“chapter”);
ch.innerHTML=””;
syllabus[cls].forEach(c=>{
let opt=document.createElement(“option”);
opt.textContent=c;
ch.appendChild(opt);
});
}
loadChapters();
function cleanAIText(text){
return text.replace(/[*#\-]{1,}/g,””).trim();
}
function getDistribution(marks){
if(marks==30) return {mcq:{q:5,m:1}, short:{q:5,m:2}, long:{q:3,m:5}};
if(marks==50) return {mcq:{q:10,m:1}, short:{q:5,m:4}, long:{q:4,m:5}};
if(marks==80) return {mcq:{q:15,m:1}, short:{q:10,m:3}, long:{q:5,m:7}};
if(marks==100) return {mcq:{q:20,m:1}, short:{q:10,m:4}, long:{q:6,m:10}};
}
function startProgress(){
let progress=0;
clearInterval(progressInterval);
progressInterval=setInterval(()=>{
if(progressupdateProgress(0),1000);
}
function updateProgress(value){
document.getElementById(“progressFill”).style.width=value+”%”;
document.getElementById(“progressText”).innerText=value+”%”;
}
async function callAI(prompt){
startProgress();
try{
let response=await fetch(“https://openrouter.ai/api/v1/chat/completions”,{
method:”POST”,
headers:{
“Authorization”:”Bearer “+API_KEY,
“Content-Type”:”application/json”
},
body:JSON.stringify({
model:”openai/gpt-4o-mini”,
temperature:0.2,
messages:[{role:”user”,content:prompt}]
})
});
let data=await response.json();
completeProgress();
return cleanAIText(data.choices[0].message.content);
}catch(e){
completeProgress();
return “AI error”;
}
}
async function generatePaper(){
let marks=parseInt(document.getElementById(“marks”).value);
let dist=getDistribution(marks);
let cls=document.getElementById(“class”).value;
let chapter=document.getElementById(“chapter”).value;
let difficulty=document.getElementById(“difficulty”).value;
let language=document.getElementById(“language”).value;
let prompt=`Create WBBSE Physical Science question paper in ${language}.
Class ${cls}
Chapter ${chapter}
Difficulty ${difficulty}
Full Marks ${marks}
SECTION A ${dist.mcq.q} MCQ ${dist.mcq.m} marks each
SECTION B ${dist.short.q} Short ${dist.short.m} marks each
SECTION C ${dist.long.q} Long ${dist.long.m} marks each
No special symbols. Clean exam format only.`;
savedPaper=await callAI(prompt);
document.getElementById(“paper”).innerText=savedPaper;
document.getElementById(“answer”).innerText=””;
document.getElementById(“solution”).innerText=””;
}
async function generateAnswer(){
if(!savedPaper){alert(“Generate Question Paper first”);return;}
document.getElementById(“answer”).innerText=await callAI(“Generate clean answer key: “+savedPaper);
}
async function generateSolution(){
if(!savedPaper){alert(“Generate Question Paper first”);return;}
document.getElementById(“solution”).innerText=await callAI(“Generate clean model solution: “+savedPaper);
}
function downloadTXT(){
let content=`QUESTION PAPER\n${paper.innerText}\n\nANSWER KEY\n${answer.innerText}\n\nMODEL SOLUTION\n${solution.innerText}`;
let blob=new Blob([content],{type:”text/plain”});
let link=document.createElement(“a”);
link.href=URL.createObjectURL(blob);
link.download=”WBBSE_Physical_Science_Exam.txt”;
link.click();
}
My Name is Sourav Mukherjee. I am a Website Developer and SEO Expart. AllBestTool.com is a browser-based collection of free online utilities — everything from PDF converters and text tools to SEO helpers and calculators. The idea is pretty simple: make a bunch of useful web tools available in one place without requiring users to sign up.