nerdexam
Python_Institute

PCAP-31-03 · Question #39

What is the expected output of the following code if the file named non_zero_length_existing_text_file is a non-zero length file located inside the working directory?

The correct answer is C. an errno value corresponding to file not found. The code doesn't mention the string for a directory if the non-zero length file is located inside of it. So it will be a file not found error.

Technology and architecture

Question

What is the expected output of the following code if the file named non_zero_length_existing_text_file is a non-zero length file located inside the working directory?

Exhibit

PCAP-31-03 question #39 exhibit

Options

  • A0
  • B-1
  • Can errno value corresponding to file not found
  • D1

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    84% (21)
  • D
    8% (2)

Explanation

The code doesn't mention the string for a directory if the non-zero length file is located inside of it. So it will be a file not found error.

Topics

#file I/O#errno#working directory#exception handling

Community Discussion

No community discussion yet for this question.

Full PCAP-31-03 Practice