पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 11 के उत्तर और हल FliQi Question Bank app में।
भाषा
प्रश्न 1उत्तर + हल
आउटपुट-रिस्ट्रिक्टेड डेक दोनों सिरों पर ............ की अनुमति देता है और केवल एक सिरे पर ............ की।
An output-restricted dequeue allows ........... at both ends and ..... at only one end.
Aडिलीशन, इंसर्शनdeletion, insertion
Bइंसर्शन, डिलीशनinsertion, deletion
Cपुश, पॉप (PUSH, POP)PUSH, POP
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
Aरिकर्शन के सिमुलेशन मेंsimulation of recursion
Bमनमानी लिंक्ड लिस्ट के सिमुलेशन मेंsimulation of arbitrary linked list
Cलिंक्ड रिसोर्स एलोकेशन के सिमुलेशन मेंsimulation of linked resource allocation
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?
AFront = Rear = नल (null)Front = Rear = null
BFront = Rear + 1
CFront = Rear - 1
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.
डेक यानी डबल एंडेड क्यू के दो सीमित रूप हैं और नाम इनपुट या आउटपुट पर लगी रोक से पड़ा है। इनपुट-रिस्ट्रिक्टेड डेक में इनपुट पर रोक है, यानी डालना केवल एक सिरे से और निकालना दोनों सिरों से। आउटपुट-रिस्ट्रिक्टेड डेक इसका उलटा है — डालना दोनों सिरों से, निकालना एक से। प्रायोरिटी क्यू सिरों से नहीं, प्राथमिकता के मान से चलती है। इसलिए 'ये सभी' भी ठीक नहीं बैठता।
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.
Aनिम्नतम (lowest)lowest
Bउच्चतम (highest)highest
Cऔसत (average)average
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
Aसर्कुलर क्यू (circular queue)a circular queue
Bडबली लिंक्ड लिस्ट (doubly linked list)doubly linked list
Cलीनियर लिंक्ड लिस्ट (linear linked list)linear linked list
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
Aआरोही (ascending)ascending
Bअवरोही (descending)descending
C(a) और (b) दोनोंBoth (a) and (b)
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
Aस्टैक (stack)stack
Bऐरे (array)array
Cक्यू (queue)queue
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
Aरेडिक्स सॉर्ट (radix sort)radix sort
Bक्विक सॉर्ट (quick sort)quick sort
Cरिकर्शन (recursion)recursion
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
Aनेटवर्क (network)network
Bसिमुलेशन (simulation)simulation
Cरिफ़ाइनरी (refinery)refinery
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 — अभ्यास, हल और आपकी प्रगति
क्यू के लिंक्ड लिस्ट क्रियान्वयन में फ़्रंट और रियर दोनों सूचक रखे जाते हैं। किसी ख़ाली न होने वाली (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?
Aकेवल फ़्रंट सूचकOnly front pointer
Bकेवल रियर सूचकOnly rear pointer
Cफ़्रंट और रियर दोनों सूचकBoth front and rear pointer
Dकोई भी सूचक नहीं बदलेगाNo pointer will be changed