Menu mobile
Home
Programming
Python Tutorial
Java Tutorial
C Tutorial
C++ Tutorial
Web Technology
HTML
CSS
Java Script
PHP
React JS
Node JS
Assignment
MS Office
HTML
CSS
Bootstrap
Java Script
JQuery
AngularJs
Project
Blog
QUIZ ON : python - FILE PROCESSING IN PYTHON
FILE PROCESSING IN PYTHON
00:00:00
English
Hindi
Question No# :
01
out of 50
Which of the following options can be used to read the first line of a text file data.txt?
टेक्स्ट फाइल data.txt की पहली लाइन को पढ़ने के लिए निम्न में से कौन सा विकल्प इस्तेमाल किया जा सकता है?
A.
f = open('data.txt'); f.read()
f = open('data.txt'); f.read()
B.
f = open('data.txt','r'); f.read(n)
f = open('data.txt','r'); f.read(n)
C.
myfile = open('data.txt'); f.readline()
myfile = open('data.txt'); f.readline()
D.
f= open('data.txt'); f.readlines()
f= open('data.txt'); f.readlines()
Question No# :
02
out of 50
<p>What will be the output of the following code?</p><pre>f=open("demo.txt","r")<br>print(f.tell())</pre>
<p>निम्नलिखित कोड का आउटपुट क्या होगा?</p><pre style="font-size: 12.6px; letter-spacing: 0.14px;">f=open("demo.txt","r")<br>print(f.tell())</pre>
A.
1
1
B.
2
2
C.
-1
-1
D.
0
0
Question No# :
03
out of 50
Which of the following functions is used to open a file in Python?
पायथन में फ़ाइल खोलने के लिए निम्नलिखित में से किस फ़ंक्शन का उपयोग किया जाता है?
A.
open_file()
open_file()
B.
file_open()
file_open()
C.
open()
open()
D.
read_file()
read_file()
Question No# :
04
out of 50
Which of the following is not a correct mode to open a file ?
फ़ाइल खोलने के लिए निम्न में से कौन सा सही मोड नहीं है?
A.
ab
ab
B.
rw
rw
C.
a+
a+
D.
r+
r+
Question No# :
05
out of 50
which of the following will read entire content of file (file object 'f')?
निम्नलिखित में से कौन फ़ाइल (file object 'f') की संपूर्ण सामग्री को पढ़ेगा ?
A.
f.reads()
f.reads()
B.
f.read()
f.read()
C.
f.read(all)
f.read(all)
D.
f.read( *)
f.read( *)
Question No# :
06
out of 50
In which format python file considered
पाइथन फ़ाइल को किस प्रारूप में माना जाता है
A.
giga bytes
giga bytes
B.
mega bytes
mega bytes
C.
byte
byte
D.
bits
bits
Question No# :
07
out of 50
Which is the function to read the remaining lines of the file from a file object infile?
फ़ाइल ऑब्जेक्ट infile से फ़ाइल की शेष पंक्तियों को पढ़ने के लिए कौन सा फंक्शन है?
A.
infile.read(2)
infile.read(2)
B.
infile.read()
infile.read()
C.
infile.readlines()
infile.readlines()
D.
infile.readline()
infile.readline()
Question No# :
08
out of 50
Which of the following mode will refer to binary data?
निम्न में से कौन सा मोड बाइनरी डेटा को संदर्भित करेगा?
A.
r
r
B.
w
w
C.
+
+
D.
b
b
Question No# :
09
out of 50
A Function used for writing data in the binary format :
बाइनरी फॉर्मेट में डेटा लिखने के लिए उपयोग किया जाने वाला एक फंक्शन:
A.
write
write
B.
output
output
C.
send
send
D.
dump
dump
Question No# :
10
out of 50
Which function reads all lines into a list from file?
कौन सा फंक्शन फाइल से सभी लाइनों को सूची में पढ़ता है?
A.
readlines()
readlines()
B.
readline()
readline()
C.
readlist()
readlist()
D.
readall()
readall()
Question No# :
11
out of 50
What is mean by 'rb' mode when working with binary file in python
पायथन में बाइनरी फ़ाइल के साथ काम करते समय 'rb' मोड का क्या अर्थ है?
A.
read binary
read binary
B.
write binary
write binary
C.
append binary
append binary
D.
read write
read write
Question No# :
12
out of 50
<p>What is the output of following?</p><pre><span style="font-size: 14px;">f = open("test.txt", "r")<br></span><span style="font-size: 14px;">f.seek(0)<br></span><span style="font-size: 14px;">print(f.tell())</span></pre>
<p>निम्न code का output क्या होगा?</p><pre style="font-size: 12.6px; letter-spacing: 0.14px;"><span style="font-size: 14px;">f = open("test.txt", "r")<br></span><span style="font-size: 14px;">f.seek(0)<br></span><span style="font-size: 14px;">print(f.tell())</span></pre>
A.
0
0
B.
1
1
C.
File size
File size
D.
Error
Error
Question No# :
13
out of 50
Which one of the following is not attributes of file?
निम्नलिखित में से कौन सा फाइल का ऐट्रीब्यूट नहीं है?
A.
closed
क्लोज्ड
B.
softspace
सॉफ्टस्पेस
C.
rename
रीनेम
D.
None of the above.
उपर्युक्त में से कोई नहीं
Question No# :
14
out of 50
Which of the following is not a valid mode to open a file?
निम्नलिखित में से कौन सा फ़ाइल खोलने के लिए वैध मोड नहीं है?
A.
ab
ab
B.
rw
rw
C.
r+
r+
D.
w+
w+
Question No# :
15
out of 50
<p>What is the output?</p><pre><span style="font-size: 14px;">f = open("test.txt", "w")<br></span><span style="font-size: 14px;">f.write("Python")<br></span><span style="font-size: 14px;">print(f.tell())<br></span><span style="font-size: 14px;">f.close()</span></pre>
<p>इसका परिणाम क्या होगा?</p><pre style="font-size: 12.6px; letter-spacing: 0.14px;"><span style="font-size: 14px;">f = open("test.txt", "w")<br></span><span style="font-size: 14px;">f.write("Python")<br></span><span style="font-size: 14px;">print(f.tell())<br></span><span style="font-size: 14px;">f.close()</span></pre>
A.
5
5
B.
6
6
C.
7
7
D.
0
0
Question No# :
16
out of 50
Which of the following is an invalid mode?
निम्न में से कौन सा अमान्य मोड है?
A.
a
a
B.
ar+
ar+
C.
r+
r+
D.
w
w
Question No# :
17
out of 50
What does read() do?
read() क्या करता है?
A.
Reads one line
Reads one line
B.
Reads all lines into a list
Reads all lines into a list
C.
Reads entire file as a string
Reads entire file as a string
D.
Reads one character
Reads one character
Question No# :
18
out of 50
Which statement will open file data.txt in append mode?
कौन सा स्टेटमेंट data.txt फाइल को एपेंड मोड में खोलेगा?
A.
f = open("data.txt", "a")
f = open("data.txt", "a")
B.
f = Open("data.txt", "ab")
f = Open("data.txt", "ab")
C.
f= new("data.txt", "a")
f= new("data.txt", "a")
D.
open("data.txt", "a")
open("data.txt", "a")
Question No# :
19
out of 50
The syntax used to rename a file :
फ़ाइल का नाम बदलने के लिए प्रयुक्त सिंटैक्स:
A.
os.rename(existing_name, new_name)
os.rename(existing_name, new_name)
B.
fq.name = ‘new_name.txt’
fq.name = ‘new_name.txt’
C.
os.rename(fp, new_name)
os.rename(fp, new_name)
D.
os.set_name(existing_name, new_name)
os.set_name(existing_name, new_name)
Question No# :
20
out of 50
Identify the correct function call to read first 5 character of the file from the beginning
शुरुआत से फ़ाइल के पहले 5 अक्षर को पढ़ने के लिए सही फ़ंक्शन कॉल की पहचान करें
A.
f.read(5)
f.read(5)
B.
f.read()=5
f.read()=5
C.
f.readline(5)
f.readline(5)
D.
f.readlines(5)
f.readlines(5)
Question No# :
21
out of 50
What does EOF stand for?
EOF का पूरा नाम क्या है?
A.
End Of Folder
End Of Folder
B.
Exit Open File
Exit Open File
C.
End Of File
End Of File
D.
Error On File
Error On File
Question No# :
22
out of 50
Each line of a text file is terminated by a special character, called the ___
टेक्स्ट फाइल की प्रत्येक पंक्ति को एक विशेष कैरेक्टर द्वारा समाप्त किया जाता है, जिसे ____ कहा जाता है।
A.
End of File
फाईल का अंत
B.
End of Line
लाईन का अंत
C.
End of Statement
स्टेटमेंट का अंत
D.
End of program
प्रोग्राम का अंत
Question No# :
23
out of 50
Which function tells the current file position?
कौन सा फ़ंक्शन फ़ाइल की वर्तमान स्थिति बताता है?
A.
seek()
seek()
B.
read()
read()
C.
close()
close()
D.
tell()
tell()
Question No# :
24
out of 50
to use load() function for working with binary file in python which module is require
पायथन में बाइनरी फ़ाइल के साथ काम करने के लिए load() फ़ंक्शन का उपयोग करने के लिए किस मॉड्यूल की आवश्यकता है
A.
pickle
pickle
B.
binary
binary
C.
unpickle
unpickle
D.
fstream
fstream
Question No# :
25
out of 50
If we open a file in write mode and file does not exists, which of the error will generate?
यदि हम एक फाइल को राइट मोड में खोलते हैं और फाइल मौजूद नहीं है, तो कौन सी त्रुटि उत्पन्न होगी?
A.
File Found Error
File Found Error
B.
File Not Exist Error
File Not Exist Error
C.
File Not Found Error
File Not Found Error
D.
None of these
None of these
Question No# :
26
out of 50
How can you close a file in Python after processing?
प्रसंस्करण के बाद आप पायथन में किसी फ़ाइल को कैसे बंद कर सकते हैं?
A.
close_file()
close_file()
B.
file_close()
file_close()
C.
close()
close()
D.
end_file()
end_file()
Question No# :
27
out of 50
Which module in Python provides functions for file and directory manipulation?
पायथन में कौन सा मॉड्यूल फ़ाइल और फोल्डर में प्रोसेस के लिए फ़ंक्शन प्रदान करता है?
A.
os
os
B.
fileutils
fileutils
C.
filesystem
filesystem
D.
io
io
Question No# :
28
out of 50
<p>What will be written to the file?</p><pre><span style="font-size: 14px;">f = open("test.txt", "w")<br></span><span style="font-size: 14px;">f.write("ABC")<br></span><span style="font-size: 14px;">f.write("DEF")<br></span><span style="font-size: 14px;">f.close()</span></pre>
<p>फाइल में क्या लिखा जाएगा?</p><pre style="font-size: 12.6px; letter-spacing: 0.14px;"><span style="font-size: 14px;">f = open("test.txt", "w")<br></span><span style="font-size: 14px;">f.write("ABC")<br></span><span style="font-size: 14px;">f.write("DEF")<br></span><span style="font-size: 14px;">f.close()</span></pre>
A.
ABC
ABC
B.
DEF
DEF
C.
ABCDEF
ABCDEF
D.
Error
Error
Question No# :
29
out of 50
Which function is used to open a file in Python?
Python में file खोलने के लिए कौन-सा function उपयोग होता है?
A.
file()
file()
B.
open()
open()
C.
fopen()
fopen()
D.
load()
load()
Question No# :
30
out of 50
What does tell() return?
tell() क्या return करता है?
A.
File size
File size
B.
File name
File name
C.
Number of lines
Number of lines
D.
Current file pointer position
Current file pointer position
Question No# :
31
out of 50
Which of the function take takes two arguments?
कौन सा फंक्शन को दो आर्गूमेंट की जरूरत पड़ेगी
A.
dump()
dump()
B.
load()
load()
C.
Both A and B
Both A and B
D.
None of the above
None of the above
Question No# :
32
out of 50
Which function of pickle module is used to write data on binary file
बाइनरी फ़ाइल पर डेटा लिखने के लिए अचार मॉड्यूल का कौन सा फ़ंक्शन प्रयोग किया जाता है
A.
dump()
dump()
B.
write()
write()
C.
writeBinary()
writeBinary()
D.
load()
load()
Question No# :
33
out of 50
Which of the following is the correct way to write multiple lines to a file in Python?
पायथन में किसी फ़ाइल में एक से अधिक पंक्तियाँ लिखने का सही तरीका निम्नलिखित में से कौन सा है?
A.
Use multiple write() statements.
Use multiple write() statements.
B.
Use writelines() method.
Use writelines() method.
C.
Use writeLine() method.
Use writeLine() method.
D.
Use append() method.
Use append() method.
Question No# :
34
out of 50
What happens if a file opened in w mode already exists?
यदि file पहले से मौजूद है और उसे w mode में खोला जाए तो क्या होता है?
A.
Error is raised
Error is raised
B.
File is appended
File is appended
C.
File is read-only
File is read-only
D.
File is overwritten
File is overwritten
Question No# :
35
out of 50
Which method is used to read the entire content of a file as a string in Python?
पायथन में फ़ाइल के पूरे डाटा को स्ट्रिंग के रूप में पढ़ने के लिए किस फंक्शन का उपयोग किया जाता है?
A.
read()
read()
B.
readline()
readline()
C.
readlines()
readlines()
D.
load()
load()
Question No# :
36
out of 50
What does the 'r' mode signify when opening a file using open() in Python?
पायथन में ओपन() का उपयोग करके फ़ाइल खोलते समय 'r' मोड क्या दर्शाता है?
A.
Read mode
Read mode
B.
Write mode
Write mode
C.
Append mode
Append mode
D.
Binary mode
Binary mode
Question No# :
37
out of 50
Which function changes the current file position?
कौन सा फ़ंक्शन फ़ाइल की वर्तमान स्थिति को बदलता है?
A.
seek()
seek()
B.
move()
move()
C.
tell()
tell()
D.
shift()
shift()
Question No# :
38
out of 50
What does readlines() method return ?
रीडलाइन () मेथड क्या रिटर्न करता है?
A.
Dictionary
शब्दकोश
B.
String
स्ट्रिंग
C.
Tuple
टपल
D.
List
लिस्ट
Question No# :
39
out of 50
<p>What happens if the file does not exist?</p><pre><span style="font-size: 14px;">f = open("abc.txt", "r")</span></pre>
<p>यदि फ़ाइल मौजूद न हो तो क्या होगा?</p><pre style="font-size: 12.6px; letter-spacing: 0.14px;"><span style="font-size: 14px;">f = open("abc.txt", "r")</span></pre>
A.
New file is created
New file is created
B.
FileNotFoundError
FileNotFoundError
C.
Returns None
Returns None
D.
Opens empty file
Opens empty file
Question No# :
40
out of 50
What happens if file opened in write mode already exists?
यदि राइट मोड में खोली गई फाइल पहले से मौजूद हो तो क्या होगा?
A.
Data is appended
Data is appended
B.
Error occurs
Error occurs
C.
Old content is erased
Old content is erased
D.
Nothing happens
Nothing happens
Question No# :
41
out of 50
Work of tell() method in file processing is
फाइल प्रोसेसिंग में tell() फंक्शन का कार्य है
A.
Tells you the current position within the file.
Tells you the current position within the file.
B.
Tells the size of file you read
Tells the size of file you read
C.
Tells the start position of the file.
Tells the start position of the file.
D.
Tells the end position of the file.
Tells the end position of the file.
Question No# :
42
out of 50
What is full form of CSV?
सीएसवी का फुल फॉर्म क्या है?
A.
Comma Space Value
Comma Space Value
B.
Comma Separated Value
Comma Separated Value
C.
Common spaced Value
Common spaced Value
D.
Compact Structure View
Compact Structure View
Question No# :
43
out of 50
What is the default mode for files in Python?
पायथन में फ़ाइलों के लिए डिफ़ॉल्ट मोड क्या है?
A.
Write
Write
B.
Read
Read
C.
Append
Append
D.
Read and Write Both
Read and Write Both
Question No# :
44
out of 50
Which mode creates a new file if the file does not exist?
यदि फ़ाइल मौजूद नहीं है तो कौन सा मोड एक नई फाइल बनाता है?
A.
write mode
राइट मोड
B.
read mode
रीड मोड
C.
append mode
अपेण्ड मोड
D.
Both (A) And (C)
(A) और (C) दोनों
Question No# :
45
out of 50
Which of the following statements is used to check if a file exists in Python?
निम्नलिखित में से किस फंक्शन का उपयोग यह जांचने के लिए किया जाता है कि कोई फ़ाइल पायथन में मौजूद है या नहीं?
A.
file_exists()
file_exists()
B.
exists_file()
exists_file()
C.
os.path.exists()
os.path.exists()
D.
check_file()
check_file()
Question No# :
46
out of 50
What is the use of seek() method in files?
फाइलों में seek() फंक्शन का क्या उपयोग है?
A.
sets the file's current position at the offset
sets the file's current position at the offset
B.
sets the file's previous position at the offset
sets the file's previous position at the offset
C.
sets the file's current position within the file
sets the file's current position within the file
D.
None of these
None of these
Question No# :
47
out of 50
What is the Full form of EOL?
EOL का फुल फॉर्म क्या है?
A.
End of List
End of List
B.
End of Line
End of Line
C.
End of Loop
End of Loop
D.
End of Language
End of Language
Question No# :
48
out of 50
Which statement will return one line from a file (file object is f) ?
कौन सा स्टेटमेंट फ़ाइल (file object is 'f) से एक पंक्ति प्रस्तुत करेगा |
A.
f.readlines()
f.readlines()
B.
f.readline()
f.readline()
C.
f.read()
f.read()
D.
f.line()
f.line()
Question No# :
49
out of 50
Which mode creates a file if it does not exist?
कौन सा मोड ऐसी फ़ाइल बनाता है जो पहले से मौजूद न हो?
A.
w
w
B.
rb
rb
C.
rt
rt
D.
r
r
Question No# :
50
out of 50
Which of the following mode argument is used in file to truncate ?
निम्नलिखित में से किन मोड आर्गुमेंट का उपयोग ट्रंकेट करने के लिए उपयोग किया जाता है?
A.
a
a
B.
f
f
C.
w
w
D.
t
t
Online Exam Quiz for One day Exam
Online Typing Test
CCC Online Test 2026
Best Computer Training Institute in Prayagraj (Allahabad)
Best Java Training Institute in Prayagraj (Allahabad)
Best Python Training Institute in Prayagraj (Allahabad)
O Level Online Test in Hindi
Best Website and Software Company in Allahabad