CS FundamentalsModerateAccenture · Capgemini technical pattern

In Test-Driven Development, what is the correct order of the basic cycle?

  1. A. Write code → write tests → refactor
  2. B. Refactor → write a failing test → write code
  3. C. Write a failing test → write just enough code to pass → refactor
  4. D. Write a passing test → write code → delete the test

Correct answer: C. Write a failing test → write just enough code to pass → refactor

TDD is “red, green, refactor”: start with a failing test that defines the behaviour, make it pass with the simplest code, then clean up while the tests stay green.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic