Asked by Katlin Briggs on May 12, 2024
Verified
To read data from a file of unspecified length, an EOF-controlled while loop is a better choice than a counter-controlled while loop.
EOF-controlled
EOF-controlled loops continue to execute until the End of File (EOF) is reached, typically used in file reading operations to process each element until the file ends.
Counter-controlled
Relates to loops or iterations that are controlled or managed by a counter variable which dictates the number of times the loop will execute.
- Acquire knowledge on the utilization of looping constructs to facilitate data reading until a predetermined sentinel value or the EOF is reached.
Verified Answer
YH
Yasir HussainMay 15, 2024
Final Answer :
True
Explanation :
An EOF-controlled while loop uses the end-of-file marker to determine when to stop reading, making it a more efficient and scalable option when the length of the file is unknown. A counter-controlled while loop requires a pre-determined limit, which may not be applicable in this scenario.
Learning Objectives
- Acquire knowledge on the utilization of looping constructs to facilitate data reading until a predetermined sentinel value or the EOF is reached.