0% found this document useful (0 votes)
116 views10 pages

File Handling Question Bank - True False Questions

Uploaded by

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

File Handling Question Bank - True False Questions

Uploaded by

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

ARMY PUBLIC SCHOOL KANPUR

Name of the Chapter- FILE HANDLING


TRUE FALSE QUESTIONS

Question Question Content Learning Objective(if


No Provided)
Q1 A relative path always begins with root folder Knowledge
(A) True
(B) False
Q2 readlines() reads the entire file at a time Understanding
(A) True
(B) False
Q3. ‘with’ statement ensures that all the resources allocated to Understanding
the file objects get deallocated automatically
(A) True
(B) False

Q4. A binary file stores information in ASCII or Unicode Knowledge


character
(A) True
(B) False
Q5. Opening a file in write mode erases the previous data. Knowledge
(A)True
(B)False
Q6. The absolute paths are from the topmost label of the
directory structure
Q7. The relative path are relative to the current working
directory.
Q8. The relative path for a file always remain the same even
after changing the directory.
Q9. If a no path is given with the file name in the file open()
,then the file must exist in the current directory.
Q10. In Microsoft windows two files can have same pathname.

Q11. When an existing file is opened in appending mode than KNOWLEDGE AND
file pointer is present at the end of the file. UNDERSTANDING
Q12. If a file is opened in r+, w+ or a+ mode, it can be used for KNOWLEDGE AND
both reading and writing. UNDERSTANDING
Q13. When we are writing strings using the write() method into KNOWLEDGE AND
a file one by one using iteration then a newline character UNDERSTANDING
is appended to each string by default so that all strings are
written in different lines in the file.
Q14 If a file is opened with “with open() as f” syntax then APPLICATION
after the control exiting the “with open()” block the file
get closed itself. (where f is file stream object)
Q15 A user wants to open a file ‘story.txt’ without losing the ANALYSIS,
content of the file and wants to continue writing after the EVALUATION AND
existing content. Also, if a file does not exist the file CREATION
should be created itself. He/she opened the file with
syntax :
f = open(“story.txt”, ‘r+”)
Is this statement true or false?
Q16. The file open using the with statement will close Understanding
automatically after with block is over.
Q17. The file mode “w” & “w+” are the same. Knowledge
Q18. When open a file into append mode , if the file does not Knowledge
exist , an error has been occurred.
Q19. The read( ) function reads the entire file at a time. Understanding
Q20 The readlines( ) function read the entire file in a list of Analysis
strings where each line is stored as one string.
Q21 Text file mode ‘a’ is in write only mode? KNOWLEDGE
(A)True (B) False
Q22. Text file mode ‘w+’ refer to write and read mode file? KNOWLEDGE
(A)True (B) False
Q23. A close() function breaks the link of file –object? KNOWLEDGE
(A)True (B) False
Q24. The following syntax is not correct- KNOWLEDGE
Myfile=open(r’E:\poem.txt’,”r”)

(A)True (B) False


Q25. Readline() , reads all lines and returns them in a list. KNOWLEDGE
(A)True (B) False
Q26. The read() operation reads the entire file at once. Knowledge
a) True b) False
Q27. tell() will return the current position of file pointer in the Knowledge
file

a) True b) False

Q28. f.seek(10,0) will move 10 bytes forward from beginning Understanding


of file.

a) True b) False

Q29. Writer() method is used to write the objects in a binary Knowledge


file.

a) True b) False

Q30. dump( ) method is used to read data from a binary file Understanding

a) True b) False
Q31 read() method will read all the line of text file and return understanding
them in the form of list
(True/False)
Q32 Tell() method will identify the current location of file understanding
pointer in the file (True/False)
Q33 Open() method in read mode will create the file understanding
(True/False)
Q34 Readlines() method will returns the text file contents in understanding
the from of list of lines
(True/False)
Q35 Readline() method will returns the text file contents in the understanding
from of list of lines
(True/False)
Q36 f.seek (10,0) will move 10 bytes forward from beginning of file. Application
(A) True
(B) False

Q37 readlines( ) function returns all the words of the file in the Understanding
form of List. (T/F)
(A) True
(B) False

Q38 seek() function returns the current position of the file pointer Knowledge
(A) True
(B) False

Q39 readchar() function reads the all characters from the file Knowedge
(A) True
(B) False

Q40 readlines(5) read 5 lines from the file Application


(A) True
(B) False

Q41 The delimiter is required to end a binary file in Python. Understanding


Q42 The file mode “rb” & “rb+” are the same. Analysis
Q43 If the file does not exist and we open a file into append Knowledge
mode then an error occurs.
Q44. In ‘rb’ mode of Python a file must exist otherwise an Understanding
error occurs.
Q45. Binary files are not in human readable format. Understanding
Q46 In binary file data is stored in the same format that is Application
understand by the computer.
Q47 In append mode of binary file, the file pointer will remain Evaluation
at the end of the file.
Q48 The ‘r+b’ mode is used to read a binary file. Knowledge

