Skills101
← All practice quizzes

Quiz: Refactoring with AI

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

AI tools make refactoring fast, and just as fast at quietly changing behaviour. Learn to pin current behaviour with characterization (golden master) tests, ask for one small refactor at a time, and compare old and new code on hundreds of inputs before you accept a change.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    Which of these is a refactor?

  2. Question 2

    What does a characterization (golden master) test check?

  3. Question 3

    What does this print?

    from itertools import product
    cases = list(product([8.0, 9.0], [False, True], [0, 5, 10]))
    print(len(cases))
    
  4. Question 4

    The AI wrote cgpa > 9.0 where the old code had cgpa >= 9.0. Which test input reveals it?

  5. Question 5

    What does this print?

    def old(late_days):
        return min(late_days * 500, 5000) if late_days > 0 else 0
    
    def new(late_days):
        return min(late_days * 500, 5000)
    
    print(old(-2), new(-2))
    
🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →