page-banner
Chapter-7 File Processing
Q1.
निम्नलिखित में से कौन सी फाइल किसी टेक्स्ट एडिटर में खोली जा सकती है?

Which of the following file can be opened in any text editor?
A. Binary
B. text
C. Both of the above
D. None of these
View Answer
Q2.
कौन सा कथन एक फ़ाइल (फ़ाइल ऑब्जेक्ट "f") से 5 अक्षर पढ़ेगा?

Which statement will read 5 characters from a file (file object “f”)?
A. f.read()
B. f.read(5)
C. f.reads(5)
D. None of these
View Answer
Q3.
tell() मेथड आपको फ़ाइल के भीतर वर्तमान स्थिति बताती है।

The tell() method tells you the current position within the file.
A. True
B. False
C. can’t say
D. None of these
View Answer
Q4.
बाइनरी फाइल में रीड और राइट दोनों के लिए एक फ़ाइल खोलता है।

Opens a file for both reading and writing in binary format.
A. rb+
B. Rb-
C. r
D. w
View Answer
Q5.
कर्रेंट वर्किंग डायरेक्टरी को प्रदर्शित करती है।

Method displays the current working directory.
A. tell()
B. getcwd()
C. seek()
D. dir()
View Answer
Q6.
............ पहली लाइन रीड करने के बाद कर्रेंट फाइल का पोजीशन रिटर्न करता है |

__________ return the current file position after reading the first line.
A. tell()
B. readline()
C. seek()
D. scanoneline()
View Answer
Q7.
__________ एक विधि है जो ऑफसेट पर फ़ाइल की वर्तमान स्थिति निर्धारित करती है।

__________ is a method sets the file's current position at the offset.
A. tell()
B. readline()
C. seek()
D. scanoneline()
View Answer
Q8.
............ का प्रयोग फाइल ऑब्जेक्ट (fp) को क्लोज करने के लिए होता है |

__________ is used to close a file object (fp).
A. fp.exit()
B. fp.close()
C. fp.break()
D. fp.shutdown()
View Answer
Q9.
..................... एक पूरा लाइन फाइल में से रीड करता है |

__________ reads one entire line from the file.
A. tell()
B. readline()
C. seek()
D. scanoneline()
View Answer
Q10.
__________ फ़ंक्शन फ़ाइल प्रोसेसिंग के दौरान पैरामीटर फ़ाइल नाम और मोड लेता है।

The __________ function takes the parameter file name and the mode during file processing.
A. tell()
B. open()
C. seek()
D. *
View Answer
Q11.
रवि ने open() फ़ंक्शन का उपयोग करके पायथन में एक फ़ाइल खोली लेकिन मोड निर्दिष्ट करना भूल गया। फ़ाइल किस मोड में खुलेगी?

Ravi opened a file in python using open( ) function but forgot to specify the mode. In which mode the file will open?
A. write
B. append
C. read
D. Both read and write
View Answer
Q12.
कौन सा कथन फ़ाइल पॉइंटर को वर्तमान स्थिति से 10 बाइट्स पीछे ले जाएगा?

Which statement will move file pointer 10 bytes backward from current position?
A. f.seek(-10,0)
B. f.seek(-10,1)
C. f.seek(10,0)
D. None of the above
View Answer
Q13.
कौन सा कथन एक फ़ाइल से एक पंक्ति लौटाएगा यदि फाइल ऑब्जेक्ट f हो

Which statement will return one line from a file (file object is “f”)?
A. f.readlines()
B. f.readline()
C. f.read()
D. f.line()
View Answer
Q14.
यदि फ़ाइल मौजूद नहीं है तो कौन सा मोड एक नई फ़ाइल बनाता है?

Which mode creates a new file if the file does not exist?
A. write mode
B. append mode
C. both (A) & (B)
D. none of the above
View Answer
Q15.
पायथन में कौन सा फ़ंक्शन फ़ाइल खोलता है?

Which function opens file in python?
A. open()
B. Open()
C. new()
D. None of above
View Answer
Q16.
स्टेटमेंट 3 के लिए उत्तर चुनें

Choose the answer for statement 3.
import ____________  # statement 1
rec = []
while True:
    rn = int(input("Enter"))
    nm = input("Enter")
    temp = [rn, nm]
    rec.append(temp)
    ch = input("Enter choice (Y/N)")
    if ch.upper() == "N":
        break
f = open("stud.dat", " ____________ ")  # statement 2
____________.dump(rec, f)  # statement 3
__________.close()  # statement 4
A. unpickle
B. pickle
C. write
D. None of above
View Answer
Q17.
स्टेटमेंट 1 के लिए उत्तर चुनें

