0% found this document useful (0 votes)
5 views4 pages

Amity International School, Pushp Vihar Assignment - 5: Chapter 4: File Handling Subject: Computer Science Class: XII Fill in The Blanks

This document is an assignment for Class XII Computer Science at Amity International School, focusing on file handling concepts. It includes fill-in-the-blank questions, true/false statements, and multiple-choice questions related to file modes, operations, and Python's file handling methods. The assignment aims to test students' understanding of file handling in programming.

Uploaded by

Ekansh singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Amity International School, Pushp Vihar Assignment - 5: Chapter 4: File Handling Subject: Computer Science Class: XII Fill in The Blanks

This document is an assignment for Class XII Computer Science at Amity International School, focusing on file handling concepts. It includes fill-in-the-blank questions, true/false statements, and multiple-choice questions related to file modes, operations, and Python's file handling methods. The assignment aims to test students' understanding of file handling in programming.

Uploaded by

Ekansh singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

AMITY INTERNATIONAL SCHOOL, PUSHP VIHAR

ASSIGNMENT – 5 : CHAPTER 4: FILE HANDLING

Subject: Computer Science


Class: XII
Fill in the Blanks:
1. The default file mode is _____________ mode.
2. A ________________ governs the type of operations (eg read/write/append) possible in
the opened file.
3. The two types of data files can be __________ files and ___________ files.
4. The other name for file object is _____________________.
5. The _____________ file mode will open a file for read and write purpose.
6. The _________ file mode will open a file for write and read purpose.
7. To close an open file, _______________method is used.
8. To read all file contents in the form of a list, _____________method is used.
9. To write a list in a file, _______________method may be used.
10. To force Python to write the contents of file buffer on to storage file, ________method
may be used.
11. . To read and write into binary files, _______________ module of Python is used.
12. The ____________ method of pickle module writes data into a binary file.
13. The _____________ method of pickle module reads data from a binary file.
14. The conversion of an object hierarchy in byte stream is called ___________ or
__________________.
15. The character that separates the values in csv files is called the ______________.
16. The default delimiter of csv files is _________________.
17. The csv files are actually _____________ files.
18. We can suppress EOL translation is text file by giving ______________ argument in
open().
19. The file mode to open a binary file for reading as well writing is ______________.
20. The file mode to open a text file for reading as well writing is ____________.
21. The file mode to open a text file for writing as well reading is ________________.
22. The file mode to open a binary file for writing as well as reading is ____________.
23. The file mode to open a csv file for reading as well as writing is ____________.
24. The file mode to open a csv file for appending as well as reading is _________.
25. To specify a different delimiter while writing into a csv file, ______________ argument is
used with csv.writer().
True/False
1. When you open a file for reading, if the file does not exist, an error occurs.

2. When you open a file for writing, if the file does not exist, an error occurs.

3. When you open a file for writing, if the file exists, the existing file is overwritten with the new
file.

4. The absolute paths are from the topmost level of the dictionary structure.

5. The relative paths are relative to the current working directory.

6. The relative path for a file always remains the same even after changing the directory.

7. The types of operations that can be carried out on a file depend upon the file mode a file is
opened in.

8. If no path is given with a file name in the file open(), then file must exist in the current directory.

9. Functions readline() and readlines() are essentially the same.

10. Python automatically flushes the file buffers before closing a file with close().

11. When you open a file for writing, if the file does not exist, a new file is created.

12. When you open a file for appending, if the file exists, the existing file is overwritten with the new
flile.

13. Conversion of an object hierarchy in byte stream is called Serialisation.

14. Serialisation process is also called pickling.

15. The load() of the pickle module performs pickling.

16. The dump() of the pickle module performs unpickling.

17. The csv files can only take comma as delimeter.

18. The csv files are text files.

Multiple Choice Question (MCQ)

1. Information stored on a storage device with a specific name is called a _______.

a) array

b) dictionary

c) file

d) tuple
2. Which of the following format of files can be created programmatically through Python to store
some data?

a) Data Files

b) Text Files

c) Video Files

d) Binary Files

3. To open a file c:\ss.txt for appending data, we use

a) file=open(“c://ss.txt”,”a”)

b) file=open(“c://ss.txt”,”rw”)

c) file=open(r“c://ss.txt”,”a”)

d) file=open(file=“c:\ss.txt”,”w”)

e) file=open(file=“c:\\ss.txt”,”w”)

f) file=open(“c:\res.txt”)

4. To read the next line of the file from file object infi, we use

a) infi.read(all)

b) infi.read()

c) infi.readline()

d) infi.readlines()

5. To read the remaining lines of the file from a file object infi, we use

a) infi.read(all)

b) infi.read()

c) infi.readline()

d) infi.readlines()

6. The readlines() method returns

a) str

b) a list of lines

c) a list of single character

d) a list of integers
7. Which of the following mode refer to binary data?

a) r

b) w

c) +

d) b

8. In file handling, what does this term means “r”, “a”?

a) read, append

b) append,read

c) all of the mentioned

d) none of these

9. Which function is used to read all the characters?

a) read()

b) readcharacters()

c) readall()

d) readchar()

10. Which function is used to read a single line from file?

a) readline()

b) readlines()

c) readstatement()

d) readfulllines()

You might also like