Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Cisco Certified DevNet Associate (DEVASC) · Cisco
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
"c" should be the correct answer as Functions can contain loops. In fact, embedding loops within functions is an efficient way to get rid of repeated code snippets.
Incorrect Answers A - This would have been correct had the phrase "by removing unnecessary tests" not been included. Code refactor has nothing to do with removing tests. Rather is is about cleaning up the code for better code quality. B - This is very easy to deduce as being incorrect. D - While this may seem correct (in the sense that it organises code to make it simpler), for the question the issue is that "there are many lines of code to do a seemingly simple task repeatedly"...With the issue being that a simple task is done '"repeatedly", even if a loop is used to shorten the code, it will be used over and over again (and this loop could still still include a number of lines). Following from this therefore, a function is defined for the task that is to be done repeatedly, and then invoked/called when the task should be done. Thus correct answer is C.
Answer should be C. Functions are used to avoid repetitions