Choose the answer for statement 1.
import __________  # statement 1
rec = []
while True:
    rn = int(input("Enter"))
    nm = input("Enter")
    temp = [rn, nm]
    rec.append(temp)
    ch = input("Enter choice (Y/N)")
    if ch.upper() == "N":
        break
f = open("stud.dat", " __________ ")  # statement 2
__________.dump(rec, f)  # statement 3
__________.close()  # statement 4
A. csv
B. load
C. pickle
D. unpickle
View Answer
Q18.
रिक्त स्थान को भरें।

Fill in the blank.
import pickle
f=open("data.dat", "rb")
d=____________.load(f)
f.close()
A. unpickle
B. pickling
C. pickle
D. pick
View Answer
Q19.
निम्नलिखित पंक्ति को फंक्शनल बनाने के लिए कौन सा मॉड्यूल इम्पोर्ट किया जाना चाहिए

Which module to be imported to make the following line functional
sys.stdout.write("ABC")
A. system
B. stdin
C. stdout
D. sys
View Answer
Q20.
स्टेटमेंट 2 के लिए उत्तर चुनें।

Choose the answer for statement 2.
import __________  # statement 1
rec = []
while True:
    rn = int(input("Enter"))
    nm = input("Enter")
    temp = [rn, nm]
    rec.append(temp)
    ch = input("Enter choice (Y/N)")
    if ch.upper() == "N":
        break
f = open("stud.dat", " __________ ")  # statement 2
__________.dump(rec, f)  # statement 3
__________.close()  # statement 4
A. w
B. wb
C. w+
D. write
View Answer
Q21.
स्टेटमेंट 4 के लिए उत्तर चुनें।

Choose the answer for statement 4.
import __________  # statement 1
rec = []
while True:
    rn = int(input("Enter"))
    nm = input("Enter")
    temp = [rn, nm]
    rec.append(temp)
    ch = input("Enter choice (Y/N)")
    if ch.upper() == "N":
        break
f = open("stud.dat", " __________ ")  # statement 2
__________.dump(rec, f)  # statement 3
__________.close()  # statement 4
A. f
B. rec
C. file
D. stud
View Answer
Q22.
निम्नलिखित कोड का आउटपुट क्या होगा?

What will be the output of the following code?
f=open("demo.txt","r")
print(f.tell())
A. 1
B. 2
C. -1
View Answer
Q23.
निम्नलिखित कोड का आउटपुट क्या होगा?

What will be the output of the following code?
f=open("demo.txt","w+")
f.write("Welcome to Python")
f.seek(5)
a=f.read(5)
print(a)
A. Welco
B. me to
C. Welcome to Python
D. e to
View Answer
Q24.
os.getlogin() क्या लौटाता है?

What does os.getlogin() return?
A. वर्तमान लॉगिन उपयोगकर्ता का नाम/Name of the current user logged in
B. एक अलग उपयोगकर्ता के रूप में लॉगिन करने के लिए फ़ॉर्म प्राप्त करता है/Gets a form to login as a different user
C. सुपरयूज़र का नाम/Name of the superuser
D. उपरोक्त सभी/All of the above
View Answer
Q25.
निम्नलिखित में से कौन सा फ़ंक्शन दो आर्गुमेंट लेता है?

Which of the following function takes two arguments?
A. load()
B. dump()
C. उपरोक्त दोनों/Both of above
D. उपरोक्त में से कोई नहीं/None of above
View Answer
Q26.
निम्नलिखित में से कौन सा फ़ाइल में बेसिक I/O कनेक्शन है

Which of the following is the basic I/O connections in file?
A. Standard Input
B. Standard Output
C. Standard Errors
D. सभी वर्णित/All of the mentioned
View Answer
Q27.
कौन सा फ़ंक्शन स्ट्रिंग्स लौटाता है?

Which function returns the strings?
A. readline()
B. read()
C. दोनों उपरोक्त/Both of above
D. इनमें से कोई नहीं/None of these
View Answer
Q28.
इनमें से कौन सी फ़ाइल की विशेषता नहीं है?

Which one is not the attribute of a file?
A. softspace
B. mode
C. closed
D. rename
View Answer
Q29.
निम्नलिखित में से कौन सा फ़ाइल खोलने का सही तरीका नहीं है?

Which of the following is not a correct mode to open a file?
A. ab
B. rw
C. a+
D. r+
View Answer
Q30.
किसी फ़ाइल का नाम बदलने के लिए प्रयुक्त सिंटैक्स:

