File Processing in Python

1 / 64

What will be the output of the following Python code? (If entered name is sanfoundry)
निम्नलिखित पायथन कोड का आउटपुट क्या होगा? (यदि नाम sanfoundry दर्ज किया गया है)
import sys
print 'Enter your name: ',
name = ''
while True:
c = sys.stdin.read(1)
if c == '\n':
break
name = name + c

print 'Your name is:', name

2 / 64

Which function is used to close a file in python?
पायथन में फ़ाइल को बंद करने के लिए किस फ़ंक्शन का उपयोग किया जाता है?

3 / 64

How do you get the name of a file from a file object (fp)?
आप फ़ाइल ऑब्जेक्ट (fp) से फ़ाइल का नाम कैसे प्राप्त करते हैं?

4 / 64

Which of the following are the modes of both writing and reading in binary format in file?
निम्नलिखित में से कौन-से फ़ाइल में बाइनरी प्रारूप में लिखने और पढ़ने के तरीके हैं?

5 / 64

what is the current syntax of remove() a file?
किसी फ़ाइल को remove() करने का वर्तमान सिंटैक्स क्या है?

6 / 64

To open a file c:\scores.txt for reading, we use _____________
पढ़ने के लिए फ़ाइल c:\scores.txt खोलने के लिए, हम _____________ का उपयोग करते हैं

7 / 64

Is it possible to create a text file in python?
क्या पायथन में टेक्स्ट फ़ाइल बनाना संभव है?

8 / 64

Which of the following statements are true?
निम्नलिखित में से कौन से कथन सत्य हैं?

9 / 64

How do you delete a file?
आप किसी फ़ाइल को कैसे हटाते हैं?

10 / 64

What is the use of truncate() method in file?
फ़ाइल में truncate() विधि का उपयोग क्या है?

11 / 64

The readlines() method returns ____________
readlines() विधि ____________ लौटाती है

12 / 64

f.seek(0) is used to
f.seek(0) का प्रयोग किया जाता है

13 / 64

To read the next line of the file from a file object infile, we use ____________
फ़ाइल ऑब्जेक्ट इनफ़ाइल से फ़ाइल की अगली पंक्ति पढ़ने के लिए, हम ____________ का उपयोग करते हैं

14 / 64

To open a file c:\scores.txt for writing, we use ____________
लिखने के लिए c:\scores.txt फ़ाइल खोलने के लिए, हम ____________ का उपयोग करते हैं

15 / 64

What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
str = input("Enter your input: ");
print "Received input is : ", str

16 / 64

What is unpickling?
अनपिकलिंग क्या है?

17 / 64

What is the use of “a” in file handling?
फ़ाइल हैंडलिंग में “a” का क्या उपयोग है?

18 / 64

correct syntax of file.writelines() is?
file.writelines() का सही सिंटैक्स क्या है?

19 / 64

To read two characters from a file object infile, we use ____________
फ़ाइल ऑब्जेक्ट से दो अक्षर पढ़ने के लिए, हम ____________ का उपयोग करते हैं

20 / 64

To open a file c:\scores.txt for appending data, we use ____________
डेटा जोड़ने के लिए c:\scores.txt फ़ाइल खोलने के लिए, हम ____________ का उपयोग करते हैं

21 / 64

How do you rename a file?
आप किसी फ़ाइल का नाम कैसे बदलते हैं?

22 / 64

which of the following is correct to identify the right way to close a file
किसी फ़ाइल को बंद करने का सही तरीका पहचानने के लिए निम्न में से कौन सा सही है

23 / 64

method is used to display entire contents of the file
फ़ाइल की संपूर्ण सामग्री प्रदर्शित करने के लिए विधि का उपयोग किया जाता है

24 / 64

What is the use of “w” in file handling?
फ़ाइल हैंडलिंग में "w" का क्या उपयोग है?

25 / 64

What is the correct syntax of open() function?
open() फ़ंक्शन का सही सिंटैक्स क्या है?

26 / 64

What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
f = None
for i in range (5):
with open("data.txt", "w") as f:
if i > 2:
break
print(f.closed)

27 / 64

Which of the following is not a valid mode to open a file?
निम्नलिखित में से कौन सा फ़ाइल खोलने का वैध तरीका नहीं है?

28 / 64

To read the remaining lines of the file from a file object infile, we use ____________
फ़ाइल ऑब्जेक्ट इनफ़ाइल से फ़ाइल की शेष पंक्तियों को पढ़ने के लिए, हम ____________ का उपयोग करते हैं

29 / 64

Which function is used to read all the characters?
सभी अक्षरों को पढ़ने के लिए किस फ़ंक्शन का उपयोग किया जाता है?

30 / 64

which of the following mode will refer to binary data?
निम्नलिखित में से कौन सा मोड बाइनरी डेटा को संदर्भित करेगा?

31 / 64

if argument is 0, then
यदि argument 0 है, तो

32 / 64

What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
import sys
sys.stdout.write(' Hello\n')
sys.stdout.write('Python\n')

33 / 64

which function is used to read single line from file?
फ़ाइल से सिंगल लाइन पढ़ने के लिए किस फ़ंक्शन का उपयोग किया जाता है?

