Class 12 File Handling MCQ Quiz

Preview



Class 12 File Handling Quiz

1 / 70

Serialization process is also called pickling.

 

2 / 70

Which line contains error in the following code.

1. import csv
2. f=open('attendees1.csv' )
3. csvf=csv.writer(f)
4.f.close()

3 / 70

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

 

4 / 70

The file mode to open a binary file for appending data is _____.

 

5 / 70

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

 

6 / 70

The relative paths are relative to the current working directory.

 

7 / 70

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

 

8 / 70

We can suppress EOL translation is text file by giving____argument in open().

 

9 / 70

The CSV files are not text files.

 

10 / 70

In file handling, what do "r" and "a" mean?

 

11 / 70

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

 

12 / 70

Full form of csv is:

 

13 / 70

The readlines() method returns_______________.

 

14 / 70

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

 

15 / 70

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

 

16 / 70

The default delimiter of csv files is___

will give output

 

17 / 70

___ is the extension of text file.

 

18 / 70

The file mode to open a CSV file for reading as well writing is____.

 

19 / 70

The other name for file object is___.

 

20 / 70

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

 

21 / 70

To read and write into binary files,___module of python is used.

 

22 / 70

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

 

23 / 70

To read all the file content in the form of a single string, _______method is used.

 

24 / 70

In which file mode is the file opened in following statement?

with open(' poem.txt') as f:

 

 

25 / 70

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

 

26 / 70

The __ method of pickle module writes data into a binary file.

27 / 70

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

 

28 / 70

What is the Function of csv. reader object?

29 / 70

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

 

30 / 70

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

 

31 / 70

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

 

32 / 70

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

 

33 / 70

What does CSV.Writer object do?

 

34 / 70

What is the output of following code if file poem.txt contains : 'This is a poem'.

fh=file("poem.txt","r") 
print(fh .read(6))

35 / 70

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

 

36 / 70

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

 

37 / 70

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

 

38 / 70

Which of the following mode will refer to binary data?

 

39 / 70

Information stored on a storage device with a specific name is called__.

 

40 / 70

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

41 / 70

Which type of data can be written to binary file?

 

42 / 70

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

 

43 / 70

The CSV files can only take comma as delimiter.

 

44 / 70

If we don't specify any file mode while opening a text file, default mode is _____________.

 

will give output.

45 / 70

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

 

46 / 70

Which of the following  format of files can be created programmatically though python to  store some data ?

 

47 / 70

Python program gives error if we don't use close() function with file handle at last .

48 / 70

The Conversion of an object hierarchy in byte stream is called___or____.

 

49 / 70

To force python to write the contents of the file buffer on to storage file,____ method may be used.

 

50 / 70

What is the output of following code if file poem.txt  contains : "This is a poem".

file("e:\\poem.txt","r"). readline()

 

51 / 70

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

 

52 / 70

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

 

53 / 70

Which module is required for using load() function in Python?

 

54 / 70

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

 

55 / 70

The tell() function gives the position of file pointer within a file.

 

56 / 70

Text file can be viewed and edited in any text editor.

 

57 / 70

The character that separates the values in csv files is called the___.

 

58 / 70

The___method of pickle module reads data from a binary file.

 

59 / 70

The two types of data files can be ___ files and ___files.

 

60 / 70

The main advantage of file handling is:

 

 

61 / 70

To read the remaining lines of the files from a file object f, we use

 

62 / 70

The file mode to open a CSV file for appending as well reading is____.

63 / 70

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

64 / 70

The csv files are actually __files.

65 / 70

To close an open file,___method is used.

 

66 / 70

What will be the output of following code if file poem.txt contains : "This is a poem"

file=("e:\\poem.txt","r")
print(file. readline(). split())

67 / 70

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

 

68 / 70

Which module is required for writerow() function in Python?

 

69 / 70

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

 

70 / 70

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

 

Your score is

0%

Exit



 

Lesson tags: python quiz for class 12
Back to: CBSE class 12 Computer Science notes