The syntax used to rename a file:
A. os.rename(existing_name, new_name)
B. fp.name = “new_name.txt”
C. os.rename(fp, new_name)
D. os.set_name(existing_name, new_name)
View Answer
Q31.
यदि हम किसी फ़ाइल को राइट मोड में खोलते हैं और फ़ाइल मौजूद नहीं है, तो कौन सी त्रुटि उत्पन्न होगी?

If we open a file in write mode and file does not exists, which of the error will generate?
A. File Found Error
B. File Not Exist Error
C. File Not Found Error
D. इनमें से कोई नहीं/None of these
View Answer
Q32.
फ़ाइल ऑब्जेक्ट infile से फ़ाइल की शेष पंक्तियों को पढ़ने का कार्य कौन सा है?

Which is the function to read the remaining lines of the file from a file object infile?
A. infile.read(2)
B. infile.read()
C. infile.readlines()
D. infile.readline()
View Answer
Q33.
सभी अक्षरों को पढ़ने के लिए किस फ़ंक्शन का उपयोग किया जाता है?

Which function is used to read all the characters?
A. readall()
B. read()
C. readcharacters()
D. readchar()
View Answer
Q34.
बाइनरी प्रारूप में डेटा लिखने के लिए उपयोग किया जाने वाला एक फ़ंक्शन:

A function used for writing data in the binary format:
A. write
B. output
C. send
D. dump
View Answer
Q35.
निम्नलिखित में से कौन सा अमान्य मोड है?

Which of the following is an invalid mode?
A. a
B. ar+
C. r+
D. w
View Answer
Q36.
os.close(f) क्या करता है?

What does os.close(f) do?
A. प्रोसेस f को समाप्त करता है/terminate the process f
B. यदि f प्रतिक्रिया नहीं दे रहा है तो इसे समाप्त करें/terminate the process f if f is not responding
C. फ़ाइल डिस्क्रिप्टर f को बंद करता है/close the file descriptor f
D. फ़ाइल पॉइंटर एंड के कितने पास है यह बताता है/return an integer telling how close the file pointer is to the end of file
View Answer
Q37.
seek() की सिंटैक्स है:

The syntax of seek() is:
file_object.seek(offset[, reference_point])

reference_point का क्या अर्थ है?
What does the reference_point indicate?
A. reference_point वर्तमान स्थिति को दर्शाता है / indicates the current position of the file object
B. reference_point प्रारंभिक स्थिति को दर्शाता है / indicates the starting position of the file object
C. reference_point अंतिम स्थिति को दर्शाता है / indicates the ending position of the file object
D. इनमें से कोई नहीं / None of the above
View Answer
Q38.
एक Python प्रोग्राम कमांड लाइन से कितने आर्गुमेंट स्वीकार कर सकता है?

How many arguments a Python program can accept from the command line?
A. एक / one
B. दो / Two
C. तीन / Three
D. कोई भी संख्या / any
View Answer
Q39.
readlines() विधि क्या लौटाती है?

What does readlines() method return?
A. डिक्शनरी / Dictionary
B. स्ट्रिंग / String
C. ट्यूपल / Tuple
D. सूची / List
View Answer
Q40.
जब हम फ़ाइल को एपेंड मोड में खोलते हैं तो फ़ाइल पॉइंटर फ़ाइल के ……….. पर होता है।

When we open file in append mode the file pointer is at the ……….. of the file.
A. फ़ाइल के बीच में कहीं भी / anywhere in between the file
B. अंत में / end
C. शुरुआत में / beginning
D. दूसरी पंक्ति पर / second line of the file
View Answer
Q41.
कौन सा कथन फ़ाइल पॉइंटर को अंतिम स्थिति से 10 बाइट पीछे ले जाएगा?

Which statement will move file pointer 10 bytes backward from last position?
A. f.seek(-10, 2)
B. f.seek(10, 0)
C. f.seek(-10, 1)
D. None
View Answer
Q42.
निम्नलिखित का आउटपुट क्या होगा?

What will be the output of the following?
import sys
sys.stdout.write('Welcome\n')
sys.stdout.write('All\n')
A. Welcome All
B. Welcome
All
C. Compilation Error
D. Runtime Error
View Answer
Q43.
निम्नलिखित में से कौन सी त्रुटि दिए गए कोड द्वारा लौटाई गई है

Which of the following error is returned by the given code?
>>> f = open("test.txt", "w")
>>> f.write(345)
A. Syntax Error
B. Type Error
C. String Error
D. Run Time Error
View Answer
Q44.
कौन सा कथन फ़ाइल से एक पंक्ति लौटाएगा (फ़ाइल ऑब्जेक्ट 'f' है)

