QuestionQ73

VerifiedExceptions

What output is expected from the following code when the file named non_zero_length_existing_text_file is a non-zero-length file in the working directory?

Question Image

Explanation

read(1) returns one character when the file is non-empty and can be opened successfully. Therefore, len(d) is 1, which is printed; the exception handler is not executed.

Community Discussion

No comments yet. Be the first to start the discussion!