Which of the following should a server administrator use when writing a script with a function that needs to be run ten times?
Correct Answer: A
Aloopis a programming construct used to repeat a block of code multiple times. In this case, if a function needs to run ten times, a loop (such as afor looporwhile loop) would be the appropriate choice.
* Loop (Answer A):This allows the function to be executed repeatedly without writing redundant code.
* Variable (Option B):A variable is used to store data, but it doesn't handle repetition.
* Comparator (Option C):Comparators are used to compare values, not for repeating code.
* Conditional (Option D):Conditionals (if, else) are used for decision-making, not repeating actions multiple times.
CompTIA Server+ Reference:This topic is related toSK0-005 Objective 1.1: Understand basic scripting and automation concepts.