Which statement will return one line from a file (file object is ‘f’)
A. f.readlines()
B. f.readline()
C. f.read()
D. f.line()
View Answer
Q45.
f.read(5) एक फ़ाइल (फ़ाइल ऑब्जेक्ट 'f') से ………… पढ़ेगा।

f.read(5) will read …………… from a file (file object ‘f’).
A. 5 characters
B. 5 words
C. 5 lines
D. None of these
View Answer
Q46.
यदि फ़ाइल मौजूद नहीं है तो कौन सा मोड एक नई फ़ाइल बनाता है?

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
View Answer
Q47.
निम्नलिखित में से कौन फ़ाइल की संपूर्ण सामग्री को पढ़ेगा (फ़ाइल ऑब्जेक्ट 'f')

Which of the following will read entire content of file (file object ‘f’)
A. f.reads()
B. f.read()
C. f.read(all)
D. f.read(*)
View Answer
Q48.
बाइनरी फ़ाइल में किस प्रारूप में जानकारी होती है?

In which format Binary file contains information?
A. क्विक प्रतिक्रिया कोड/Quick response code
B. वही प्रारूप जिसमें डेटा मेमोरी में रखा जाता है/Same format in which the data is held in memory
C. एएससीआईआई प्रारूप/ASCII format
D. यूनिकोड प्रारूप/Unicode format
View Answer
Q49.
………………. एक जानकारी को ASCII या यूनिकोड वर्णों की एक धारा के रूप में संग्रहीत करता है अर्थात मानव पठनीय।

A ………………. stores information in the form of a stream of ASCII or Unicode characters i.e., human readable.
A. Text file
B. Binary file
C. Both A and B
D. None of these
View Answer
Q50.
निम्नलिखित कथन में 'f' क्या है?

What is ‘f’ in the following statement?
f = open("Data.txt", "r")
A. फ़ाइल का नाम/File Name
B. फ़ाइल हैंडल/File Handle
C. फ़ाइल का मोड/Mode of file
D. फ़ाइल हैंडलिंग/File Handling
View Answer
Q51.
बाइनरी मोड में डेटा लिखने के लिए किस फ़ंक्शन का उपयोग किया जाता है?

Which function is used to write data in binary mode?
A. write
B. writelines
C. dump
D. pickle
View Answer
Q52.
Sys.argv में प्रत्येक एलिमेंट का प्रकार क्या है?

What is the type of each element in sys.argv?
A. सेट / set
B. सूची / list
C. ट्यूपल / tuple
D. स्ट्रिंग / string
View Answer
Q53.
sys.argv की लंबाई कितनी है?

What is the length of sys.argv?
A. number of arguments
B. number of arguments + 1
C. number of arguments – 1
D. none of the mentioned
View Answer
Q54.
……… फ़ाइल में लिखने से पहले संरचना को बाइट स्ट्रीम में परिवर्तित करने की प्रक्रिया को संदर्भित करता है।

…… refers to the process of converting the structure to a byte stream before writing it to the file.
A. pickling
B. unpickling
C. reading
D. writing
View Answer
Q55.
Sys.argv[0] में संग्रहीत मान क्या है?

What is the value stored in sys.argv[0]?
A. null
B. you cannot access it
C. the program’s name
D. the first argument
View Answer
Q56.
कमांड लाइन से प्राप्त आर्गुमेंट कहाँ संग्रहीत हैं?

Where are the arguments received from the command line stored?
A. sys.argv
B. os.argv
C. argv
D. none of the mentioned
View Answer
Q57.
निम्नलिखित में से कौन सा फ़ंक्शन हमें पायथन के उस संस्करण को खोजने में मदद कर सकता है जिस पर हम वर्तमान में काम कर रहे हैं?

Which of the following functions can help us to find the version of python that we are currently working on?
A. sys.version
B. sys.version()
C. sys.version(0)
D. sys.version(1)
View Answer
Q58.
निम्नलिखित में से कौन सा फ़ंक्शन sys मॉड्यूल के अंतर्गत परिभाषित नहीं है?

Which of the following functions is not defined under the sys module?
A. sys.platform
B. sys.path
C. sys.readline
D. sys.argv
View Answer
Q59.
निम्नलिखित में से कौन सी विधि पूर्णांक मान लौटाती है।

Which of the following method returns an integer value?
A. seek()
B. read()
C. tell()
D. readline()
View Answer
Q60.
निम्नलिखित का आउटपुट लिखें

Write the output of the following:
f = open("test.txt", "w+")
f.write("GyanXp-App")
f.seek(5)
a = f.read(3)
print(a)
A. Gya
B. Xp-
C. p-A
D. No output
View Answer