पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।
भाषा
प्रश्न 1उत्तर + हल
Read Committed विलगन स्तर वाली प्रणाली में, यदि लेन-देन M किसी पंक्ति को 1000 कर देता है और M के commit होने से पहले लेन-देन N उसी पंक्ति को पढ़ता है, तो N को कौन-सा मान दिखेगा?
In a database system with Read Committed isolation level, if Transaction M updates a row with a value of 1000 and then Transaction N reads the same row before Transaction M commits, what value will Transaction N see?
A0
B500
C1000
Dनिश्चित नहीं कहा जा सकता (अनिर्धारित)Undefined
सही उत्तर / Answer: (D)
हल / Solution
Read Committed का नियम है कि कोई लेन-देन दूसरे का बिना commit किया बदलाव नहीं पढ़ेगा, यानी गंदा पाठ (dirty read) होता ही नहीं। इसलिए N को नया मान तो नहीं दिखेगा; उसे वह मान दिखेगा जो M के बदलाव से पहले commit हो चुका था। प्रश्न में वह पुराना मान बताया ही नहीं गया, इसलिए पहले तीनों अंक अटकल भर हैं और उत्तर अनिर्धारित ही रहता है।
Read Committed guarantees that a transaction never reads another transaction's uncommitted change, so dirty reads cannot happen. N will therefore not see 1000. It will see whatever value was committed before M began its update, and the question never tells us what that earlier value was. Since 0 and 500 are equally unsupported guesses, the value N sees cannot be determined from the information given.
प्रश्न 2उत्तर + हल
Repeatable Read विलगन स्तर (isolation level) वाली प्रणाली में, यदि लेन-देन K किसी पंक्ति का मान 800 पढ़ता है और K के commit होने से पहले लेन-देन L उसी पंक्ति को 900 कर देता है, तो K के साथ क्या होगा?
In a database system with Repeatable Read isolation level, if Transaction K reads a row with a value of 800 and then Transaction L updates the same row to 900 before Transaction K commits, what will happen to Transaction K?
AK को पंक्ति का मान 800 ही दिखता रहेगाTransaction K will see the row with value 800
BK को पंक्ति मिटी हुई दिखेगीTransaction K will see the row as deleted
CK गतिरोध (deadlock) में फँस जाएगाTransaction K will encounter a deadlock
DK को त्रुटि संदेश मिलेगाTransaction K will see an error message
सही उत्तर / Answer: (A)
हल / Solution
Repeatable Read का वादा यही है कि जो पंक्ति कोई लेन-देन एक बार पढ़ ले, वही मान उसे अपने अंत तक दिखता रहे। इसलिए L का बदलाव K को नहीं दिखेगा; K को पुराना ही मान मिलता रहेगा, और L या तो lock पर रुकेगा या अपनी प्रति (snapshot) पर काम करेगा। पंक्ति मिटी दिखना, गतिरोध (deadlock) या त्रुटि संदेश यहाँ ज़रूरी नहीं, सो बाक़ी तीनों विकल्प ग़लत हैं।
Repeatable Read promises that any row a transaction has already read will keep showing the same value until that transaction finishes. The change made by L is therefore invisible to K, which continues to see 800, while L either waits for a lock or works on its own snapshot. Nothing in this situation forces the row to look deleted, nothing causes a deadlock, and no error has to be raised.
प्रश्न 3उत्तर + हल
Read Uncommitted isolation level वाले डेटाबेस में Transaction G किसी पंक्ति का मान 500 कर देता है और Transaction H उसे G के commit करने से पहले पढ़ता है। H को कौन-सा मान दिखेगा?
In a database system with Read Uncommitted isolation level, if Transaction G updates a row with a value of 500 and then Transaction H reads the same row before Transaction G commits, what value will Transaction H see?
A0
B250
C500
Dतय नहीं (Undefined)Undefined
सही उत्तर / Answer: (C)
हल / Solution
Read Uncommitted पर पढ़ने से पहले कोई shared lock नहीं लिया जाता, इसलिए H को G का अभी तक commit न हुआ मान भी सीधे दिख जाता है। यानी H को 500 ही मिलेगा। यही dirty read का उदाहरण है, क्योंकि अगर G बाद में rollback कर दे तो H ने ऐसा मान पढ़ा होगा जो डेटाबेस में कभी टिका ही नहीं। 0 और 250 का प्रश्न में कोई आधार नहीं है।
At Read Uncommitted no shared lock is taken before a read, so H can directly see the value G has written but not yet committed. H therefore reads 500. This is the classic example of a dirty read, because if G later rolls back, H will have used a value that never really existed in the database. The figures 0 and 250 have no basis anywhere in the question.
प्रश्न 4उत्तर + हल
Serializable isolation level वाले डेटाबेस में Transaction E किसी पंक्ति का मान 400 पढ़ता है, फिर E के commit करने से पहले Transaction F उसी पंक्ति को हटा देता है। E के साथ क्या होगा?
In a database system with Serializable isolation level, if Transaction E reads a row with a value of 400 and then Transaction F deletes the same row before Transaction E commits, what will happen to Transaction E?
AE को वही पंक्ति 400 मान के साथ दिखती रहेगीTransaction E will see the row with value 400
BE को पंक्ति हटी हुई दिखेगीTransaction E will see the row as deleted
CE को deadlock मिलेगाTransaction E will encounter a deadlock
DE को त्रुटि संदेश मिलेगाTransaction E will see an error message
सही उत्तर / Answer: (A)
हल / Solution
Serializable पर E जिस पंक्ति को पढ़ लेता है, उस पर उसका ताला या snapshot उसके पूरा होने तक बना रहता है। इसलिए F उस पंक्ति को हटाने के लिए या तो रुका रहेगा, या हटा भी दे तो E को अपना पुराना दृश्य ही दिखता रहेगा। नतीजा यह कि E को पंक्ति 400 मान के साथ मिलती रहेगी। पंक्ति का हटा दिखना Serializable की गारंटी तोड़ देता, इसलिए दूसरा विकल्प ग़लत है।
At the Serializable level, the lock or snapshot that E holds on the row it has read stays in force until E finishes. So F either waits before deleting that row, or, if the delete goes through, E still sees its own older view. The result is that E keeps seeing the row with the value 400. Seeing the row as deleted would break the serializable guarantee, so option 2 is wrong.
प्रश्न 5उत्तर + हल
Repeatable Read isolation level वाले डेटाबेस में Transaction C किसी पंक्ति का मान 200 पढ़ता है, फिर C के commit करने से पहले Transaction D उसी पंक्ति को 300 कर देता है। दोबारा पढ़ने पर C को कौन-सा मान दिखेगा?
In a database system with Repeatable Read isolation level, if Transaction C reads a row with a value of 200 and then Transaction D updates the same row to 300 before Transaction C commits, what value will Transaction C see upon re-reading the row?
A0
B200
C300
Dतय नहीं (Undefined)Undefined
सही उत्तर / Answer: (B)
हल / Solution
Repeatable Read की पूरी गारंटी यही है कि transaction जिस पंक्ति को एक बार पढ़ ले, उसे दोबारा पढ़ने पर वही मान मिले। इसके लिए या तो उस पंक्ति पर shared lock transaction के अंत तक पकड़ा रहता है, या शुरुआत वाला snapshot सँभाला जाता है। इसलिए D के बदलाव के बावजूद C को 200 ही दिखेगा। 300 तब दिखता जब स्तर Read Committed होता, इसलिए वह यहाँ सही नहीं है।
The whole promise of Repeatable Read is that a row read once by a transaction gives the same value when read again. To achieve this the shared lock on that row is held until the transaction ends, or the opening snapshot is preserved. So despite D's change, C still sees 200. The value 300 would appear only at the Read Committed level, so it is not correct here.
प्रश्न 6उत्तर + हल
Read Committed isolation level वाले डेटाबेस में Transaction A किसी पंक्ति का मान 100 कर देता है और Transaction B उसे A के commit करने से पहले पढ़ता है। B को कौन-सा मान दिखेगा?
In a database system with Read Committed isolation level, if Transaction A updates a row with a value of 100 and Transaction B reads the same row before Transaction A commits, what value will Transaction B see?
A0
B50
C100
Dतय नहीं (Undefined)Undefined
सही उत्तर / Answer: (D)
हल / Solution
Read Committed पर B को A का बिना commit हुआ मान कभी नहीं दिखेगा, इसलिए 100 तो कट ही जाता है। B को उस पंक्ति का पिछला commit किया हुआ मान मिलेगा। प्रश्न में वह पुराना मान बताया ही नहीं गया है, इसलिए 0 या 50 में से किसी को भी सही नहीं कहा जा सकता। दी गई जानकारी से मान तय नहीं होता, इसीलिए चौथा विकल्प सही है।
At Read Committed, B can never see A's uncommitted value, so 100 is ruled out straight away. B will get the previously committed value of that row. The question never tells us what that earlier value was, so neither 0 nor 50 can be claimed as correct. The value simply cannot be fixed from the information given, which is why Undefined is the right choice here.
प्रश्न 7उत्तर + हल
कौन-सा isolation level transaction को दूसरे transaction के वे बदलाव भी देख लेने देता है जो अभी commit नहीं हुए?
Which isolation level allows transactions to see changes made by other transactions even if they were not committed?
ARead Committed
BRepeatable Read
CSerializable
DRead Uncommitted
सही उत्तर / Answer: (D)
हल / Solution
Read Uncommitted इकलौता ऐसा स्तर है जहाँ पढ़ने से पहले कोई shared lock नहीं लिया जाता। इसलिए transaction दूसरे transaction का वह मान भी पढ़ लेता है जो अभी buffer में है और commit नहीं हुआ। इसी छूट का नाम dirty read है। बाक़ी तीन स्तर, यानी Read Committed, Repeatable Read और Serializable, सब यह पक्का करते हैं कि पढ़ा गया मान commit हो चुका हो, इसलिए वे इस प्रश्न का उत्तर नहीं बन सकते।
Read Uncommitted is the only level at which no shared lock is taken before a read. A transaction can therefore read a value that another transaction still holds in its buffer and has not committed. This permissiveness is exactly what a dirty read means. The other three levels, Read Committed, Repeatable Read and Serializable, all make sure that a value being read has already been committed, so none of them fits.
प्रश्न 8उत्तर + हल
transaction isolation level के संदर्भ में 'phantom read' किसे कहते हैं?
In the context of transaction isolation levels, what does the term "phantom read" refer to?
Atransaction का बिना commit हुआ डेटा पढ़नाTransactions reading uncommitted data
Btransaction का एक-दूसरे के बदलाव बिना देखे ऊपर से लिख देनाTransactions overwriting each other's changes without seeing them
Ctransaction को चलते-चलते एक ही डेटा के अलग-अलग मान दिखनाTransactions seeing different values for the same data during their execution
Dtransaction को चलते-चलते एक ही क्वेरी पर पंक्तियों का अलग-अलग समूह मिलनाTransactions seeing different sets of rows returned by a query during their execution
सही उत्तर / Answer: (D)
हल / Solution
phantom read का सम्बन्ध पंक्तियों की संख्या से है, किसी एक मान से नहीं। transaction एक बार शर्त लगाकर क्वेरी चलाता है, बीच में कोई और transaction उसी शर्त पर बैठने वाली नई पंक्ति जोड़कर commit कर देता है, और दोबारा क्वेरी चलाने पर पहले से ज़्यादा पंक्तियाँ मिल जाती हैं। यही चौथे विकल्प की बात है। एक ही पंक्ति का मान बदल जाना unrepeatable read है और बिना commit हुआ मान पढ़ना dirty read।
A phantom read is about the number of rows returned, not about one value. A transaction runs a query with some condition, another transaction then inserts and commits a new row that satisfies the same condition, and the second run of the query returns more rows than the first. That is option 4. A changed value in one existing row is an unrepeatable read, and reading uncommitted data is a dirty read.
प्रश्न 9उत्तर + हल
transaction isolation level के संदर्भ में 'lost update' किसे कहते हैं?
In the context of transaction isolation levels, what does the term "lost update" refer to?
Atransaction का बिना commit हुआ डेटा पढ़नाTransactions reading uncommitted data
Btransaction का एक-दूसरे के बदलाव बिना देखे ऊपर से लिख देनाTransactions overwriting each other's changes without seeing them
Ctransaction को दूसरे transaction के बदलाव न दिखनाTransactions not seeing changes made by other transactions
Dtransaction को चलते-चलते एक ही डेटा के अलग-अलग मान दिखनाTransactions seeing different values for the same data during their execution
सही उत्तर / Answer: (B)
हल / Solution
lost update तब होता है जब दो transaction एक ही पंक्ति का पुराना मान पढ़ते हैं, दोनों उस पर अपना हिसाब लगाते हैं और फिर बारी-बारी लिख देते हैं। बाद में लिखने वाला पहले वाले का बदलाव मिटा देता है, इसलिए एक update खो जाता है। यही दूसरे विकल्प की बात है। बिना commit हुआ डेटा पढ़ना dirty read है, और एक ही डेटा के अलग-अलग मान दिखना unrepeatable read कहलाता है।
A lost update occurs when two transactions read the same old value of a row, each computes its own new value from it, and then both write back one after the other. The later write wipes out the earlier one, so one update is simply lost. That is what option 2 describes. Reading uncommitted data is a dirty read, and seeing different values of the same item is an unrepeatable read.
प्रश्न 10उत्तर + हल
कौन-सा isolation level यह गारंटी देता है कि transaction serializable ढंग से चलें और डेटा की संगति सबसे ऊँची रहे?
Which isolation level guarantees that transactions are executed in a serializable manner, ensuring the highest level of data consistency?
ARead Uncommitted
BRead Committed
CRepeatable Read
DSerializable
सही उत्तर / Answer: (D)
हल / Solution
Serializable नाम ही इसका उत्तर बताता है। इस स्तर पर DBMS इतने ताले लगाता है कि गुँथा हुआ execution भी किसी serial क्रम के बराबर ही निकले। इसीलिए dirty read, unrepeatable read और phantom read, तीनों रुक जाते हैं और संगति सबसे ऊँची रहती है। Read Uncommitted तीनों को खुला छोड़ता है, Read Committed सिर्फ़ dirty read रोकता है, और Repeatable Read phantom तक नहीं पहुँचता।
The name Serializable gives the answer away. At this level the DBMS takes enough locks that even an interleaved execution ends up equivalent to some serial order. Dirty reads, unrepeatable reads and phantom reads are all prevented, so data consistency is at its highest. Read Uncommitted leaves all three open, Read Committed stops only dirty reads, and Repeatable Read still does not deal with phantoms.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
डेटाबेस प्रबंधन प्रणाली में transaction isolation level का मक़सद क्या है?
What is the purpose of transaction isolation levels in a database management system?
Aयह पक्का करना कि transaction साथ-साथ चलेंTo ensure that transactions are executed in a concurrent manner
Btransaction के चलने का क्रम तय करनाTo specify the order in which transactions are executed
Cएक transaction के बदलाव दूसरे transaction को कितने दिखें, यह नियंत्रित करनाTo control the visibility of data changes made by one transaction to other transactions
Dtransaction कितनी देर सक्रिय रहेगा, यह तय करनाTo determine the duration for which a transaction remains active
एक social media app में transaction T1 उपयोगकर्ता की profile picture बदलता है और transaction T2 उसी उपयोगकर्ता की profile जानकारी पढ़ता है। कौन-सा scheduling गुण पक्का करता है कि T2 को हमेशा सबसे नई profile picture ही मिले?
In a social media application, transaction T1 updates a user's profile picture, while transaction T2 retrieves the user's profile information. Which scheduling property ensures that T2 always accesses the most recent profile picture?
एक e-commerce platform पर transaction T1 ग्राहक का order संसाधित करता है और transaction T2 बिके हुए सामान के हिसाब से inventory बदलता है। कौन-सा scheduling गुण पक्का करता है कि अगले order से पहले inventory में T1 का बेचा हुआ सामान दिख जाए?
In an e-commerce platform, transaction T1 processes a customer's order, while transaction T2 updates the inventory to reflect the sold items. What scheduling property ensures that the inventory reflects the items sold by T1 before processing other orders?
अस्पताल की मरीज़ प्रबंधन प्रणाली में transaction T1 किसी मरीज़ का medical record बदलता है और transaction T2 उसी मरीज़ के लिए appointment तय करता है। कौन-सा scheduling गुण पक्का करता है कि appointment तय करते समय मरीज़ की नई जानकारी उपलब्ध हो?
In a hospital patient management system, transaction T1 updates a patient's medical record, while transaction T2 schedules an appointment for the patient. Which scheduling property ensures that the patient's updated medical information is available when scheduling an appointment?
एक retail inventory प्रणाली में transaction T1 ख़रीद के बाद उत्पाद का स्टॉक घटाता है और transaction T2 उसी उत्पाद का दाम बदलता है। कौन-सा scheduling गुण यह पक्का करता है कि ग्राहक को उपलब्ध मात्रा के साथ हमेशा सही दाम दिखे?
In a retail inventory management system, transaction T1 updates the quantity of a product in stock after a purchase, while transaction T2 updates the product's price. What scheduling property ensures that customers always see the correct price for the available quantity of a product?