Automating Test Generation with NotebookLM, Gemini, and Apps Script
Generating dozens of tests for students or self-study requires automation. The combination of NotebookLM, Gemini, Google Drive, and Google Apps Script enables creating accurate tests based on trusted sources—reducing manual effort and AI hallucinations. This workflow uses local notebooks to generate questions and scripts to import them into Google Forms.
Tests do more than assess knowledge—they reinforce memory through the testing effect. When learners actively recall information, they slow down the forgetting curve and significantly improve long-term retention.
The Testing Effect in Learning
Testing outperforms passive review when it comes to memory retention. Psychologists call this the "testing effect": the mental effort required to retrieve information strengthens neural connections. In Make It Stick, Peter Brown emphasizes that tests build a foundation for creative thinking.
The forgetting curve shows that without review, knowledge fades quickly. Spaced quizzes on core concepts (theory, fundamentals) help overcome this. For complex topics, manual refinement remains essential—but simple test creation can be fully automated.
Tools and Automation Workflow
NotebookLM creates a secure local workspace with uploaded sources—eliminating hallucinations by limiting AI to your provided materials. Choose high-quality inputs: textbooks, lecture notes, research articles.
Prompt for NotebookLM: "Generate a test with 10–15 multiple-choice questions (4 options each) based on the provided sources. Include correct answers. Format: question, options A–D, answer key." Copy the output into structured text.
Next, Gemini generates a Google Apps Script to import questions into a form. The script builds a quiz with automatic grading.
Example Script for Form Creation
function createCSForm() {
const folderId = "1CxqAry-CvwVFRQFldSt_dw_9Oymz1JAY";
const formTitle = "Test: Section 1. Data Storage (Computer Science)";
// Create a new form
const form = FormApp.create(formTitle);
form.setIsQuiz(true);
const questions = [
{q: "What are the digits 0 and 1 called, used to encode information at the lowest level?", options: ["Bytes", "Bits", "Gates", "Triggers"], correct: "Bits"},
{q: "Which logic operation returns 1 only when both inputs are 1?", options: ["AND", "OR", "XOR", "NOT"], correct: "AND"},
{q: "What computer component stores one bit using electronic circuits?", options: ["Gate", "Trigger", "Magnetic disk", "Bus"], correct: "Trigger"},
{q: "How many bits are in one byte?", options: ["4", "8", "16", "32"], correct: "8"},
{q: "What is the numbering system using symbols 0–9 and A–F?", options: ["Binary", "Decimal", "Hexadecimal", "Octal"], correct: "Hexadecimal"},
{q: "In what unit is a memory cell's address measured in main computer memory?", options: ["Bits", "Gigabytes", "It's a unique numeric identifier", "Processor frequency"], correct: "It's a unique numeric identifier"},
{q: "Which type of memory loses data when power is turned off?", options: ["Hard drive (HDD)", "Flash drive", "Main memory (RAM)", "Compact disc"], correct: "Main memory (RAM)"},
{q: "What is the term for tracks on different platters of a hard drive located at the same distance from the center?", options: ["Sector", "Cylinder", "Cluster", "Spiral"], correct: "Cylinder"},
{q: "Which mass storage type uses lasers to read data?", options: ["Magnetic disk", "Solid-state drive (SSD)", "Optical systems (CD/DVD)", "Registers"], correct: "Optical systems (CD/DVD)"},
{q: "What is ASCII used for?", options: ["Video compression", "Representing text characters", "Calculating fractions", "Virus protection"], correct: "Representing text characters"},
{q: "Which text encoding system supports characters from most languages worldwide?", options: ["ASCII", "Unicode", "ISO", "Binary code"], correct: "Unicode"},
{q: "What is the method of image coding using a grid of small dots?", options: ["Vector", "Raster (bitmap)", "Geometric", "Streaming"], correct: "Raster (bitmap)"},
{q: "What does 'sampling' mean in the context of sound?", options: ["Noise removal", "Measuring wave amplitude at regular intervals", "Increasing volume", "Converting sound to text"], correct: "Measuring wave amplitude at regular intervals"}
];
}
Paste the script into the Apps Script editor and link it to Google Drive. After running, the form appears in the specified folder with quiz mode enabled.
Implementation Steps
- Source Preparation: Upload materials to your NotebookLM notebook. Ensure quality and relevance.
- Question Generation: Use the prompt to generate a test. Verify coherence and accuracy.
- Script via Gemini: Input the questions into Gemini with the request: "Create a Google Apps Script for Google Forms."
- Deployment: Run the script and test the form.
- Scaling: Repeat for new topics, refining prompts as needed.
This approach cuts test creation time from hours to minutes. For mid-to-senior developers: integrate into CI/CD pipelines for corporate training or automate via NotebookLM’s API.
Key Takeaways
- NotebookLM reduces hallucinations by working only with uploaded sources.
- The testing effect improves retention by 50–100% compared to re-reading.
- Google Apps Script enables auto-graded quizzes and result export.
- Ideal for foundational topics; complex questions still need manual review.
- Highly scalable for self-learning or teaching large groups.
— Editorial Team
No comments yet.