Server Administration
A maintenance script must check every server in a list whose length changes between runs. Which construct should apply the same check to each listed server?
Show the answer
Correct answerA. A foreach loop over the server list
AWhy this is right: A foreach loop visits each listed server and runs the same check for that entry.
BWhy not this: A conditional branch selects whether an action runs; it does not traverse the server list.
CWhy not this: Comparing server names produces a comparison result rather than processing the list.
DWhy not this: Storing the server count does not execute the check for each server.
A foreach loop applies its body to each entry in a collection, accommodating changes in the list's length. A conditional branch selects an action but does not itself repeat that action for every server.