[go: up one dir, main page]

0% found this document useful (0 votes)
608 views26 pages

File Handling Question Bank - Assertion Reasoning

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)
608 views26 pages

File Handling Question Bank - Assertion Reasoning

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/ 26

ARMY PUBLIC SCHOOL KANPUR

Name of the Chapter- DATA FILE HANDLING


ASSERTION REASONING QUESTIONS

Question Question Content Learning Objective(if


No Provided)
Q1. Assertion: It is not necessary to always create the file in Knowledge
the same default folder where Python has been installed.
Reason: In binary file, there is no delimiter for a line. (A)
Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q2. Assertion: The relative paths are relative to current Knowledge
working directory.
Reason: The relative path for a file always remains same
even after changing the directory.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

Q3. Assertion: When you open a file for writing, if the file Understanding
does not exist, an error occurs.
Reason: When you open a file for writing, if the file
exists, the existing file is overwritten with the new file.

(A) Both Assertion and reason are true and reason is


correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

Q4. Assertion: The offset argument to seek() method indicates Understanding


the number of bytes to be moved.

Reason: If the offset value is set to 2, beginning of the


file would be taken as seek position
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

Q5. Assertion: Every record in a CSV file is stored in reader Knowledge


object in the form of a list.

Reason: writerow() method allows us to write a list of


fields to the CSV file.

(A) Both Assertion and reason are true and reason is


correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q6. Assertion (A): A file is a bunch of bytes.
Reason(R): Byte is a unit of memory
A. Both Assertion and reason are true and reason
is correct explanation of assertion.
B. Assertion and reason both are true but reason
is not the correct explanation of assertion.
C. Assertion is true, reason is false.
D. Assertion is false, reason is true.

Q7. Assertion (A): The The CSV File is delimited File.


Reason(R): Only Comma (,) can be use as delimiter in
CSV file.
A. Both Assertion and reason are true and reason
is correct explanation of assertion.
B. Assertion and reason both are true but reason
is not the correct explanation of assertion.
C. Assertion is true, reason is false.
D. Assertion is false, reason is true.

Q8. Assertion (A): The full name of a file or a directory is


called Absolute path.
Reason(R): relative path is relative to current working
directory.
A. Both Assertion and reason are true and reason
is correct explanation of assertion.
B. Assertion and reason both are true but reason
is not the correct explanation of assertion.
C. Assertion is true, reason is false.
D. Assertion is false, reason is true.

Q9. Assertion (A): EOL character is a line terminator in text


file.
Reason(R): By default, EOL Character is the new line
character in Text File.
A. Both Assertion and reason are true and reason
is correct explanation of assertion.
B. Assertion and reason both are true but reason
is not the correct explanation of assertion.
C. Assertion is true, reason is false.
D. Assertion is false, reason is true.

Q10. Assertion (A): File created by notepad cannot be access in


python program.
Reason(R): A text file can be created by Notepad.
A. Both Assertion and reason are true and reason
is correct explanation of assertion.
B. Assertion and reason both are true but reason
is not the correct explanation of assertion.
C. Assertion is true, reason is false.
D. Assertion is false, reason is true.

Q11. Assertion: File can be opened in append mode. KNOWLEDGE AND


Reason: In append mode file content does not get UNDERSTANDING
overwritten and user can append the content after existing
content.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q12. Assertion: It's mandatory to mention file mode while KNOWLEDGE AND
opening a file for reading. UNDERSTANDING
Reason: By default, the file opens in read mode.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q13. Assertion: File can be opened using open() function and KNOWLEDGE AND
“with open() as f:” syntax. UNDERSTANDING
Reason: Once a file is opened it can’t be closed.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q14. Assertion: There is no need to close a file explicitly if APPLICATION
opened using “with open() as f:” syntax. (where f is file
stream object)
Reason: file gets closed using syntax f.close() where f is
a file stream object.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q15. Assertion: With the code given below a user can write ANALYSIS,
multiple lines one by one into a text file ‘readme.txt’ EVALUATION AND
lines = ['This is line 1', 'This is line 2'] CREATION
with open('readme.txt', 'w') as f:
for line in lines:
f.write(line+’\n’)
Reason: As there is no error in code and as the write()
method only writes a single line at a time by appending
‘\n’ to each string of list lines.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q16. Assertion: Text File in Python by default open in reading
mode. Creation
Reason: When open a file in reading mode, file must be
exits.

(A) Both Assertion and reason are true and reason is


correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q17. Assertion: Every File maintains a file pointer which tells Creation
the current position in the file where writing or reading
will takes place.
Reason: file pointer advances by the specified number of
bytes.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q18. Assertion: The function readline( ) reads a line at a time. Analysis
Reason: The readline( ) function can be used to read the
entire file.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q19. Assertion: User can open a file into read and write mode Creaton
at the same time..
Reason: Python provides function “r+” and “w+’ to open
a file in read and write mode at the same time.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q20. Assertion: New content can be added to the existing file. Understanding
Reason: The mode “a” is used for append mode.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q21. def count H (): UNDERSTANDING
f = open (“para.txt” , “r” ) KNOWLEDGE
lines =0 ANALYSIS
l=f. readlines () EVALUATION
for i in L:
if i [0]== ‘H’:
lines +=1
print (“No. of lines are: “ , lines)
Assertion: In above program file mode is read only.
Reason: File must exist already ,otherwise Python raises
I/O error
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q22. observe the following code UNDERSTANDING
f1=open("mydata","a") KNOWLEDGE
#blank1 ANALYSIS
f1.close() EVALUATION

Assertion: In above program file close () function is


important.
Reason: File automatically closed ,otherwise Python
raises I/O error
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q23. if file “try.txt” does not exist? UNDERSTANDING
f = open(“try.txt”) KNOWLEDGE
ANALYSIS
Assertion: Syntax is incomplete EVALUATION
Reason: Python raises FileNotFoundError
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q24. What is the purpose of ‘r’ as prefix in the given UNDERSTANDING
statement? KNOWLEDGE
f = open(r “d:\color\flower.txt”) ANALYSIS
Assertion: The purpose of ‘r’ as prefix in the given EVALUATION
statement is to make it raw string .

Reason: Python raises FileNotFoundError


(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q25. f=None UNDERSTANDING
for i in range(5): KNOWLEDGE
with open("data.txt","w") as f: ANALYSIS
if(i>2): EVALUATION
break
print(f.closed)

Assertion: Here ‘w’refers the text file in write only

Reason: If the file does not exist, file is created


(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

Q26. Assertion: readline() function will read one line from the Knowledge
file. Understanding
Analysis
Reason: readlines() function will read all the lines from
the files.

(A) Both Assertion and reason are true and reason is


correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q27. Assertion: Knowledge
To read twelve characters from a file object fin we use Understanding
fin.read(). Analysis

Reason:
We can use readline( ) function which can read one line at
a time from the file.

(A) Both Assertion and reason are true and reason is


correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q28. Knowledge
Assertion: Understanding
>>> myobj=open("myfile.txt", 'r') Analysis
>>> print(myobj.readlines())
This code will read all the lines from the file.
Reason: readlines() function reads all the lines from a text
file.

(A) Both Assertion and reason are true and reason is


correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q29. Assertion: Knowledge
In code given below, the file object will move 10 bytes Understanding
file_object.seek(10, 0) Analysis

Reason:
Seek() function with negative offset only works when file
is opened in binary mode.

(A) Both Assertion and reason are true and reason is


correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q30. Assertion: Knowledge
Ravi opened the file myfile.txt in append mode. In this Understanding
file the file object/file handle will be at the end of the file. Analysis

Reason: ‘w’ (mode write) mode is default file mode.

(A) Both Assertion and reason are true and reason is


correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q31 Assertion: Text files stores information in ASCII and Knowledge &
Unicode characters understanding
Reason: In text files there is no delimiter for a line
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q32 Assertion: A file created using the statement: Knowledge &
r = open( “text” ) is a text file understanding
Reason: Since the name of the file in open( ) is ‘text’ so
the statement creates a text file
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q33 Assertion: f=open(‘abc.txt’,’r’) Understanding &
L=len(f.read()) application
Print(f.read())
the above code will return No output
Reason: first read() statement put the file pointer at the
end of file, so next f.read() will
Return nothing
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q34 Assertion: myfile = Knowledge &
open("Myfile.txt") understanding
data_rec =
myfile.readlines()

myfile.close()
in the above code, data type of data_rec is a
list class.
Reason: Myfile.txt is a text file so it contains only list of
text lines.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q35 Assertion: f=open(‘story.txt’,’r+’) Knowledge and
Above statement will create a new file, it it is understanding
not exist.
Reason: when we open a file in write mode, it will create
a new file with same name.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q36 Read the following statements and give the answer Analysis
Assertion: readline() read the files line by line
Reason: Without realine() lines from the file cannot be read

(A) Both Assertion and reason are true and reason is


correct explanation of assertion
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion
(C) Assertion is true, reason is false
(D) Assertion is false, reason is true
Q37 Read the following statements and give the answer Analysis
A (Assertion): read () function reads the entire content
of the text file at one go
R (Reason): It returns content as string

(A) Both Assertion and reason are true and reason is


correct explanation of assertion
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion
(C) Assertion is true, reason is false
(D)Assertion is false, reason is true

Q38 Read the following statements and give the answer Analysis
Assertion: seek (5,0) moves cursor after 5 bytes
Reason: It helps to read entire content after 5
characters

(A) Both Assertion and reason are true and reason is


correct explanation of assertion
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion
(C) Assertion is true, reason is false
(D)Assertion is false, reason is true

Q39. Read the following statements and give the answer Analysis
Assertion: readline(5) reads 5 characters from the
line.
Reason: next readline() read the same line.

(A) Both Assertion and reason are true and reason is


correct explanation of assertion
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion
(C) Assertion is true, reason is false
(D)Assertion is false, reason is true

Q40. Read the following statements and give the answer Analysis
Assertion: readlines() returns one line at a time
Reason: readlines() helps in counting number of lines
of the text file

(A) Both Assertion and reason are true and reason is


correct explanation of assertion
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion
(C) Assertion is true, reason is false
(D)Assertion is false, reason is true

Q41. Assertion: While opening a binary file in read only


mode ‘rb’ , the file must exist. Analysis
Reason: Python raises I/O error if the file is unavailable
while opening file in read only mode
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q42. Assertion: While opening a binary file in write only Analysis
mode ‘wb’ , if the file doesn’t exist ,file is created.
Reason: If the file exists,Python python will overwrite
the current file in write only mode.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q43. Assertion: While opening a binary file in append mode Analysis
‘ab’ , if the file exists ,the data in the file is retained and
the new data is written at the end of the file.
Reason: If the file does not exist ,Python will create a
new file in ‘ab ‘ mode.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q44. Assertion: While opening a binary file in read only Analysis
mode ‘rb+’ , the file must exist.
Reason: Python raises I/O error if the file is unavailable
while opening file in ‘rb+’ mode.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q45. Assertion: While opening a binary file in write and read Analysis
mode ‘wb+’ , if the file doesn’t exist ,file is created.
Reason: If the file exists,Python python will overwrite
the current file in ‘wb+’ mode.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q46. Assertion: There is no line delimeter in binary files. Knowledge
Reason: Binary file stores data line by line.

(A) Both Assertion and reason are true and reason is


correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q47. Assertion: open() method uses the ‘path & filename’ with Understanding
‘mode of opening’ a binary file.
Reason: There are three modes to open a file in python
that are read, write and append.

(A) Both Assertion and reason are true and reason is


correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q48. Assertion: Access mode ‘ab’ opens a file for appending Application
data.
Reason: The file pointer is at the end of the file in the file
exists.

(A) Both Assertion and reason are true and reason is


correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q49. Assertion: Binary file stores data in a format understand Analysis
easily by the computer hardware.
Reason: Computer hardware only understand the binary
language.

(A) Both Assertion and reason are true and reason is


correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q50. Assertion: ‘rb+’ mode opens a binary file in read only Evaluation
mode.
Reason: The file pointer in ‘rb+’ mode exist at the
beginning of file.

(A) Both Assertion and reason are true and reason is


correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q51 Assertion (A) : By default file is opened in read mode.
Reasoning (R): while opening a file if we are not Analysis
specifying the mode then default it will open in read
mode
A) Only assertion is true
B) Assertion and reason does not match
C) Both assertion and reasoning is false
D) Both assertion and reasoning is true
Q52 Assertion (A) : we need to import csv module to read and Analysis
write in a binary file
Reasoning (R): writerow() function is defined in pickle
module.
A) Only assertion is true
B) Assertion and reason does not match
C) Both assertion and reasoning is false
D) Both assertion and reasoning is true
Q53 Assertion (A) : Processing of binary file is faster than Analysis
text file.
Reasoning (R): In text file is terminated with a special
character known as EOL character
A) Only assertion is true
B) Assertion and reason does not match
C) Both assertion and reasoning is false
D) Both assertion and reasoning is true
Q54 Assertion (A) : A file object is needed to reference to a Analysis
file on the disk.
Reasoning (R): With the help of this file we can perform
different task on file.
A) Only assertion is true
B) Assertion and reason does not match
C) Both assertion and reasoning is false
D) Both assertion and reasoning is true
Q55 Assertion (A) : Closing of all the opened file is done in Analysis
when no reference is needed for the opened file.
Reasoning (R): Closing of file breaks the link of file
object and the file on the disk.
A) Only assertion is true
B) Assertion and reason does not match
C) Both assertion and reasoning is false
D) Both assertion and reasoning is true

Q56 Assertion: pickle module can save python objects into pickling process
binary file
Reason: pickling process converts python objects into
byte stream
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

Q57 Assertion: pickle.load( ) deserialise the python object unpickling process


