CS FundamentalsModerateAccenture · Capgemini technical pattern
In Test-Driven Development, what is the correct order of the basic cycle?
- A. Write code → write tests → refactor
- B. Refactor → write a failing test → write code
- C. Write a failing test → write just enough code to pass → refactor
- 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.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A project faces three risks: A: probability 0.3, loss ₹5 lakh B: probability 0.6, loss ₹2 lakh C: probability 0.1, loss ₹12 lakh Ranking…
- A team commits 40 story points to a 10-day sprint. After day 6, the burndown chart shows 28 points remaining. If work continues at the…
- A library following Semantic Versioning is at version 2.4.7. The next release removes a public method that clients may be calling. What…
- A bug exists at the current commit but not at a commit 200 commits earlier. Using git bisect (a binary search through history), what is…
- What distinguishes continuous deployment from continuous delivery?
- In a unit test, the real payment gateway is replaced by an object that records calls so that the test can assert “charge() was called…