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

Queue — प्रश्न और उत्तर

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

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

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

भाषा
प्रश्न 1उत्तर + हल
आउटपुट-रिस्ट्रिक्टेड डेक दोनों सिरों पर ............ की अनुमति देता है और केवल एक सिरे पर ............ की।
An output-restricted dequeue allows ........... at both ends and ..... at only one end.
  1. Aडिलीशन, इंसर्शनdeletion, insertion
  2. Bइंसर्शन, डिलीशनinsertion, deletion
  3. Cपुश, पॉप (PUSH, POP)PUSH, POP
  4. Dकेवल इंसर्शन की अनुमति देता है, डिलीशन की नहींAllows only insertion, not deletion

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

हल / Solution
नाम में जिस क्रिया पर रोक लगी है, वही एक सिरे तक सीमित रहती है। आउटपुट-रिस्ट्रिक्टेड डेक में आउटपुट यानी डिलीशन पर रोक है, इसलिए एलिमेंट निकलेगा केवल एक सिरे से, जबकि डालना दोनों सिरों पर चलेगा। पहला विकल्प इसका उलटा कहता है और वह इनपुट-रिस्ट्रिक्टेड डेक का नियम है। पुश और पॉप स्टैक के ऑपरेशन हैं। चौथा विकल्प कहता है कि डिलीशन होता ही नहीं, जो किसी भी डेक के लिए ग़लत है।
Whichever operation the name restricts is the one limited to a single end. In an output restricted deque the output, that is deletion, is restricted, so elements can leave from one end only, while insertion is allowed at both ends. The first option states the reverse and actually describes an input restricted deque. PUSH and POP are stack operations. The fourth option claims that deletion never happens, which is wrong for any deque.
प्रश्न 2उत्तर + हल
क्यू किसमें प्रमुख भूमिका निभाती है?
A queue serves a major role in
  1. Aरिकर्शन के सिमुलेशन मेंsimulation of recursion
  2. Bमनमानी लिंक्ड लिस्ट के सिमुलेशन मेंsimulation of arbitrary linked list
  3. Cलिंक्ड रिसोर्स एलोकेशन के सिमुलेशन मेंsimulation of linked resource allocation
  4. Dएक्सप्रेशन इवैल्यूएशन मेंexpression evaluation

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

हल / Solution
जहाँ कई माँग करने वाले हों और संसाधन एक-एक करके मिलना हो, वहाँ क्यू चाहिए — जैसे सीपीयू शेड्यूलिंग, प्रिंटर स्पूलिंग या डिस्क की माँगें। जो माँग पहले आई उसे पहले संसाधन मिलता है, यही फ़ीफ़ो (First In First Out) न्याय है। रिकर्शन में पिछली कॉल सबसे बाद में लौटती है, इसलिए वहाँ स्टैक लगता है। एक्सप्रेशन इवैल्यूएशन में भी स्टैक ही चाहिए। लिंक्ड लिस्ट ख़ुद एक संरचना है, क्यू का काम नहीं।
Wherever many requests compete and the resource is handed out one at a time, a queue is needed, as in CPU scheduling, printer spooling or disk requests. The request that arrived first gets the resource first, which is the fairness of First In First Out. In recursion the most recent call returns first, so a stack is required there. Expression evaluation also needs a stack. A linked list is itself a structure and is not a job for a queue.
प्रश्न 3उत्तर + हल
जब किसी सर्कुलर क्यू के ऐरे रूप में केवल एक ही एलिमेंट हो, तब उसके बारे में क्या कहा जा सकता है?
What can be said about the array representation of a circular queue when it contains only one element?
  1. AFront = Rear = नल (null)Front = Rear = null
  2. BFront = Rear + 1
  3. CFront = Rear - 1
  4. DFront = Rear

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

हल / Solution
सर्कुलर क्यू में फ़्रंट सबसे पुराने एलिमेंट की जगह बताता है और रियर सबसे नए की। जब केवल एक ही एलिमेंट बचा हो तो पुराना और नया वही एक है, इसलिए दोनों सूचक एक ही जगह पर आ जाते हैं, यानी Front = Rear। पहला विकल्प ख़ाली क्यू का हाल बताता है। बाक़ी दोनों रूप तब बनते हैं जब दो या अधिक एलिमेंट हों या क्यू भरी हो; एक एलिमेंट की स्थिति में वे नहीं बनते।
In a circular queue the front marks the position of the oldest element and the rear marks the newest one. When only a single element is left, the oldest and the newest are the same item, so both pointers land on the same position, that is Front = Rear. The first option describes an empty queue instead. The other two relations arise when two or more elements are present or when the queue is full, not for a single element.
प्रश्न 4उत्तर + हल
उस डेटा संरचना की पहचान कीजिए जो सूची के दोनों सिरों पर डिलीशन की अनुमति देती है पर इंसर्शन केवल एक सिरे पर।
Identify the data structure which allows deletions at both ends of the list but insertion at only one end.
  1. Aइनपुट-रिस्ट्रिक्टेड डेक (input-restricted dequeue)input-restricted dequeue
  2. Bआउटपुट-रिस्ट्रिक्टेड डेक (output-restricted dequeue)output-restricted dequeue
  3. Cप्रायोरिटी क्यू (priority queue)priority queue
  4. Dये सभीAll of these

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

हल / Solution
डेक यानी डबल एंडेड क्यू के दो सीमित रूप हैं और नाम इनपुट या आउटपुट पर लगी रोक से पड़ा है। इनपुट-रिस्ट्रिक्टेड डेक में इनपुट पर रोक है, यानी डालना केवल एक सिरे से और निकालना दोनों सिरों से। आउटपुट-रिस्ट्रिक्टेड डेक इसका उलटा है — डालना दोनों सिरों से, निकालना एक से। प्रायोरिटी क्यू सिरों से नहीं, प्राथमिकता के मान से चलती है। इसलिए 'ये सभी' भी ठीक नहीं बैठता।
A deque, or double ended queue, has two restricted forms, and each name comes from the operation that is restricted. In an input restricted deque the input is limited, so insertion happens at one end only while deletion is allowed at both ends. The output restricted deque is the reverse, allowing insertion at both ends and deletion at one. A priority queue works by priority values rather than ends, so the last option does not fit either.
प्रश्न 5उत्तर + हल
प्रायोरिटी क्यू से जब कोई एलिमेंट हटाना होता है, तो किस प्राथमिकता वाले आइटम को सबसे पहले हटाया जाता है?
When an element has to be removed from a priority queue, the item with the ........ priority is removed first.
  1. Aनिम्नतम (lowest)lowest
  2. Bउच्चतम (highest)highest
  3. Cऔसत (average)average
  4. Dन्यूनतम (minimum)minimum

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

हल / Solution
प्रायोरिटी क्यू का पूरा मक़सद यही है कि ज़्यादा ज़रूरी काम पहले निपटे। इसलिए हटाने का नियम है — जिसकी प्राथमिकता सबसे ऊँची हो, वही पहले निकले। साधारण क्यू की तरह आने का क्रम यहाँ नहीं देखा जाता। अस्पताल की आपात सेवा इसका सीधा उदाहरण है। निम्नतम और न्यूनतम, दोनों एक ही बात कहते हैं और दोनों उलटा नियम बताते हैं। औसत प्राथमिकता जैसी कोई धारणा इस संरचना में होती ही नहीं।
The whole purpose of a priority queue is to let the more urgent work finish first. So the removal rule is simple: the item with the highest priority leaves first, and the order of arrival, which matters in an ordinary queue, is ignored. Emergency care in a hospital is a direct example. Lowest and minimum both say the same thing and both state the opposite rule. Average priority is not a concept used in this structure at all.
प्रश्न 6उत्तर + हल
क्यू को दर्शाने के लिए हमेशा उचित क्या रहता है?
It is always appropriate to represent a queue using
  1. Aसर्कुलर क्यू (circular queue)a circular queue
  2. Bडबली लिंक्ड लिस्ट (doubly linked list)doubly linked list
  3. Cलीनियर लिंक्ड लिस्ट (linear linked list)linear linked list
  4. Dऐरे (array)array

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

हल / Solution
यहाँ ज़ोर 'हमेशा' शब्द पर है। लीनियर लिंक्ड लिस्ट में हर नया नोड ज़रूरत पड़ने पर बनता है, इसलिए क्यू का आकार पहले से तय करना नहीं पड़ता और जगह भरने की दिक़्क़त नहीं आती। ऐरे और उसी पर बनी सर्कुलर क्यू, दोनों की क्षमता तय होती है, इसलिए वे हर हाल में काम नहीं देतीं। डबली लिंक्ड लिस्ट चल तो जाएगी, पर क्यू में पीछे की कड़ी की ज़रूरत ही नहीं, इसलिए वह मेमोरी बरबाद करती है।
The key word here is always. In a linear linked list every new node is created only when it is needed, so the size of the queue need not be fixed in advance and the structure never runs out of room. An array, and the circular queue built on it, both have a fixed capacity, so they do not serve in every case. A doubly linked list works, but a queue never needs the backward link, so it wastes memory.
प्रश्न 7उत्तर + हल
प्रायोरिटी क्यू किस तरह की हो सकती है?
A priority queue can be
  1. Aआरोही (ascending)ascending
  2. Bअवरोही (descending)descending
  3. C(a) और (b) दोनोंBoth (a) and (b)
  4. Dऑड सीरियल (odd serial)odd serial

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

हल / Solution
प्रायोरिटी क्यू में एलिमेंट अपने साथ एक प्राथमिकता मान लेकर आता है और निकलता वही है जिसका मान नियम के हिसाब से सबसे ऊपर हो। यह नियम दो तरह का रखा जा सकता है। आरोही प्रायोरिटी क्यू में सबसे छोटा मान पहले निकलता है और अवरोही में सबसे बड़ा। दोनों रूप असली में काम आते हैं, इसलिए किसी एक को चुनना अधूरा उत्तर होगा। 'ऑड सीरियल' नाम की कोई प्रायोरिटी क्यू होती ही नहीं।
In a priority queue every element carries a priority value, and the one that leaves first is the one that ranks highest under the chosen rule. That rule can be set in two ways. An ascending priority queue removes the smallest value first, while a descending one removes the largest value first. Both forms are used in practice, so choosing only one of them would be incomplete. There is no such thing as an odd serial priority queue.
प्रश्न 8उत्तर + हल
प्रिंटर सर्वर रूटीन किसका उपयोग करके डिज़ाइन किए जाते हैं?
Printer server routines are designed using
  1. Aस्टैक (stack)stack
  2. Bऐरे (array)array
  3. Cक्यू (queue)queue
  4. Dलिंक्ड लिस्ट (linked list)linked list

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

हल / Solution
प्रिंटर पर कई उपयोगकर्ता एक साथ काम भेजते हैं, पर छपाई एक-एक करके होती है। न्याय इसी में है कि जो काम पहले आया वह पहले छपे, यानी फ़ीफ़ो (First In First Out) क्रम। इसीलिए प्रिंट स्पूलिंग क्यू से बनती है। स्टैक लगाने पर बाद में आया काम पहले छपता और पहला काम पड़ा रह जाता। ऐरे केवल भंडारण देता है, क्रम का नियम नहीं। लिंक्ड लिस्ट से क्यू बनाई जा सकती है, पर नियम तो क्यू का ही है।
Many users send jobs to one printer, yet printing happens one job at a time. Fairness requires that the job which arrived first is printed first, that is First In First Out order. This is why print spooling is built on a queue. With a stack the latest job would print first and the earliest could wait forever. An array gives only storage and no ordering rule, and a linked list merely builds the queue.
प्रश्न 9उत्तर + हल
क्यू का उपयोग निम्न में से किसे लागू करने में किया जा सकता है?
A queue can be used to implement
  1. Aरेडिक्स सॉर्ट (radix sort)radix sort
  2. Bक्विक सॉर्ट (quick sort)quick sort
  3. Cरिकर्शन (recursion)recursion
  4. Dडेप्थ फ़र्स्ट सर्च (depth first search)depth first search

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

हल / Solution
रेडिक्स सॉर्ट में संख्याओं को उनके अंकों के हिसाब से अलग-अलग बकेट में बाँटा जाता है और हर बकेट एक क्यू ही होती है। हर चक्र के बाद बकेट क्रम से ख़ाली की जाती हैं, जिसके लिए फ़ीफ़ो (First In First Out) क्रम ज़रूरी है, वरना पिछले चक्र की छँटाई बिगड़ जाएगी। क्विक सॉर्ट भाग-और-जीत विधि से चलता है। रिकर्शन और डेप्थ फ़र्स्ट सर्च, दोनों में स्टैक चाहिए क्योंकि वहाँ आख़िरी काम पहले निपटाना पड़ता है।
In radix sort the numbers are distributed into buckets according to their digits, and each bucket is really a queue. After every pass the buckets are emptied in order, which needs First In First Out behaviour, otherwise the ordering achieved in the previous pass would be destroyed. Quick sort works by divide and conquer. Both recursion and depth first search need a stack, because there the most recent task has to be finished first.
प्रश्न 10उत्तर + हल
क्यू, प्रायोरिटी क्यू और लिंक्ड लिस्ट का सबसे उपयोगी अनुप्रयोग किसमें है?
The most useful application of queues, priority queues and linked lists is in
  1. Aनेटवर्क (network)network
  2. Bसिमुलेशन (simulation)simulation
  3. Cरिफ़ाइनरी (refinery)refinery
  4. Dये सभीAll of these

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

हल / Solution
सिमुलेशन का मतलब है किसी असली व्यवस्था का कंप्यूटर पर नमूना बनाकर उसका व्यवहार देखना — जैसे बैंक की क़तार, टोल नाका या सीपीयू शेड्यूलिंग। ऐसे हर नमूने में प्रतीक्षा करने वालों की क़तार चाहिए, प्राथमिकता के हिसाब से चुनाव चाहिए और जगह घटती-बढ़ती रहनी चाहिए। तीनों काम क्यू, प्रायोरिटी क्यू और लिंक्ड लिस्ट मिलकर करते हैं। नेटवर्क इन्हें काम में लेता ज़रूर है, पर यह इनका सबसे व्यापक उपयोग नहीं। रिफ़ाइनरी का इनसे सीधा नाता नहीं।
Simulation means building a model of a real system on a computer and watching how it behaves, such as a bank line, a toll gate or CPU scheduling. Every such model needs a waiting line, a way to pick items by priority, and storage that can grow and shrink. Queues, priority queues and linked lists together provide all three. Networks do use them, but that is not their widest use. A refinery has no direct link.
आगे के 11 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
App खोलिए
प्रश्न 14उत्तर app में
एलिमेंट्स की ऐसी रैखिक सूची जिसमें डिलीशन एक सिरे से होता है और इंसर्शन केवल दूसरे सिरे पर, उसे क्या कहते हैं?
A linear list of elements in which deletion can be done from one end and insertion can take place only at the other end, is known as
  1. Aक्यू (queue)queue
  2. Bस्टैक (stacks)stacks
  3. Cट्री (trees)trees
  4. Dब्रांच (branch)branch
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 15उत्तर app में
लिंक्ड क्यू में डिलीट करने से पहले कौन-सी आवश्यक शर्त जाँची जाती है?
The essential condition which is checked before deletion in a linked queue is
  1. Aअंडरफ़्लो (Underflow)Underflow
  2. Bओवरफ़्लो (Overflow)Overflow
  3. Cफ़्रंट का मानFront value
  4. Dरियर का मानRear value
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 16उत्तर app में
लिंक्ड क्यू में प्रविष्टि (insertion) से पहले कौन-सी आवश्यक शर्त जाँची जाती है?
The essential condition which is checked before insertion in a linked queue is
  1. Aअंडरफ़्लो (Underflow)Underflow
  2. Bओवरफ़्लो (Overflow)Overflow
  3. Cफ़्रंट का मानFront value
  4. Dरियर का मानRear value
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 17उत्तर app में
क्यू के लिंक्ड लिस्ट क्रियान्वयन में फ़्रंट और रियर दोनों सूचक रखे जाते हैं। किसी ख़ाली न होने वाली (non-empty) क्यू में इंसर्शन के समय इनमें से कौन-सा सूचक बदलेगा?
In the linked list implementation of a queue, front and rear pointers are tracked. Which of these pointers will change during an insertion into a NON-EMPTY queue?
  1. Aकेवल फ़्रंट सूचकOnly front pointer
  2. Bकेवल रियर सूचकOnly rear pointer
  3. Cफ़्रंट और रियर दोनों सूचकBoth front and rear pointer
  4. Dकोई भी सूचक नहीं बदलेगाNo pointer will be changed
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 18उत्तर app में
क्यू के लिंक्ड लिस्ट क्रियान्वयन (implementation) में नया एलिमेंट कहाँ डाला जाता है?
In the linked list implementation of a queue, where is a new element inserted?
  1. Aलिंक्ड लिस्ट के हेड परAt the head of the linked list
  2. Bलिंक्ड लिस्ट के बीच की जगह परAt the centre position in the linked list
  3. Cलिंक्ड लिस्ट की टेल (पूँछ) परAt the tail of the linked list
  4. Dलिंक्ड लिस्ट में किसी भी जगह परAt any position in the linked list
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 19उत्तर app में
पूरी तरह भरी हुई क्यू में एक और एलिमेंट डालने की कोशिश को किस नाम से जाना जाता है?
What is the term for inserting into a full queue known as?
  1. Aओवरफ़्लो (overflow)overflow
  2. Bअंडरफ़्लो (underflow)underflow
  3. Cनल पॉइंटर एक्सेप्शन (null pointer exception)null pointer exception
  4. Dप्रोग्राम कंपाइल नहीं होगाprogram won't be compiled
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 20उत्तर app में
किसी ग्राफ़ पर ब्रेड्थ फ़र्स्ट ट्रैवर्सल (Breadth First Traversal) के लिए कौन-सी डेटा संरचना आवश्यक है?
The data structure required for Breadth First Traversal on a graph is
  1. Aस्टैक (Stack)Stack
  2. Bऐरे (Array)Array
  3. Cक्यू (Queue)Queue
  4. Dट्री (Tree)Tree
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 21उत्तर app में
निम्नलिखित में से कौन-सी डेटा संरचना दोनों सिरों से इंसर्शन और डिलीशन की अनुमति देती है?
Which of the following data structures allows insertion and deletion from both ends?
  1. Aस्टैक (Stack)Stack
  2. Bडेक (Deque)Deque
  3. Cक्यू (Queue)Queue
  4. Dस्ट्रिंग्स (Strings)Strings
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
Queue के सभी 21 प्रश्न — उत्तर, हल और अभ्यास

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

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

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

DSA के दूसरे topics

सभी topics