34 / 64

In file handling, what does this terms means “r, a”?
फ़ाइल हैंडलिंग में, इस शब्द " r, a " का क्या अर्थ है?

35 / 64

What is the use of tell() method in python?
पायथन में tell() विधि का उपयोग क्या है?

36 / 64

What is the use of seek() method in files?
फ़ाइलों में seek() विधि का उपयोग क्या है?

37 / 64

Which function is used to write a list of string in a file?
किसी फ़ाइल में स्ट्रिंग की सूची लिखने के लिए किस फ़ंक्शन का उपयोग किया जाता है?

38 / 64

the most basic task involved in file manipulation are:
फ़ाइल मैनिपुलेशन में शामिल सबसे बुनियादी कार्य हैं:

39 / 64

How do you close a file object (fp)?
आप फ़ाइल ऑब्जेक्ट (fp) को कैसे बंद करते हैं?

40 / 64

What is the current syntax of rename() a file?
किसी फ़ाइल का नाम बदलने (rename()) का वर्तमान सिंटैक्स क्या है?

41 / 64

what is the value stored in sys.argv[0]?
sys.argv[0] में संग्रहीत मान क्या है?

42 / 64

Which one of the following is not attributes of file?
निम्नलिखित में से कौन सी फ़ाइल की विशेषता नहीं है?

43 / 64

To read the entire remaining contents of the file as a string from a file object infile, we use ____________
फ़ाइल ऑब्जेक्ट इनफ़ाइल से फ़ाइल की संपूर्ण शेष सामग्री को एक स्ट्रिंग के रूप में पढ़ने के लिए, हम ____________ का उपयोग करते हैं

44 / 64

What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
fo = open("foo.txt", "rw+")
print "Name of the file: ", fo.name

# Assuming file has following 5 lines
# This is 1st line
# This is 2nd line
# This is 3rd line
# This is 4th line
# This is 5th line

for index in range(5):
line = fo.next()
print "Line No %d - %s" % (index, line)

# Close opened file
fo.close()

45 / 64

Which of the following is not a valid attribute of a file object (fp)?
निम्नलिखित में से कौन सा फ़ाइल ऑब्जेक्ट (fp) की वैध विशेषता नहीं है?

46 / 64

Which is/are the basic I/O connections in file?
फ़ाइल में मूल I/O कनेक्शन कौन सा है/हैं?

47 / 64

What is the current syntax of remove() a file?
किसी फ़ाइल को remove() करने का वर्तमान सिंटैक्स क्या है?

48 / 64

Which function is used to read single line from file?
फ़ाइल से सिंगल लाइन पढ़ने के लिए किस फ़ंक्शन का उपयोग किया जाता है?

49 / 64

What is the difference between r+ and w+ modes?
r+ और w+ मोड के बीच क्या अंतर है?

50 / 64

How do you get the current position within the file?
आप फ़ाइल में वर्तमान स्थिति कैसे प्राप्त करेंगे?

51 / 64

What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
fo = open("foo.txt", "wb")
print "Name of the file: ", fo.name
fo.flush()
fo.close()

52 / 64

which of the following mode argument is used to truncate?
निम्नलिखित में से कौन सा मोड तर्क ट्रंकेट करने के लिए उपयोग किया जाता है?

53 / 64

What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
str = raw_input("Enter your input: ");
print "Received input is : ", str

54 / 64

What happens if no arguments are passed to the seek function?
यदि सीक फ़ंक्शन को कोई argument नहीं दिया जाता है तो क्या होगा?

55 / 64

Correct syntax of file.readlines() is?
File.readlines() का सही सिंटैक्स क्या है?

56 / 64

Correct syntax of file.writelines() is?
File.writelines() का सही सिंटैक्स क्या है?

57 / 64

Which are the two built-in functions to read a line of text from standard input, which by default comes from the keyboard?
मानक इनपुट से पाठ की एक पंक्ति को पढ़ने के लिए दो अंतर्निहित फ़ंक्शन कौन से हैं, जो डिफ़ॉल्ट रूप से कीबोर्ड से आते हैं?

58 / 64

which one of the following is not attributes of file?
निम्नलिखित में से कौन-सा एक फ़ाइल की विशेषता नहीं है?

59 / 64

Which of the following mode will refer to binary data?
निम्नलिखित में से कौन सा मोड बाइनरी डेटा को संदर्भित करेगा?

60 / 64

What is the pickling?
pickling क्या है?

61 / 64

How do you change the file position to an offset value from the start?
आप फ़ाइल की स्थिति को प्रारंभ से ही ऑफसेट मान में कैसे बदलते हैं?

62 / 64

Which function is used to write all the characters?
सभी कैरेक्टर्स को लिखने के लिए किस फंक्शन का उपयोग किया जाता है?

63 / 64

to open a file c:/akitsolution.txt for reading, we use
c:/akitsolution.txt फ़ाइल को पढ़ने के लिए खोलने के लिए, हम उपयोग करते हैं

64 / 64

the …….method returns our current position (in number of bytes).
…….विधि हमारी वर्तमान स्थिति (बाइट्स की संख्या में) लौटाती है।

Your score is

The average score is 53%

0%