200-901 exam dumps

200-901 practice question 10 of 204

Cisco DevNet Associate. Associate level, Cisco. Free question with the correct answer and a full explanation.

200-901 Question 10

Select 3

A development team is building a new API and decides to implement test-driven development (TDD). Which of the following steps correctly describe the TDD workflow?

  1. A

    Write a failing test case for the desired functionality.

  2. B

    Write the full implementation of the feature before writing tests.

  3. C

    Refactor the code after making the test pass.

  4. D

    Ensure all tests pass before moving to the next feature.

  5. E

    Skip writing tests for trivial features to save time.

Show answer and explanation

Correct answers: A, C, D

Explanation

Test-driven development (TDD) is a software development process where tests are written before the actual implementation. The workflow involves writing a failing test case, writing just enough code to make the test pass, and then refactoring the code for improvement while ensuring the test still passes. This iterative process ensures high-quality code and comprehensive testing.

  • A. Correct.

    Correct: In TDD, you start by writing a test case for the functionality you want to implement, ensuring it fails initially because the feature is not yet implemented.

  • B. Incorrect.

    Incorrect: TDD emphasizes writing tests before implementing the feature. Writing the full implementation before tests violates the TDD process.

  • C. Correct.

    Correct: After making the test pass, TDD encourages refactoring to improve code quality while ensuring the test still passes.

  • D. Correct.

    Correct: Ensuring all tests pass is critical in TDD to maintain confidence in the codebase before moving forward.

  • E. Incorrect.

    Incorrect: Skipping tests, even for trivial features, can lead to untested code and potential bugs. TDD advocates testing all aspects of the code.

Timed practice exam

Take a 200-901 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam