पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।
भाषा
प्रश्न 1उत्तर + हल
किसी CRM प्रणाली में विक्रय प्रतिनिधि ग्राहक प्रोफ़ाइल और विक्रय आँकड़े बदलते रहते हैं, जबकि प्रबंधक उसी समय विक्रय रिपोर्ट और पूर्वानुमान देखते हैं। दोनों को साथ-साथ डेटा पहुँच देने के लिए कौन-सी locking granularity सबसे ठीक रहेगी?
In a customer relationship management (CRM) system, sales representatives update customer profiles and sales data while managers analyze sales reports and forecasts. Which locking granularity strategy would support concurrent data access for both sales representatives and managers?
Dपूरे डेटाबेस के स्तर की (database-level) lockingDatabase-level locking
सही उत्तर / Answer: (B)
हल / Solution
locking granularity जितनी बारीक होगी, उतने ही कम डेटा पर ताला लगेगा और उतने ही ज़्यादा काम साथ चल सकेंगे। row-level locking में सिर्फ़ वही पंक्ति रुकती है जिसे प्रतिनिधि बदल रहा है, बाक़ी पंक्तियाँ प्रबंधक पढ़ सकते हैं। page-level में उसी पृष्ठ की और पंक्तियाँ भी फँस जाती हैं। table-level पूरी तालिका रोक देता है और database-level तो पूरा डेटाबेस — दोनों में concurrency सबसे कम रहती है।
The finer the locking granularity, the smaller the piece of data that gets locked, so more work can run side by side. Row-level locking blocks only the row a sales representative is editing, leaving every other row readable for managers. Page-level locking traps unrelated rows on the same page. Table-level locking freezes the whole table and database-level locking the entire database, which gives the least concurrency.
प्रश्न 2उत्तर + हल
डेटाबेस प्रणालियों में बहु-कणिकता लॉकिंग (multiple granularity locking) का क्या अर्थ है?
What does Multiple Granularity Locking refer to in database systems?
Aएक ही lock से कई डेटा मद lock करनाLocking multiple data items with a single lock
Bअलग-अलग स्तरों पर lock लगाना (जैसे पंक्ति, पृष्ठ, तालिका)Locking data at different levels of granularity (e.g., row-level, page-level, table-level)
Cकई तरह के lock काम में लेना (जैसे साझा, अनन्य)Locking data using multiple lock types (e.g., shared locks, exclusive locks)
Dलेन-देन की ज़रूरत के हिसाब से अलग-अलग कड़ाई वाले lock लगानाLocking data with varying degrees of strictness based on transaction requirements
सही उत्तर / Answer: (B)
हल / Solution
बहु-कणिकता लॉकिंग में डेटा को एक वृक्ष की तरह देखा जाता है — डेटाबेस, फ़ाइल, तालिका, पृष्ठ (page), पंक्ति — और लेन-देन उसी स्तर पर lock लेता है जितने की उसे ज़रूरत है। थोड़ी पंक्तियों के लिए पंक्ति-स्तर, पूरी तालिका पढ़नी हो तो तालिका-स्तर। ऊपरी गाँठों पर आशय-lock (intention lock) लगते हैं, ताकि टकराव जल्दी पकड़ा जाए। बाक़ी विकल्प lock के प्रकार या कड़ाई की बात करते हैं, स्तर की नहीं।
Multiple granularity locking treats the data as a tree: database, file, table, page and row. A transaction locks at whatever level suits it, taking row locks for a few rows and a single table lock when it must scan everything. Intention locks on the higher nodes let the system detect conflicts quickly without walking the whole tree. The other options describe lock types or lock strictness rather than levels of granularity.
प्रश्न 3उत्तर + हल
दो-चरणीय लॉकिंग का कौन-सा रूप उस स्थिति के लिए सबसे उपयुक्त है जहाँ डेटा संगति ज़रूरी हो, पर समवर्तिता बनाए रखने के लिए साझा (read) lock जल्दी छोड़ने भी पड़ें?
Which variant of Two-Phase Locking is most suitable where data consistency is critical but shared read locks must still be released early to retain concurrency?
कठोर दो-चरणीय लॉकिंग (strict) में लिखने वाले अनन्य lock commit तक रुकते हैं, जिससे गंदा पाठ और शृंखलाबद्ध वापसी दोनों रुक जाते हैं; पर साझा (shared) lock पहले छोड़े जा सकते हैं, सो पढ़ने वालों को ज़्यादा जगह मिलती है। कठोरतम (rigorous) रूप साझा lock भी रोके रखता है और समवर्तिता घटा देता है। मूल रूप शृंखलाबद्ध वापसी नहीं रोकता और रूढ़िवादी रूप शुरू में ही सब lock माँगकर इंतज़ार बढ़ाता है।
Strict two phase locking holds exclusive write locks until commit, which stops dirty reads and cascading rollbacks, yet it may release shared read locks earlier, so readers are held back less. The rigorous variant keeps shared locks as well and cuts concurrency further. Basic locking does not prevent cascading rollback at all, and conservative locking makes a transaction wait for every lock before it even starts.
प्रश्न 4उत्तर + हल
कठोरतम दो-चरणीय लॉकिंग (rigorous two-phase locking) का मुख्य लाभ क्या है?
What is the primary advantage of Rigorous Two-Phase Locking?
Aचलते-चलते lock लेने से ज़्यादा समवर्तिताHigher concurrency due to dynamic lock acquisition
Bपहले से lock ले लेने से गतिरोध का कम ख़तराReduced risk of deadlock due to proactive lock acquisition
Cकड़े lock नियमों से डेटा संगति की मज़बूत गारंटीStronger data consistency guarantees due to strict locking rules
Dदूसरे रूपों की तुलना में lock प्रबंधन का कम बोझLower overhead for lock management compared to other variants
सही उत्तर / Answer: (C)
हल / Solution
कठोरतम दो-चरणीय लॉकिंग में साझा और अनन्य, दोनों तरह के lock लेन-देन के अंत तक रुके रहते हैं। इससे कोई दूसरा लेन-देन बीच में न पढ़ सकता है, न बदल सकता है, और लेन-देनों का क्रम उनके commit के क्रम जैसा बन जाता है — यही सबसे मज़बूत संगति की गारंटी है। क़ीमत यह है कि समवर्तिता घटती है और बोझ बढ़ता है; पहले से lock ले लेना रूढ़िवादी (conservative) रूप की बात है।
Rigorous two phase locking keeps both shared and exclusive locks until the transaction ends. No other transaction can read or modify those items meanwhile, and the serialization order of transactions becomes the same as their commit order, which is the strongest consistency guarantee among the variants. The price is lower concurrency and heavier lock management, while the proactive pre claiming named in option 2 belongs to conservative locking.
प्रश्न 5उत्तर + हल
रूढ़िवादी दो-चरणीय लॉकिंग में lock किस तरह लिए जाते हैं?
In Conservative Two-Phase Locking, how are locks acquired?
Aपहले से, किसी भी डेटा मद को छूने से पूर्वProactively, before accessing any data items
Bचलते-चलते, पहुँच के ढर्रे के अनुसारDynamically, based on the data access pattern
Cलेन-देन के आधे रास्ते पहुँचने के बादAfter the transaction reaches its halfway point
Dसिर्फ़ तब, जब दूसरे लेन-देनों से टकराव पकड़ा जाएOnly when conflicts with other transactions are detected
सही उत्तर / Answer: (A)
हल / Solution
रूढ़िवादी रूप में लेन-देन चलने से पहले ही बता देता है कि उसे कौन-कौन से डेटा मद चाहिए और सारे lock एक साथ ले लेता है। सब मिल जाएँ तभी वह आगे बढ़ता है, वरना बिना कुछ पकड़े प्रतीक्षा करता है। इसी पूर्व-दावे की वजह से गतिरोध बन ही नहीं पाता। चलते-चलते lock लेना मूल रूप का ढंग है, और आधे रास्ते या टकराव दिखने पर lock लेना किसी मानक प्रोटोकॉल में होता ही नहीं।
In the conservative variant a transaction states in advance which data items it will touch and acquires every lock before execution begins. Only when all of them are granted does it proceed; otherwise it waits while holding nothing. This pre claiming is precisely why deadlock cannot occur. Taking locks dynamically is basic two phase locking, and acquiring them halfway through or only on conflict is not a standard protocol at all.
प्रश्न 6उत्तर + हल
मूल दो-चरणीय लॉकिंग (basic two-phase locking) की कमी इनमें से कौन-सी है?
Which of the following is a drawback of Basic Two-Phase Locking?
Aगतिरोध (deadlock) का ख़तरा बढ़ जानाIncreased risk of deadlock
Bक्रमबद्धता (serializability) की गारंटी न दे पानाInability to guarantee serializability
Cप्रोटोकॉल को लागू करना और सँभालना कठिन होनाDifficulty in implementing and maintaining the protocol
Dसमवर्ती लेन-देनों के लिए बहुत कम सहाराLimited support for concurrent transactions
सही उत्तर / Answer: (A)
हल / Solution
मूल दो-चरणीय लॉकिंग में lock ज़रूरत पड़ने पर माँगे जाते हैं, इसलिए दो लेन-देन आसानी से एक-दूसरे के lock का इंतज़ार करते हुए फँस सकते हैं — यही गतिरोध (deadlock) है, और इससे निपटने के लिए पहचान या रोकथाम अलग से लगानी पड़ती है। क्रमबद्धता की गारंटी यह प्रोटोकॉल देता ही है, इसे लागू करना सीधा है, और यह समवर्ती लेन-देन चलने भी देता है, सो बाक़ी तीनों कथन ग़लत हैं।
Basic two phase locking asks for each lock only when it is needed, so two transactions can easily end up waiting for locks that the other already holds. That is deadlock, and a separate detection or prevention scheme has to be added to deal with it. The protocol does guarantee conflict serializability, it is simple to implement, and it certainly allows concurrent transactions, so the other three statements are false.
प्रश्न 7उत्तर + हल
कठोरतम दो-चरणीय लॉकिंग (rigorous two-phase locking) को 2PL के दूसरे रूपों से क्या अलग करता है?
What distinguishes Rigorous Two-Phase Locking (2PL) from other variants of 2PL?
Aयह lock को साझा से अनन्य (shared से exclusive) में बदलने देता हैIt allows transactions to upgrade locks from shared to exclusive
Bयह लेन-देन के गतिरोध-मुक्त होने की गारंटी देता हैIt guarantees that transactions are deadlock-free
Cयह पक्का करता है कि सारे lock लेन-देन के अंत में ही छूटेंIt ensures that all locks are released at the end of a transaction
Dयह कड़े lock नियमों से खोए हुए update रोकता हैIt prevents lost updates by enforcing strict locking rules
सही उत्तर / Answer: (C)
हल / Solution
कठोर (strict) रूप सिर्फ़ लिखने वाले अनन्य lock commit तक रोकता है, जबकि कठोरतम (rigorous) रूप साझा (shared) lock भी अंत तक रोके रखता है — यानी सारे lock एक साथ, लेन-देन ख़त्म होने पर ही छूटते हैं। इसी से इसका क्रम commit के क्रम जैसा बन जाता है। यह गतिरोध से नहीं बचाता, वह गुण रूढ़िवादी (conservative) रूप का है, और lock का दर्जा बढ़ाना सभी रूपों में हो सकता है।
Strict two phase locking holds only the exclusive write locks until commit, whereas the rigorous variant also keeps the shared read locks to the very end, so every lock is released together when the transaction finishes. That is what makes its serialization order match its commit order. It does not make transactions deadlock free, which is a property of conservative locking, and lock upgrading is possible in all variants.
प्रश्न 8उत्तर + हल
कठोर दो-चरणीय लॉकिंग (strict two-phase locking) में lock कब छोड़े जाते हैं?
In Strict Two-Phase Locking (2PL), when are locks released?
Aलेन-देन के किसी डेटा मद को पढ़ लेने के बादAfter a transaction reads a data item
Bलेन-देन के किसी डेटा मद में लिख देने के बादAfter a transaction writes to a data item
Cलेन-देन के commit या abort हो जाने के बादAfter a transaction commits or aborts
Dलेन-देन के समय-सीमा (timeout) तक पहुँचने के बादAfter a transaction reaches its timeout threshold
सही उत्तर / Answer: (C)
हल / Solution
कठोर दो-चरणीय लॉकिंग में लिखने वाले अनन्य (exclusive) lock लेन-देन के commit या abort होने तक नहीं छूटते। इससे कोई दूसरा लेन-देन बिना commit किया मान पढ़ ही नहीं पाता, सो गंदा पाठ (dirty read) और शृंखलाबद्ध वापसी (cascading rollback) दोनों ख़त्म हो जाते हैं। पढ़ते ही या लिखते ही lock छोड़ देना यही बचाव तोड़ देता है, और समय-सीमा का इस नियम से कोई लेना-देना नहीं है।
In strict two phase locking the exclusive locks taken for writing are not released until the transaction commits or aborts. No other transaction can therefore read an uncommitted value, which removes both dirty reads and cascading rollbacks. Releasing a lock as soon as an item has been read or written would destroy exactly that protection, and a timeout threshold has nothing to do with the rule, so the other options fail.
प्रश्न 9उत्तर + हल
रूढ़िवादी दो-चरणीय लॉकिंग (conservative two-phase locking) का सही वर्णन कौन-सा है?
Which of the following statements accurately describes Conservative Two-Phase Locking?
Aलेन-देन अपने शुरू में ही सारे ज़रूरी lock ले लेता हैTransactions acquire all required locks at the beginning of execution
Bलेन-देन डेटा छूते ही lock छोड़ देता हैTransactions release locks immediately after accessing data items
Cलेन-देन पहुँच के ढर्रे के हिसाब से चलते-चलते lock लेता हैTransactions acquire locks dynamically based on the data access pattern
Dलेन-देन commit या abort के बाद ही lock छोड़ता हैTransactions release locks only after they commit or abort
सही उत्तर / Answer: (A)
हल / Solution
रूढ़िवादी दो-चरणीय लॉकिंग में लेन-देन शुरू होने से पहले ही घोषित कर देता है कि उसे क्या-क्या चाहिए और सारे lock एक साथ लेता है। एक भी न मिले तो वह कुछ भी पकड़े बिना प्रतीक्षा करता है, इसलिए प्रतीक्षा का चक्र बन ही नहीं पाता और गतिरोध असंभव हो जाता है। चलते-चलते lock लेना मूल रूप का ढंग है, और commit तक रोके रखना कठोर (strict) रूप की पहचान है।
Conservative two phase locking makes a transaction declare everything it will need before it starts and take all those locks together. If even one lock is unavailable the transaction waits while holding nothing, so no cycle of waiting can form and deadlock becomes impossible. Acquiring locks dynamically as data is touched is ordinary basic two phase locking, and holding every lock until commit is the mark of the strict variant.
प्रश्न 10उत्तर + हल
डेटाबेस समवर्तिता नियंत्रण में मूल दो-चरणीय लॉकिंग (basic two-phase locking) का मुख्य लक्ष्य क्या है?
What is the primary goal of Basic Two-Phase Locking (2PL) in database concurrency control?
Aलेन-देन चलने से पहले सभी डेटा मदों पर lock ले लेनाTo acquire locks on all data items before transaction execution
Bडेटा पढ़ते ही lock छोड़कर गतिरोध रोकनाTo prevent deadlock by releasing locks immediately after reading data
Cदो चरणों में lock लेकर और छोड़कर क्रमबद्धता (serializability) पक्की करनाTo ensure serializability by acquiring and releasing locks in two phases
Dसमवर्ती पहुँच देकर प्रश्न का निष्पादन सुधारनाTo optimize query performance by allowing concurrent access to data
सही उत्तर / Answer: (C)
हल / Solution
दो-चरणीय लॉकिंग में हर लेन-देन पहले बढ़ता चरण (growing phase) चलाता है, जहाँ वह सिर्फ़ lock लेता है, और फिर घटता चरण (shrinking phase), जहाँ सिर्फ़ छोड़ता है। एक बार कोई lock छूट जाए तो नया lock नहीं लिया जा सकता। इसी एक बंदिश से यह पक्का होता है कि नतीजा किसी क्रमिक चलन जैसा ही रहे, यानी क्रमबद्धता (serializability)। यह गतिरोध नहीं रोकता और निष्पादन सुधारना इसका मक़सद नहीं।
Under two phase locking every transaction first runs a growing phase, in which it may only acquire locks, and then a shrinking phase, in which it may only release them. Once any lock has been released no new lock may be taken. That single restriction is what guarantees a conflict serializable schedule. The protocol does not prevent deadlock, and improving query performance is not its purpose at all.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
वितरित डेटाबेस में Two-Phase Commit (2PC) प्रोटोकॉल का सबसे सही वर्णन कौन-सा है?
Which of the following best describes the Two-Phase Commit (2PC) protocol in distributed databases?
Aवितरित deadlock से निपटने का एक प्रोटोकॉलA protocol for handling distributed deadlocks
Bसाथ-साथ चलने वाले वितरित transaction के बीच isolation पक्की करने का प्रोटोकॉलA protocol for ensuring isolation between concurrent distributed transactions
Cवितरित नोड पर transaction के commit का तालमेल बैठाने वाला प्रोटोकॉलA protocol for coordinating transaction commit across distributed nodes
Dवितरित डेटा-पहुँच के टकराव सुलझाने का एक प्रोटोकॉलA protocol for resolving conflicts in distributed data access
DBMS में transaction प्रबंधन के संदर्भ में deadlock क्या है?
What is a deadlock in the context of transaction management in DBMS?
Aऐसी स्थिति जिसमें टकराते बदलावों के कारण transaction commit नहीं कर पातेA situation where transactions are unable to commit due to conflicting data modifications
Bऐसी हालत जिसमें transaction एक-दूसरे के lock छूटने की राह देखते हुए सदा के लिए अटक जाते हैंA condition where transactions are blocked indefinitely, waiting for each other to release locks
Cऐसी स्थिति जिसमें एकरूपता के लिए transaction क्रम से चलाए जाते हैंA scenario where transactions are executed in a serial order to ensure data consistency
Dऐसी हालत जिसमें transaction प्रदर्शन के लिए ACID गुण छोड़ देते हैंA state where transactions bypass the ACID properties for performance optimization
Snapshot Isolation में अगर कोई transaction ऐसा डेटा पढ़े जिसे किसी और बिना commit हुए transaction ने बदल दिया है, तो क्या होता है?
In Snapshot Isolation, what happens if a transaction reads data that has been modified by another uncommitted transaction?
Aवह transaction टकराने वाले transaction के पूरे होने तक इंतज़ार करता हैThe transaction waits until the conflicting transaction completes
Bवह डेटा का पुराना संस्करण पढ़ता है और बिना commit हुए बदलाव को अनदेखा कर देता हैThe transaction reads the old version of data, ignoring the uncommitted changes
Cवह बिना commit हुए बदलाव पढ़ लेता है, जिससे असंगति हो सकती हैThe transaction reads the uncommitted changes, potentially leading to inconsistencies
Dवह रद्द होकर नए snapshot के साथ दोबारा शुरू होता हैThe transaction aborts and restarts with a new snapshot of the database