Class 12 File Handling MCQ Quiz | File Handling in Python class 12 MCQ Quiz

Preview

Class 12 File Handling MCQ Quiz | File Handling in Python class 12 MCQ Quiz



0%

Class 12 File Handling MCQ Quiz

Click here to learn Data file handling in Python

1 / 63

To force Python to write the file buffer on to storage file, ______ method may be  used.

2 / 63

The file mode to open a binary file for writing as well reading is _____ .

3 / 63

Text file data.txt contains: I am a student.
What will following code print?
f=open("data.txt")
print(f.read(6))
f.close()

4 / 63

The file mode to open a csv file for appending  as well reading is _____ .

5 / 63

Which of the following formats of files can be created programmatically through Python to store some data?

6 / 63

The relative paths for a file always remains the same ever after changing the directory.

7 / 63

Conversion of an object hierarchy in byte stream is called Serialization.

8 / 63

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

9 / 63

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

10 / 63

Which of the following represents mode of both writing and reading in binary format in files ?

11 / 63

Which of the following in not a valid mode to open a file ?

12 / 63

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

13 / 63

Serialisation process is also called picking.

14 / 63

The csv files can only take comma as delimiter.

15 / 63

The absolute paths are from the topmost level of the directory structure.

16 / 63

To specify a different delimiter while writing into a csv file, ____ argument is used with csv.writer().

17 / 63

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

18 / 63

A _____ governs the type of operations (e.g., read/write/append) possible in the opened file.

19 / 63

Function readline() and readlines() are essentially the same.

20 / 63

Which of the following command is used to open a file "c: \pat.txt" in read-mode only ?

21 / 63

The readlines() method returns

22 / 63

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

23 / 63

If the file already contains "good". What will be stored in file data.txt after executing following code.
f=open("data.txt")
f.write("Bye")
f.close()

24 / 63

Which the following command is used to open a file "c:\pat.txt" for writing as well as reading in binary format only ?

25 / 63

The other name for file object is _____ .

26 / 63

Which of the following mode will refer to binary data ?

27 / 63

In file handling, what does this term means "r", "a" ?

28 / 63

The file mode to open a text file for writing as well reading is _____ .

29 / 63

______ function is used to write multiple lines of data in the form of nested list in a file.

30 / 63

The relative paths are relative to the current working directory.

31 / 63

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

32 / 63

________ is the default delimiter of csv files.

33 / 63

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

34 / 63

Which of the following statements are true regarding the opening modes of a file ?

35 / 63

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

36 / 63

To read all the file contents in the form of a list, _____method is used.

37 / 63

Which the following command is used to open a file "c: \pat.txt" for writing in binary format only ?

38 / 63

What will following line of code do?

file1=open("data2.dat","rb+")

39 / 63

To close an open file, _____ method is used.

40 / 63

To read the remaining lines of the file from a file object fileinp, we use:

41 / 63

Which the following functions do you use to write data in the binary format ?

42 / 63

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

43 / 63

The csv files are text files.

44 / 63

What is the difference between r+ and w+ modes ?

45 / 63

The file mode to open a csv file for reading as well writing is _____ .

46 / 63

The csv files are actually _____ files.

47 / 63

Which function is used to read all the the characters from a text file ?

48 / 63

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

49 / 63

Which function is used to write all the characters in a file?

50 / 63

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

51 / 63

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

52 / 63

What will following code do?
f=open("data.txt")
L=f.readlines()
print(L[-1])

53 / 63

Which function is used to write a list of strings in a file ?

54 / 63

The character that separates the values in csv filers is called the _____.

55 / 63

Where will file pointer go after executing following code.
f=open("data.txt")
D=f.read()
print(D)

56 / 63

CSV files can be opened in Microsoft Excel.

57 / 63

The default file-open mode is ______ mode.

58 / 63

Find error in following code:
1. import pickle
2. data=[10,20,30]
3. fout=open("data1.dat", "rb")
4. pickle.dump(data,fout)
5. fout.close()

59 / 63

The two types of data files can be _____ files and ____ files.

60 / 63

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

61 / 63

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

62 / 63

We can suppress EOL translation is text file by giving _____ argument in open ().

63 / 63

To write a list in a file, _____ method may be used.



 

Spread the love
Lesson tags: Class 12 File Handling MCQ, Class 12 File Handling MCQ Quiz, python quiz for class 12
Back to: CBSE class 12 Computer Science notes
Spread the love