Q1:
2025: 27 May Shift 2
Computer Science
File Handling
Easy
Computer Science
Which of the following command is used to open file "c:\comp.txt" for writing in binary format only?
2025: 27 May Shift 2
Computer Science
File Handling
Easy
Computer Science
Which of the following command is used to open file "c:\comp.txt" for writing in binary format only?
2025: 22 May Shift 1
Computer Science
File Handling
Easy
Computer Science
Match List-I with List-II
| List-I | List-II |
|---|---|
| (A) read() | (I) writes the list of strings to the file |
| (B) write() | (II) reads the specified number of characters from the file |
| (C) writelines() | (III) writes the string to the file |
| (D) readlines() | (IV) reads the file line by line into a list |
2025: 22 May Shift 1
Computer Science
File Handling
Easy
Computer Science
Sequence the steps to write data to a file and then read it back:
(A). Write data to the file.
(B). Open the file in w+ mode.
(C). Read the data from the file.
(D). Seek to the beginning of file.
2025: 22 May Shift 1
Computer Science
File Handling
Easy
Computer Science
Which of the following is the correct method to write into a text file.
2025: 22 May Shift 1
Computer Science
File Handling
Easy
Computer Science
The pickle module is used for _______________and ________ any python object structure.
2025: 21 May Shift 1
Computer Science
File Handling
Easy
Computer Science
dump( ) method is used for _______________.
2025: 20 May Shift 1
Computer Science
File Handling
Easy
Computer Science
Given data in text file "rhymes.txt" as follows:
Johny Johny Yes Papa
Eating Sugar No Papa
Telling a lie No Papa
Open your mouth Ha Ha Ha
Find the output for the following code:
my1=open("rhymes.txt","r")
data=my1.read(10)
print(data)
my1.close()
2025: 20 May Shift 1
Computer Science
File Handling
Easy
Computer Science
Identify the correct code to open a file "file1.txt", but not required to close the file using close() statement:
2025: 16 May Shift 1
Computer Science
File Handling
Easy
Computer Science
Arrange the following lines of code for writing into a file in the correct order:
(A) lines = ["Hello Everyone\n", "Writing in multiple lines"];
(B) myobj.writelines(lines)
(C) myobj= open("myfile.txt", 'w')
(D) myobj.close()
2025: 16 May Shift 1
Computer Science
File Handling
Easy
Computer Science
_____method is used to position the file object at a particular position in a file.
2025: 15 May Shift 2
Computer Science
File Handling
Easy
Computer Science
Identify the correct meaning of the code statement:
file.seek(10)
2025: 15 May Shift 2
Computer Science
File Handling
Easy
Computer Science
Identify the correct sequence of working in binary files:
(A) f=open("myfile.dat","rb")
(B) f.close()
(C) import pickle
(D) data=pickle.load(f)
2025: 14 May Shift 1
Computer Science
File Handling
Easy
Computer Science
What is the return type of fileobject.tell() method in python?
2025: 14 May Shift 1
Computer Science
File Handling
Easy
Computer Science
Which of the following methods is used to unpickling data from a binary file?
2025: 14 May Shift 1
Computer Science
File Handling
Easy
Computer Science
What is the default file offset position when we open a file in append mode?
2025: 13 May Shift 2
Computer Science
File Handling
Easy
Computer Science
Identify the correct python statement to open a text file "data.txt" in both read and write mode.