FliQi Education App Download
प्रश्न-बैंक · Python

Token and Keywords — प्रश्न और उत्तर

Python · 22 जाँचे हुए (verified) प्रश्न

  • 22 जाँचे हुए प्रश्न
  • हिंदी + English

पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 12 के उत्तर और हल FliQi Question Bank app में।

भाषा
प्रश्न 1उत्तर + हल
Python programming में pass एक null statement है।
In Python programming, pass is a null statement.
  1. AहाँYes
  2. BनहींNo
  3. Cकह नहीं सकतेCan't say
  4. Dइनमें से कोई नहींNone of these

सही उत्तर / Answer: (A)

हल / Solution
pass Python का एक keyword है। यह चलने पर कुछ भी नहीं करता, इसलिए इसे null statement कहते हैं। Python में if, for, def या class के बाद कम से कम एक statement लिखना ज़रूरी है। जब वहाँ अभी कोई काम नहीं लिखना हो, तब pass रख देते हैं, जैसे def f(): pass। block ख़ाली छोड़ने पर IndentationError आता है। इसलिए कथन सही है और उत्तर 'हाँ' है।
pass is a Python keyword. When it runs it does nothing at all, so it is called a null statement. Python needs at least one statement after if, for, def or class. When you have nothing to write there yet, you put pass, for example def f(): pass. Leaving the block empty gives an IndentationError. So the statement is true and the answer is 'Yes'. The other options do not fit.
प्रश्न 2उत्तर + हल
Python में आरक्षित keyword (reserved keyword) चुनिए।
Select the reserved keyword in Python.
  1. Aimport
  2. Braise
  3. Celse
  4. Dउपरोक्त सभीAll of the above

सही उत्तर / Answer: (D)

हल / Solution
Reserved keyword वे शब्द हैं जिनका Python में पहले से तय अर्थ है। इन्हें variable या function के नाम की तरह इस्तेमाल नहीं कर सकते। import किसी module को program में लाता है। raise जान-बूझकर exception खड़ा करता है। else तब चलता है जब if की शर्त झूठी हो। तीनों keyword.kwlist की सूची में मौजूद हैं। इसलिए कोई एक विकल्प अकेला पूरा उत्तर नहीं है, सही उत्तर 'उपरोक्त सभी' है।
Reserved keywords are words that already have a fixed meaning in Python. You cannot use them as names of variables or functions. import brings a module into the program. raise throws an exception on purpose. else runs when the if condition is false. All three appear in keyword.kwlist. So no single option is the full answer, and the correct choice is 'All of the above'. Writing import = 5 gives a SyntaxError.
प्रश्न 3उत्तर + हल
निम्नलिखित में से कौन-सा keyword class definition की शुरुआत बताता है?
Which of the following keywords marks the beginning of a class definition?
  1. Adef
  2. Bclass
  3. Creturn
  4. Dउपरोक्त सभीAll of the above

सही उत्तर / Answer: (B)

हल / Solution
Python में नई class बनाने के लिए class keyword लिखा जाता है, जैसे class Student: और उसके बाद indent किया हुआ block। यही keyword बताता है कि यहाँ से class definition शुरू हो रही है। def keyword function बनाने के लिए होता है, class के लिए नहीं। return function के अंदर से कोई value वापस भेजता है। तीनों का काम अलग है, इसलिए 'उपरोक्त सभी' भी ग़लत है। सही उत्तर class है।
In Python a new class is created with the class keyword, for example class Student: followed by an indented block. This keyword tells Python that a class definition starts here. The def keyword is used to define a function, not a class. The return keyword sends a value back from inside a function. All three do different jobs, so 'All of the above' is also wrong. The correct answer is class.
प्रश्न 4उत्तर + हल
निम्नलिखित में से कौन-सा फ़ंक्शन सभी मिलानों (matches) की सूची लौटाता है?
Which of the following functions returns a list containing all matches?
  1. Afind
  2. Bfindall
  3. Cget
  4. Dcount

सही उत्तर / Answer: (B)