Reason: Deserialise object process involves conversion of
python object into string
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

Q58 Assertion: “import pickle” statement is required to use use of pickle


pickle in python program
Reason: “pip install pickle” command is required to
install pickle in python
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q59 Assertion: “L=[3,4] ; f=open(‘L1.dat’,’wb’); Serialisation Process
pickle.dump(L,f); f.close( ) “ => Serialise the [3,4] as
byte squence into file L1.dat
Reason: pickle.dum( A , B) => Serialise the Python
object A as a byte stream onto the file using fileobject B
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

Q60 Assertion: d={‘a’:12, ‘b’:10}; f=open(‘data.dat’, ‘wb’); Difference between


f.write( d ); f.close( ) => Python object d is serialised Writing memory block
onto file using file object f and Serialisation of
object
Reason: d={‘a’:12, ‘b’:10}; f=open(‘data.dat’, ‘wb’);
pickle.dump( d, f); f.close( ) => Python object d is
serialised onto file using file object f
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

Q61 Assertion: CSV is a kind of plain text file Understanding


Reason: It can be opened in all type of programs
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q62 Assertion: First use open() method to read data from file Creation
Reason: File File object is required to read data with the
help of csv.reader object/method
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q63 Assertion: We should use with() statement to write csv Application
related statement
Reason: with() statement at end releases all the resources
automatically without using close()
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q64 Assertion:CSV is best suitable to open in text editor Understanding
Reason: Most of the files can be opened in text editor
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q65 Assertion:close() method must be called as last statement Evaluation
related to csv file object
Reason: As it releases the assigned resources
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q66.. Assertion: While writing data to csv file, we set the value Application
of parameter newline to "" in the open() function to
prevent blank rows.
Reason: EOL translation is suppressed by using
newline="".
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q67. Assertion: The CSV module in Python’s standard library Knowledge
presents methods to perform read/write operations on
CSV files.
Reasoning: To write data to a CSV file, we can usebuilt-
in function writer().
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q68. Assertion: To open a CSV file employee.csv in write Understanding
mode, we can give python statement as follows:
fh=open('employee.csv’)
Reasoning: If we try to write on a csv file that does not
exist, the file gets Created
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q69. Assertion: We can open a CSV file in the same way as a Understanding
text file for reading and writing data.
Reason: A CSV file is a text file that uses a delimiter to
separate values.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q70. Assertion: To specify a different delimiter while writing Application
into a csv file, delimiter argument is used with
csv.writer().
Reason: The CSV file can only take a comma as a
delimiter.
(A) Both Assertion and reason are true and reason is the
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

ANSWER

Question No Answer
Q1. (D) Assertion is false, reason is true.
Q2. (C) Assertion is true, reason is false.
Q3. (D) Assertion is false, reason is true.
Q4. (C) Assertion is true, reason is false
Q5. (B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q6. A

Q7. C

Q8. B
Q9. A

Q10. D

Q11. (A) Both Assertion and reason are true and reason is the correct
explanation of assertion.
Q12. (D) Assertion is false, reason is true.
Q13. (C) Assertion is true, reason is false
Q14. (B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q15. (A) Both Assertion and reason are true and reason is the correct
explanation of assertion.
Q16. A

Q17. A
Q18. B
Q19. A
Q20. A
Q21. A
Q22. C

Q23. A

Q24. C

Q25. A

Q26. (B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q27. (D) Assertion is false, reason is true.
Q28. (A) Both Assertion and reason are true and reason is correct
explanation of assertion.
Q29. (B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q30. (C) Assertion is true, reason is false.

Q31 C
Q32 C
Q33 A
Q34 B
Q35 D
Q36 C
Q37 B
Q38 A
Q39. B
Q40. D
Q41. A

Q42. B
Q43. B
Q44. A
Q45. B
Q46. (C) Assertion is true, reason is false

Q47. (B) Assertion and reason both are true but reason is not the
correct explanation of assertion
Q48. (A) Both Assertion and reason are true and reason is correct
explanation of assertion.
Q49. (A) Both Assertion and reason are true and reason is correct
explanation of assertion.
Q50. (D) Assertion is false, reason is true.

Q51 D
Q52 C
Q53 B
Q54 D
Q55 D
Q56 A

Q57 D

Q58 C

Q59 A

Q60 D

Q61 B

Q62 A
Q63 A
Q64 C
Q65 A
Q66.. a) Both Assertion and reason are true and reason is the correct
explanation of assertion.
Q67. c) Assertion is true, reason is false.
Q68. d) Assertion is false, reason is true.
Q69. a) Both Assertion and reason are true and reason is the correct
explanation of assertion.
Q70. c) Assertion is true, reason is false.

Made by: Kumar Gaurav

You might also like