Which type of loop is BEST suited for displaying the names of 10 students in a class from a file?(1 point)Responsesswitch case statementswitch case statementfor loopfor loopdo...while loopdo...while loopwhile loop

1 answer

The best-suited loop for displaying the names of 10 students in a class from a file is a for loop.

A for loop is ideal in this scenario because you know the exact number of iterations (10 students) you need to perform, making it straightforward to use a counter to iterate through each name in the file.

The other loop types (while and do...while) are more suitable for scenarios where the number of iterations is not predetermined or based on a condition.