हल / Solution
पायथन के re मॉड्यूल में findall() फ़ंक्शन किसी pattern के सभी मिलान खोजकर उन्हें एक list में लौटाता है। जैसे re.findall('a', 'banana') का नतीजा ['a', 'a', 'a'] है। string का find() method सिर्फ़ पहले मिलान का index देता है, और न मिलने पर -1 देता है। count() सिर्फ़ गिनती देता है कि मिलान कितनी बार आया। get() dictionary से किसी key का मान लाता है। इसलिए सही उत्तर findall है।
In Python's re module, findall() finds every match of a pattern and returns them in a list. For example, re.findall('a', 'banana') gives ['a', 'a', 'a']. The string method find() returns only the index of the first match, or -1 if nothing is found. count() only tells how many times the match occurs. get() fetches the value of a key from a dictionary. So the function that returns a list of all matches is findall.
प्रश्न 5उत्तर + हल
निम्नलिखित में से कौन-सा ब्लॉक कोड के किसी हिस्से को त्रुटियों (errors) के लिए परखने देता है?
Which of the following blocks allows you to test a block of code for errors?
  1. Aexcept block
  2. Btry block
  3. Cfinally block
  4. Dइनमें से कोई नहींNone of these

सही उत्तर / Answer: (B)

हल / Solution
पायथन में try ब्लॉक के अंदर वह कोड रखा जाता है जिसे त्रुटि के लिए परखना हो। अगर वहाँ कोई एक्सेप्शन आता है, तो प्रोग्राम बंद होने के बजाय नियंत्रण except ब्लॉक पर चला जाता है। except ब्लॉक त्रुटि को संभालता है, परखता नहीं। finally ब्लॉक हर हाल में चलता है और सफ़ाई का काम करता है, जैसे फ़ाइल बंद करना। इसलिए कोड को परखने का काम try ब्लॉक करता है।
In Python, the code you want to test for errors goes inside a try block. If an exception occurs there, control moves to the except block instead of the program crashing. The except block handles the error; it does not test the code. The finally block always runs and is used for clean-up, such as closing a file. So the block that lets you test code for errors is the try block.
प्रश्न 6उत्तर + हल
निम्नलिखित में से कौन-सा पायथन का आरक्षित कीवर्ड (reserved keyword) नहीं है?
Which of the following is not a reserved keyword in Python?
  1. Aclass
  2. Bgoto
  3. Cand
  4. DNone

सही उत्तर / Answer: (B)

हल / Solution
आरक्षित कीवर्ड वे शब्द हैं जिनका पायथन में पहले से तय अर्थ है। class कीवर्ड नई क्लास बनाता है। and एक तार्किक ऑपरेटर है, जो दोनों शर्तें सही होने पर True देता है। None भी कीवर्ड है, जो 'कोई मान नहीं' बताता है। ध्यान दीजिए कि None बड़े N से लिखा जाता है। goto C जैसी भाषाओं में मिलता है, पर पायथन में goto नाम का कोई कीवर्ड नहीं है। इसलिए सही उत्तर goto है।
Reserved keywords are words with a fixed meaning in Python. class creates a new class. and is a logical operator that gives True only when both conditions are true. None is also a keyword; it means no value, and it is written with a capital N. goto exists in languages like C, but Python has no goto keyword at all. So among the given words, goto is the one that is not a reserved keyword.
प्रश्न 7उत्तर + हल
नीचे दिए फ़ंक्शन को देखिए:
all([2,4,0,6])
इस फ़ंक्शन का आउटपुट क्या होगा?
Study the following function:
all([2,4,0,6])
What will be the output of this function?
  1. AFalse
  2. BTrue
  3. Cerror
  4. Dअमान्य कोडInvalid code

सही उत्तर / Answer: (A)

हल / Solution
all() फ़ंक्शन तभी True देता है जब दिए गए iterable का हर मान सत्य (truthy) हो। अगर एक भी मान असत्य (falsy) हो, तो नतीजा False आता है। पायथन में 0 को falsy माना जाता है। सूची [2, 4, 0, 6] में 0 मौजूद है, इसलिए all() का नतीजा False है। 0 के बिना, जैसे [2, 4, 6], नतीजा True आता। यह कोड पूरी तरह सही है, इसलिए error या अमान्य कोड वाले विकल्प भी गलत हैं।
The all() function returns True only when every item in the iterable is truthy. If even one item is falsy, it returns False. In Python, 0 is treated as falsy. The list [2, 4, 0, 6] contains 0, so all() returns False. Without the 0, as in [2, 4, 6], the result would be True. The code itself is perfectly valid, so the error and invalid code options are wrong too.
प्रश्न 8उत्तर + हल
निम्नलिखित फ़ंक्शन का मान किसके बराबर निकाला जाता है?
pow(x,y,z)
Which of the following is correctly evaluated for this function?
pow(x,y,z)
  1. A(x**y) / z
  2. B(x / y) * z
  3. C(x**y) % z
  4. D(x / y) / z

