A C++ lab exam practice site. It provides a question bank with difficulty tabs, an in-browser code editor, and real C++ execution against hidden test cases.
Live: https://aryan2-7.github.io/CompLabPass/
- 20-question bank organized into All / Easy / Medium / Hard tabs
- Runs each test case against your code and shows pass/fail per test
- Animated pixel-art cat that reflects compile/run state (working, passed, failed, error) and falls asleep after inactivity
- Progress tracking ("X/Y questions") that persists between visits
- Per-question code autosave in localStorage
The browser does not compile C++. Code is POSTed to tio.run, a free, keyless
API with CORS support, which compiles with g++ and returns stdout plus the
exit code. See src/lib/execute.js for the request/response protocol:
- Request payload is a null-delimited field list identifying the language
(
cpp-gcc) and providing the source file and stdin, compressed with deflate-raw - The response is gzip-compressed and split into stdout and stats sections by a 16-byte separator token
- Compile errors are detected via the
code.tio.cppreference in the stats
- React 19, Vite 8, plain CSS
- Deployed to GitHub Pages via GitHub Actions
- localStorage for persistence
npm install
npm run dev # dev server
npm run build # production build to dist/
npm run preview # preview the build
Edit src/data/questions.js. Each question object has:
id— unique kebab-case slugtitle,difficulty(easy|medium|hard)body,input,output— the problem statementexamples—[{ input, output }]shown to the studentstarterCode— a minimal shell to start fromtests—[{ input, expected }];expectedis the exact expected stdouthint— a short nudge
A question is considered solved when all of its tests pass.
Pushing to main triggers .github/workflows/deploy.yml, which builds the
project and deploys dist/ to GitHub Pages automatically.
src/
components/ TopBar, DifficultyTabs, QuestionList, QuestionPanel, EditorPanel, Cat, Toast
data/ questions.js — question bank
lib/ execute.js (execution API), storage.js (persistence)