Q49 There will be a line delimeter in a binary file. Understanding

Q50 The Binary files are used to store large data such as Analysis
images, video files, audio files etc.
Q51 Binary file stores information in ASCII or UNICODE Understanding
characters
A) TRUE
B) FALSE
Q52 The flush function forces the writing of data on the disk Understanding
still pending in output buffer.
A) TRUE
B) FALSE
Q53 Every line is a binary file is terminated with a EOL Knowledge
character.
A) TRUE
B) FALSE
Q54 The tell method tells the current position of the file Knowledge
pointer within the file
A) TRUE
B) FALSE
Q55 The dump method is used to read data from the binary file Knowledge
A) TRUE
B) FALSE
Q56 The pickle module can be used to directly store the Awareness about pickle
python module
objects onto the disk file.
Q57 pickle.loads( ) read the next line and store into disk file. Knowledge of basic
working of load( )

Q58 Deserialisation of records from file through pickle Awareness about basic
module should be guarded through try.. catch .. block. coding steps of using
pickle

Q59 A binary file 'employee.dat' contains 100 records, to add a Know about opening
new record into file, the file should be opened in 'wb' modes in case of binary
mode. file

Q60 Pickling is the process by which a Python object is Knowledge about saving
converted to a byte stream. process through pickle
module

Q61 A binary file can store data in the form of 0 and 1 Understanding
a) True
b) False
Q62 File object and file handle is the same thing Knowledge
a) True
b) False
Q63. Pickle.dump() function is use for writing data in binary Application
file.
a) True
b) False
Q64. pickle module contains read() and write() function. Knowledge
a) True
b) False
Q65. wb+ and w+b are same in respect of binary file. Knowledge
a) True
b) False
Q66. The load() function of the pickle module perform Evaluation
pickling.
a) TRUE
b) FALSE
Q67 File.seek(5,0) will move 5 bytes forward from the Analysis
beginning of the file.
a) TRUE
b) FALSE
Q68 There is a delimiter to end a line in Binary File. Knowledge
a) TRUE
b) FALSE
Q69 tell() method of Python tells us the current position Analysis
within the file.
a) TRUE
b) FALSE
Q70 When you open a file for writing, if the file exists, the Analysis
existing file is overwritten with the new file.

a) TRUE
b) FALSE
Q71 We cannot insert multiple rows in csv file using python Application
csv module
Q72 The default line terminator is \n in csv file Understanding
Q73 We can import csv module functions in following Creation
manner:
from csv import writerow, reader
Q74 A CSV file is a plain text file that can be opened in all kid Understanding
of programs
Q75 We have to insert header row in csv file using write() function Evaluation
as it is not included by default
Q76 A csv file is a binary file. Knowledge
(A) True
(B) False
Q77. The separator character of csv files is called delimiter. Knowledge
(A) True
(B) False
Q78 The csv files only take a comma as delimiter. Knowledge
(A) True
(B) False
Q79 You cannot insert multiple rows in a csv file using the csv Application
module.
(A) True
(B) False
Q80 You can import csv module functions for reading from Application
csv file and writing into csv file in the following manner:
from csv import writer, reader
(A) True
(B) False

ANSWER

Question No Answer
Q1 (B) False
Q2 (A) True
Q3. (A) True
Q4. (A) True
Q5. (A) True
Q6. True

Q7. True

Q8. False

Q9. True

Q10. False

Q11. True
Q12. True
Q13. False
Q14 True
Q15 False
Q16. True

Q17. False
Q18. False
Q19. True
Q20 True
Q21 True
Q22. True

Q23. True

Q24. False

Q25. False

Q26. True
Q27. True
Q28. True
Q29. False
Q30. False
Q31 False
Q32 True
Q33 False
Q34 True
Q35 False
Q36 A
Q37 A
Q38 B
Q39 B
Q40 B
Q41 False
Q42 False
Q43 False
Q44. True
Q45. True
Q46 True

Q47 True

Q48 False

Q49 False

Q50 True

Q51 FALSE
Q52 TRUE
Q53 FALSE
Q54 TRUE
Q55 FALSE
Q56 True

Q57 False

Q58 True

Q59 False

Q60 True

Q61 False
Q62 True
Q63. True
Q64. False
Q65. True
Q66. FALSE
Q67 TRUE
Q68 FALSE
Q69 TRUE
Q70 TRUE
Q71 False
Q72 True
Q73 True
Q74 False
Q75 True
Q76 b) False

Q77. a) True

Q78 b) False

Q79 b) False

Q80 a) True

Made by: Kumar Gaurav

You might also like