सही उत्तर / Answer: (C)

हल / Solution
पायथन में pow() तीन आर्ग्युमेंट भी ले सकता है। pow(x, y, z) का मतलब है पहले x की घात y निकालना, फिर z से भाग देकर शेषफल लेना, यानी (x**y) % z। जैसे pow(2, 5, 3) में 2**5 = 32 और 32 % 3 = 2, इसलिए उत्तर 2 आता है। पायथन इसे तेज़ तरीके से निकालता है, बड़ी संख्या बनाए बिना। बाक़ी विकल्पों में / (भाग) या * (गुणा) है, जो pow() नहीं करता।
Python's pow() can take three arguments. pow(x, y, z) means raise x to the power y, then take the remainder after dividing by z, that is (x**y) % z. For example, pow(2, 5, 3): 2**5 is 32, and 32 % 3 is 2, so the result is 2. Python computes this efficiently without building a huge number. The other options use division or multiplication, which pow() does not do.
प्रश्न 9उत्तर + हल
नीचे दिए फ़ंक्शन को देखिए:
round(4.576)
इस फ़ंक्शन का आउटपुट क्या होगा?
Study the following function:
round(4.576)
What will be the output of this function?
  1. A4
  2. B3
  3. C576
  4. D5

सही उत्तर / Answer: (D)

हल / Solution
round() फ़ंक्शन को दूसरा आर्ग्युमेंट न दिया जाए, तो वह संख्या को निकटतम पूर्णांक में बदल देता है। 4.576 का दशमलव भाग 0.576 है, जो 0.5 से बड़ा है। इसलिए संख्या ऊपर की ओर 5 हो जाती है। 4 तब आता जब दशमलव भाग 0.5 से छोटा होता। 3 का यहाँ कोई आधार नहीं है। 576 सिर्फ़ दशमलव के बाद के अंक हैं, round() उन्हें अलग नहीं करता। इसलिए आउटपुट 5 है।
When no second argument is given, round() rounds a number to the nearest integer. In 4.576, the decimal part is 0.576, which is more than 0.5. So the number goes up to 5. The answer 4 would come only if the decimal part were below 0.5. The value 3 has no basis here. 576 is just the digits after the decimal point, and round() does not pull those out. So the output is 5.
प्रश्न 10उत्तर + हल
निम्नलिखित में से कौन-सा फ़ंक्शन पायथन भाषा का बिल्ट-इन (built-in) फ़ंक्शन है?
Which of the following functions is a built-in function in Python?
  1. Aprintf()
  2. Bprint()
  3. Cval()
  4. Dइनमें से कोई नहींNone of these

सही उत्तर / Answer: (B)

हल / Solution
बिल्ट-इन फ़ंक्शन वे हैं जो पायथन में पहले से मौजूद हैं। इन्हें लगाने के लिए कुछ import नहीं करना पड़ता। print() ऐसा ही फ़ंक्शन है, जो स्क्रीन पर आउटपुट दिखाता है, जैसे print('Hello')। printf() C भाषा का फ़ंक्शन है, पायथन का नहीं। val() भी पायथन में नहीं है, यह Visual Basic जैसी भाषाओं में मिलता है। print() बिल्ट-इन है, इसलिए 'इनमें से कोई नहीं' गलत है। सही उत्तर print() है।
Built-in functions are always available in Python without any import. print() is one of them; it shows output on the screen, as in print('Hello'). printf() belongs to the C language, not Python. val() does not exist in Python either; it is found in languages like Visual Basic. Since print() is a real built-in function, 'None of these' is wrong. So the correct answer is print().
आगे के 12 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
App खोलिए
प्रश्न 13उत्तर app में
पायथन भाषा में क्लास के अंदर की method क्या होती है?
What is a method inside a class in Python?
  1. Aऑब्जेक्ट (Object)Object
  2. Bफ़ंक्शन (Function)Function
  3. Cएट्रिब्यूट (Attribute)Attribute
  4. Dआर्ग्युमेंट (Argument)Argument
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 14उत्तर app में
पायथन में ऑब्जेक्ट-ओरिएंटेड प्रोग्रामिंग (OOP) के बारे में निम्नलिखित में से कौन-सा कथन सही है?
Which of the following statements is correct regarding the object-oriented programming concept in Python?
  1. Aक्लास वास्तविक दुनिया की चीज़ें हैं, जबकि ऑब्जेक्ट वास्तविक नहीं हैंClasses are real-world entities while objects are not real
  2. Bऑब्जेक्ट वास्तविक दुनिया की चीज़ें हैं, जबकि क्लास वास्तविक नहीं हैंObjects are real-world entities while classes are not real
  3. Cऑब्जेक्ट और क्लास दोनों वास्तविक दुनिया की चीज़ें हैंBoth objects and classes are real-world entities
  4. Dउपरोक्त सभीAll of the above
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 16उत्तर app में
पायथन में एक्सेप्शन हैंडलिंग (exception handling) में निम्नलिखित में से कौन-से कथन उपयोग होते हैं?
Which of the following statements are used in exception handling in Python?
  1. Aexcept
  2. Btry
  3. Cfinally
  4. Dउपरोक्त सभीAll of the Above
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 17उत्तर app में
पायथन में pickling की प्रक्रिया में ____________ शामिल है।
The process of pickling in Python includes ____________.
  1. Aपायथन ऑब्जेक्ट की संरचना (object hierarchy) को byte stream में बदलनाconversion of a Python object hierarchy into byte stream
  2. Bdatatable को list में बदलनाconversion of a datatable into a list
  3. Cbyte stream को पायथन ऑब्जेक्ट की संरचना में बदलनाconversion of a byte stream into Python object hierarchy
  4. Dlist को datatable में बदलनाconversion of a list into a datatable
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 18उत्तर app में
पायथन में id() फ़ंक्शन का क्या उपयोग है?
Which of the following is the use of the id() function in Python?
  1. Aपायथन में हर ऑब्जेक्ट की अलग id नहीं होतीEvery object in Python doesn't have a unique id
  2. Bपायथन में id फ़ंक्शन ऑब्जेक्ट की पहचान (identity) लौटाता हैIn Python Id function returns the identity of the object
  3. Cइनमें से कोई नहींNone of the mentioned
  4. Dउपरोक्त सभीAll of the mentioned
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 19उत्तर app में
निम्नलिखित में से कौन-सी अवधारणा पायथन का हिस्सा नहीं है?
Which of the following concepts is not a part of Python?
  1. Aपॉइंटर (Pointers)Pointers
  2. Bलूप (Loops)Loops
  3. Cडायनामिक टाइपिंग (Dynamic Typing)Dynamic Typing
  4. Dउपरोक्त सभीAll of the above
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 20उत्तर app में
पायथन रनटाइम पर अनाम (anonymous) फ़ंक्शन बनाने की सुविधा देता है। इसके लिए __________ नाम की संरचना का उपयोग होता है।
Python supports the creation of anonymous functions at runtime, using a construct called __________.
  1. Api
  2. Banonymous
  3. Clambda
  4. Dइनमें से कोई नहींnone of the mentioned
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 21उत्तर app में
पायथन में कोड का एक ब्लॉक (block) तय करने के लिए किसका उपयोग होता है?
Which of the following is used to define a block of code in Python?
  1. Aइंडेंटेशन (Indentation)Indentation
  2. Bकी (Key)Key
  3. Cब्रैकेट (Brackets)Brackets
  4. Dउपरोक्त सभीAll of the mentioned
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 22उत्तर app में
Python (Python 3) में सभी keywords किस रूप में लिखे होते हैं?
In Python (Python 3), all keywords are written in _________.
  1. Aपहला अक्षर बड़ा (Capitalized)Capitalized
  2. Bसभी छोटे अक्षर (lower case)lower case
  3. Cसभी बड़े अक्षर (UPPER CASE)UPPER CASE
  4. Dइनमें से कोई नहींNone of the mentioned
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
Token and Keywords के सभी 22 प्रश्न — उत्तर, हल और अभ्यास

FliQi Question Bank app में topic-वार अभ्यास, कठिनाई-स्तर और आपकी प्रगति।

  • पहला test मुफ़्त
  • हिंदी + English
  • जाँचे हुए उत्तर और हल

यह topic किन परीक्षाओं में आता है

Python के दूसरे topics

सभी topics