Unit 6 File Handling

5th sem New Syllabus

Unit 6 File Handling

1 / 14

How do you check if a file exists before trying to open it ?

2 / 14

Which of the following is the default mode for opening a file in Python?

3 / 14

What does the mode 'w' do when opening a file?

4 / 14

If a file is opened in 'a' mode, what happens if the file does not exist?

5 / 14

What does the 'b' character signify when opening a file?

6 / 14

Which method is used to read the entire content of a file as a string?

7 / 14

Which method is used to read a single line from a file?

8 / 14

To write a list of strings to a file, which method would you use?

9 / 14

Which method can be used to ensure all changes are saved to a file?

10 / 14

Which of the following functions is used to get the current working directory?

11 / 14

How do you rename a file using the os module?

12 / 14

Which method from the os module is used to create a directory?

13 / 14

Which of the following is a correct usage of the with statement to open a file for reading?

14 / 14

how do you open a file for both reading and writing (without truncating the file)?

Your score is

The average score is 0%

0%


python (1)python (2)python (3)python (4)python (5)python (6)python (7)python (8)python (9)python (10)python (11)python (12)

Leave a Reply

Your email address will not be published. Required fields are marked *