backend-quiz
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesebackend-quiz - Kotlin/Spring Backend Quiz
backend-quiz - Kotlin/Spring后端测试题
Adaptive quiz and coding exercises for Kotlin/Spring backend.
针对Kotlin/Spring后端的自适应测试题与编程练习。
Instructions
使用说明
Give a Kotlin/Spring backend quiz. Difficulty adjusts automatically based on the learner's level.
生成一套Kotlin/Spring后端测试题,难度会根据学习者的水平自动调整。
Step 0: Language Selection
步骤0:语言选择
Ask the user to choose a language at the start using AskUserQuestion:
questions:
- question: "Which language do you prefer? / 어떤 언어로 진행할까요?"
header: "Language"
options:
- label: "한국어"
description: "한국어로 퀴즈를 풉니다"
- label: "English"
description: "Take the quiz in English"
multiSelect: falseUse the selected language for all communication. Code and Kotlin/Spring keywords stay in English.
在开始时使用AskUserQuestion询问用户选择语言:
questions:
- question: "Which language do you prefer? / 어떤 언어로 진행할까요?"
header: "Language"
options:
- label: "한국어"
description: "한국어로 퀴즈를 풉니다"
- label: "English"
description: "Take the quiz in English"
multiSelect: false所有沟通都使用用户选择的语言。代码与Kotlin/Spring相关关键字保持英文。
Step 1: Choose Quiz Topic
步骤1:选择测试主题
Ask in plain text:
Korean:
"어떤 주제로 퀴즈를 풀까요? 주제를 알려주세요. 뭘 할지 모르겠으면 '추천해줘'라고 해주세요."
English:
"What topic should the quiz cover? Tell me a topic, or say 'recommend' if you're not sure."
- If the user enters a topic: start the quiz on that topic.
- If the user says "recommend" / "추천해줘": check learning history (BackendLearningProgress in memory) and suggest 3-4 recently studied topics. Present choices via AskUserQuestion.
用纯文本询问:
韩语:
"어떤 주제로 퀴즈를 풀까요? 주제를 알려주세요. 뭘 할지 모르겠으면 '추천해줘'라고 해주세요."
英语:
"What topic should the quiz cover? Tell me a topic, or say 'recommend' if you're not sure."
- 如果用户输入一个主题:开始该主题的测试。
- 如果用户说“recommend” / "추천해줘":查看学习历史(内存中的BackendLearningProgress)并推荐3-4个近期学习的主题。通过AskUserQuestion呈现选项。
Step 2: Run the Quiz (5 questions)
步骤2:运行测试(5道题)
5 questions total. Track difficulty internally from 1-5 (start at 3).
- Correct answer -> difficulty +1
- Wrong answer -> difficulty -1
共5道题目。内部跟踪难度等级1-5(初始为3)。
- 回答正确 → 难度+1
- 回答错误 → 难度-1
Question Types
题型
Each question uses one of the types below. Default to open-ended, mix in others as appropriate.
每个题目使用以下题型之一。默认使用开放式题型,酌情混合其他题型。
Type A: Predict Output (open-ended)
题型A:预测输出(开放式)
What does this code return? Explain your answer.
@Transactional
fun transfer(from: Long, to: Long, amount: Int) {
val sender = accountRepository.findById(from).orElseThrow()
val receiver = accountRepository.findById(to).orElseThrow()
sender.balance -= amount
receiver.balance += amount
}
// What happens if amount > sender.balance?The user types their own answer.
What does this code return? Explain your answer.
@Transactional
fun transfer(from: Long, to: Long, amount: Int) {
val sender = accountRepository.findById(from).orElseThrow()
val receiver = accountRepository.findById(to).orElseThrow()
sender.balance -= amount
receiver.balance += amount
}
// What happens if amount > sender.balance?用户需自行撰写答案。
Type B: Find the Bug (open-ended)
题型B:查找漏洞(开放式)
What's wrong with this code? Explain the issue.
@RestController
class UserController(private val userService: UserService) {
@GetMapping("/users/{id}")
fun getUser(@PathVariable id: Long): User {
return userService.findById(id) // returns null if not found
}
}The user types their own answer.
What's wrong with this code? Explain the issue.
@RestController
class UserController(private val userService: UserService) {
@GetMapping("/users/{id}")
fun getUser(@PathVariable id: Long): User {
return userService.findById(id) // returns null if not found
}
}用户需自行撰写答案。
Type C: Concept Question (multiple-choice allowed)
题型C:概念题(可使用选择题)
What is the default propagation level of @Transactional in Spring?Present 4 choices via AskUserQuestion. Multiple-choice is fine for concept checks.
What is the default propagation level of @Transactional in Spring?通过AskUserQuestion呈现4个选项。概念检查可使用选择题。
Type D: Write Code (difficulty 4+ only)
题型D:编写代码(仅难度4及以上)
Write a REST endpoint that meets these requirements:
- POST /api/users
- Accepts a JSON body with name (String) and email (String)
- Validates that email contains '@'
- Returns 201 Created with the saved user
- Returns 400 Bad Request if validation failsThe user writes their own code solution.
Write a REST endpoint that meets these requirements:
- POST /api/users
- Accepts a JSON body with name (String) and email (String)
- Validates that email contains '@'
- Returns 201 Created with the saved user
- Returns 400 Bad Request if validation fails用户需自行编写代码解决方案。
Feedback Rules
反馈规则
On correct answer:
Correct!
Key point: @Transactional with default propagation (REQUIRED) joins
the existing transaction or creates a new one if none exists.On wrong answer:
Give a short text explanation. Only use ASCII diagrams for things like request flows or architecture that are hard to explain in text alone.
Not quite. The answer is "REQUIRED".
REQUIRED means: if a transaction exists, join it; if not, create a new one.
This is the most common behavior and Spring's default.回答正确时:
Correct!
Key point: @Transactional with default propagation (REQUIRED) joins
the existing transaction or creates a new one if none exists.回答错误时:
提供简短的文字解释。仅在需要解释请求流程或架构等难以用文字说明的内容时使用ASCII图。
Not quite. The answer is "REQUIRED".
REQUIRED means: if a transaction exists, join it; if not, create a new one.
This is the most common behavior and Spring's default.Step 3: Results Summary
步骤3:结果总结
After all 5 questions, show a summary:
Quiz Results
- Topic: Spring Transaction Management
- Score: 3/5
- Final difficulty: 4/5
- Strengths: @Transactional basics, isolation levels
- Needs work: Propagation types, rollback rules
- Suggestion: Review "transaction propagation" with /backend-study完成所有5道题后,展示总结:
Quiz Results
- Topic: Spring Transaction Management
- Score: 3/5
- Final difficulty: 4/5
- Strengths: @Transactional basics, isolation levels
- Needs work: Propagation types, rollback rules
- Suggestion: Review "transaction propagation" with /backend-studyRules
规则
- Use the selected language - from Step 0. Only code and keywords in English.
- One question at a time - next question only after the current one is answered
- Open-ended by default - the user must think and write answers. Multiple-choice OK for concept checks.
- ASCII diagrams only when needed - default to text explanations
- Adaptive difficulty - adjust to the learner's level automatically
- Encouraging tone - wrong answers are learning opportunities
- No emojis - clean text only
- 使用选定语言 - 来自步骤0。仅代码和关键字使用英文。
- 一次一题 - 只有当前题目回答完成后才会展示下一题
- 默认开放式题型 - 用户必须思考并撰写答案。概念检查可使用选择题。
- 仅必要时使用ASCII图 - 默认使用文字解释
- 自适应难度 - 根据学习者的水平自动调整
- 鼓励性语气 - 错误的答案是学习的机会
- 禁止使用表情符号 - 仅使用简洁文本