Direction: Choose the correct option
Q1.
Which function is used to open a file in Python?
Direction: Choose the correct option
Q2.
What does `open('file.txt', 'r')` do?
Direction: Choose the correct option
Q3.
How do you read all lines of a file into a list?
Direction: Choose the correct option
Q4.
What is the correct way to write to a file?
Direction: Choose the correct option
Q5.
What does the `with` statement do in file handling?
Direction: Choose the correct option
Q6.
What mode would you use to open a file for writing, creating if not exists?
Direction: Choose the correct option
Q7.
How do you check if a file exists before opening?
Direction: Choose the correct option
Q8.
What is the difference between 'w' and 'a' modes?
Direction: Choose the correct option
Q9.
What does `f.seek(0)` do?
Direction: Choose the correct option
Q10.
What is the output of `open('test.txt', 'x')` if file already exists?
