What happens when the following statement is executed and file1.txt is not present in the current directory?

file_obj = open("file1.txt", "r")

1) Python creates a new file ‘file1.txt’

2) Raises a FileNotFoundError

3) Raises an IOError

4) Does nothing

1
1
2
3
3
4
4
2

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation