exam questions

Exam 200-901 All Questions

View all questions & answers for the 200-901 exam

Exam 200-901 topic 1 question 2 discussion

Actual exam question from Cisco's 200-901
Question #: 2
Topic #: 1
[All 200-901 Questions]

Which task is performed because the test-driven development approach is being used?

  • A. creating test scenarios based on continuous development
  • B. writing code without committing any coding violations
  • C. refactoring code that is covered by existing tests
  • D. testing existing software before developing new code
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
CiscoNinja
Highly Voted 4 years, 11 months ago
I would say C
upvoted 29 times
pengyou
4 years, 10 months ago
So confused question. TDD definition says, that "The simple concept of TDD is to write and correct the failed tests before writing new code (before development). " But C also works for me
upvoted 3 times
...
...
[Removed]
Highly Voted 11 months, 2 weeks ago
Selected Answer: C
C. refactoring code that is covered by existing tests
upvoted 12 times
...
samtestking
Most Recent 6 months, 2 weeks ago
test2 test2 test2
upvoted 1 times
...
[Removed]
9 months, 1 week ago
Selected Answer: C
C is right answer.
upvoted 2 times
...
jeanh101
2 years, 10 months ago
Correct answer is, C
upvoted 2 times
...
macxsz
3 years ago
Selected Answer: C
C seems like it feets the most
upvoted 2 times
...
designated
3 years, 4 months ago
I would say C because of the 5 TDD steps: Step 1. Write a test: Write a test that tests for the new class or function that you want to add to your code. Think about the class name and structure you will need in order to call the new capability that doesn’t exist yet—and nothing more. Step 2. Test fails: Of course, the test fails because you haven’t written the part that works yet. The idea here is to think about the class or function you want and test for its intended output. This initial test failure shows you exactly where you should focus your code writing to get it to pass. This is like starting with your end state in mind, which is the most effective way to accomplish a goal. Step 3. Write some code: Write only the code needed to make the new function or class successfully pass. This is about efficiency and focus. Step 4. Test passes: The test now passes, and the code works. Step 5. Refactor: Clean up the code as necessary, removing any test stubs or hard-coded variables used in testing. Refine the code, if needed, for speed. It should be nice to validate the application before making any changes, but it is asking about TDD.. so C is more correct in this case.
upvoted 2 times
...
designated
3 years, 4 months ago
I would say C because of the 5 TDD steps: Step 1. Write a test: Write a test that tests for the new class or function that you want to add to your code. Think about the class name and structure you will need in order to call the new capability that doesn’t exist yet—and nothing more. Step 2. Test fails: Of course, the test fails because you haven’t written the part that works yet. The idea here is to think about the class or function you want and test for its intended output. This initial test failure shows you exactly where you should focus your code writing to get it to pass. This is like starting with your end state in mind, which is the most effective way to accomplish a goal. Step 3. Write some code: Write only the code needed to make the new function or class successfully pass. This is about efficiency and focus. Step 4. Test passes: The test now passes, and the code works. Step 5. Refactor: Clean up the code as necessary, removing any test stubs or hard-coded variables used in testing. Refine the code, if needed, for speed. It should be nice to validate the application before making any changes, but it is asking about TDD.. so C is more correct in this case.
upvoted 1 times
...
Ram0n_Aya1a
3 years, 8 months ago
C is the correct answer If you read the book you will found: "The idea is that you build a test case first, before any software has been created or modified" but "testing existing software before developing new code" is the idea or goal, not the task five steps of TDD: -Write a test -Test fails -Write some code -Test passes -Refactor
upvoted 3 times
...
hottopic
3 years, 8 months ago
TTD == Create test for what you want >> Run test on current code it fails >> Write code >> Run test, test passes >> Refactor. Based on this D and C are correct, but knowing Cisco they keep harping on creating a test first and having it fail.
upvoted 1 times
...
DenskyDen
4 years, 2 months ago
A. does not sound right because in TDD, a test should be created first before any development, so it is the development that will be based on the test. B. is utterly wrong. C. as stated in DEVNET: "Step 5. Refactor: Clean up the code as necessary, removing any test stubs or hardcoded variables used in testing. Refine the code, if needed, for speed" In my opinion, it should be C because in TDD once you create a test, you should develop a code for unit testing which D. is negating.
upvoted 3 times
...
flambadone
4 years, 10 months ago
I really struggle with this one because: A. creating test scenarios based on continuous development *technically - this is true because you write the tests, then prove they fail, then write code that passes the test. B. writing code without committing any coding violations This one is dumb and obviously not the right path. C. refactoring code that is covered by existing tests So according to the answer given in the main question, refactoring is what causes the old tests to fail because you make a change. D. testing existing software before developing new code Technically you're doing this all the time because you test each 'chunk' of code as you write it. I'm guessing that D is the 'most correct' but I can see how A,C, and D all would be correct.
upvoted 8 times
Sliking
4 years, 6 months ago
Refactoring code doesn't make the old tests fails. What you are doing is improving code structure, readability and design. It shouldn't affect in anyway the logic and requirements of the code you already have. I would point to answer C and exclude D because of this.
upvoted 6 times
...
...
Joejimikohn
4 years, 10 months ago
I'm sure it's D
upvoted 4 times
...
radbaver
4 years, 10 months ago
I would say A. From Cisco Devnet course: Testing to validate (or initially, to clarify) design intention in light of requirements implies that we should write testing code before we write application code. Having expressed requirements in our testing code, we can then write application code until tests pass.
upvoted 8 times
...
CiscoRider
4 years, 10 months ago
The answer is C because in a TDD approach, you first write the test-code, test the test-code and then write the production code. You do not test any existing software as is suppose to not exist, yet. Although what you do always through the TDD pipeline is refactor the code for the software that has been tested.
upvoted 7 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...