GET /api/generate-quiz?description={description}&numQuestions={numQuestions}description(required): A brief description of the topic to generate quiz questions for (e.g., "Basics of variables in Rust programming language").numQuestions(optional): The number of questions you want in the quiz (e.g., 4) and default is 5.
GET /api/generate-quiz?description=Basics%20of%20variables%20in%20rust%20programming%20language&numQuestions=4{
"description": "Basics of variables in rust programming language",
"numQuestions": "4",
"quiz": [
{
"question": "What keyword is used to declare a variable in Rust?",
"options": ["var", "let", "const", "variable"],
"answer": "let"
},
{
"question": "Which statement is true about mutability of variables in Rust?",
"options": [
"All variables are mutable by default.",
"Variables are immutable by default, and can be made mutable using the `mut` keyword.",
"Variables are always immutable.",
"Mutability is determined at runtime."
],
"answer": "Variables are immutable by default, and can be made mutable using the `mut` keyword."
},
{
"question": "What will happen if you try to reassign a value to an immutable variable?",
"options": [
"The program will run without any errors.",
"A runtime error will occur.",
"A compile-time error will occur.",
"The value will be silently overwritten."
],
"answer": "A compile-time error will occur."
},
{
"question": "What is the difference between `let` and `const`?",
"options": [
"There is no difference; they are interchangeable.",
"`let` declares a mutable variable, `const` declares an immutable variable.",
"`let` declares a variable that can be reassigned, `const` declares a constant whose value must be known at compile time.",
"`const` declares a variable, `let` declares a constant."
],
"answer": "`let` declares a variable that can be reassigned, `const` declares a constant whose value must be known at compile time."
}
]
}