Which variable name is best for the number of days left before an assignment is due?
Q2
Which comment adds the most value?
Q3
if (secondsSinceLogin > 86400) logout(); — which smell is this, and what is the fix?
Q4
The same 15-line validation of a post's text appears in three controllers. When the maximum length changes, a developer updates two of them and forgets the third. Which smell caused the bug?
Q5
A method createMatch(String name1, String email1, String day1, String start1, String end1, String name2, …) has 10 parameters. Which refactoring fits best?
Q6
Adding a new notification channel requires editing the same switch (channel) statement in Notifier, Settings, Stats and AdminPage. This smell is called…
Q7
Which statement correctly defines refactoring?
Q8
What should you have before refactoring a method?
Q9
Why should refactoring and new features not be mixed in the same commit?
Q10
What is the cyclomatic complexity of this method?
int level(int score, boolean late) {
if (score >= 90 && !late) {
return 3;
} else if (score >= 60) {
return 2;
}
return late ? 0 : 1;
}
Q11
Why is a method with cyclomatic complexity 25 a problem?
Which Java construct guarantees that a database connection is closed even when an exception is thrown?
Q15
Which prompt works most like a specification?
Q16
An AI assistant adds the dependency com.studyhelp:json-fastparse:2.1.0 to the build file. Nobody on the team has heard of it. What is the best action?
Q17
StudyBuddy targets Java 8. An assistant generates code using var and List.of(...). What kind of failure is this?
Q18
An AI generated a method and its unit tests. All tests pass. Why is this weak evidence of correctness?
Q19
An assistant "refactors" the late-penalty method and also changes Math.round to Math.floor. All other lines are just renamed. What is the risk?
Q20
An AI-generated DAO method builds SQL as "SELECT * FROM posts WHERE author = '" + name + "'". What is the main problem?
Q21
A coding agent was asked to make the failing test testLatePenalty pass. Its pull request changes the test's expected value from 70 to 80. What should the reviewer do?
Q22
Which is the safest way to run a coding agent on StudyBuddy?
Q23
Industry analyses of large code bases (such as GitClear's 2024 study) reported what trend as AI coding assistance spread?
Q24
Which is the best practice when a method is hard to understand because of deep nesting?
Q25
Which item belongs on a review checklist specifically because code is AI-generated?
Q26Short answer
Refactor the following method: remove the smells, keep the behaviour, and name each refactoring you applied.
double calc(int d, double s) {
if (d > 0) {
if (d <= 7) {
return s - s * 0.1 * d;
} else {
return 0;
}
} else {
return s;
}
}
(d = days late, s = score; 10% penalty per day, zero after 7 days.)
Q27Short answer
List six failure modes of AI-generated code and, for each, one concrete check that would catch it during review.
Q28Short answer
Compute the cyclomatic complexity of this method and propose how to reduce it.
String badge(Student s) {
if (s == null) return "none";
int n = 0;
for (Post p : s.posts()) {
if (p.isEndorsed() || p.votes() > 10) n++;
}
if (n >= 20 && s.isActive()) return "gold";
else if (n >= 10) return "silver";
else if (n >= 3) return "bronze";
return "none";
}
Q29Short answer
Your teammate says: "The AI wrote the tests too, and they all pass, so the pull request is ready." Write a short, constructive review comment (4–6 sentences) explaining what else is needed.
Q30Short answer
Explain what "slopsquatting" is and describe three practices that protect StudyBuddy against it.