पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।
भाषा
प्रश्न 1उत्तर + हल
query processing के लिहाज़ से bitmap index की मुख्य सीमा क्या है?
What is the primary limitation of bitmap indices in terms of query processing?
Aतदर्थ (ad-hoc) query के लिए कम सहाराLimited support for ad-hoc queries
Bसमवर्ती (concurrent) transaction सँभाल न पानाInability to handle concurrent transactions
Cछितरे (sparse) सामान पर बहुत storage लगनाHigh storage overhead for sparse data
Dपरास वाली query (range query) पर धीमा चलनाSlow performance for range queries
सही उत्तर / Answer: (D)
हल / Solution
bitmap index हर भिन्न मान के लिए एक बिट-सदिश रखता है। बराबरी की शर्त पर एक ही सदिश पढ़ना पड़ता है, पर परास (range) की शर्त पर उसमें आने वाले हर मान का सदिश OR करना पड़ता है, इसलिए चौड़ी परास महँगी पड़ती है। B+ वृक्ष वहाँ पत्तों की कड़ी एक बार चल लेता है, इसलिए विकल्प 4 सही है। विकल्प 1 उलटा है: तदर्थ query पर bitmap की ताक़त है। 2 और 3 बदलाव और जगह की बात हैं।
A bitmap index keeps one bit vector for every distinct value. An equality predicate reads a single vector, but a range predicate must fetch one vector per value inside the range and OR them together, so a wide range becomes expensive. A B+ tree instead walks its leaf chain once, which is why option 4 is correct. Option 1 is backwards, since ad-hoc queries are a bitmap strength, while options 2 and 3 concern updates and space.
प्रश्न 2उत्तर + हल
Embedded SQL वाले application में प्रदर्शन सुधारने के लिए आम तौर पर कौन-सी optimization तकनीक काम में लेते हैं?
Which optimization technique is commonly used to improve performance in embedded SQL applications?
Aquery caching (query और उसका plan सहेज लेना)Query caching
Blazy loading (ज़रूरत पड़ने पर ही सामान लाना)Lazy loading
Cquery hinting (optimizer को संकेत देना)Query hinting
Dindex fragmentation (index का बिखर जाना)Index fragmentation
सही उत्तर / Answer: (A)
हल / Solution
Embedded SQL में गिने-चुने कथन मेज़बान भाषा में लिखे रहते हैं और बदले हुए host variable के साथ बार-बार चलते हैं। इसलिए तैयार कथन और उसका plan सहेज लेना सबसे बड़ा फ़ायदा देता है: हर बार की parsing और optimization बच जाती है। यही query caching है, इसलिए विकल्प 1 सही है। lazy loading application की शैली है। hinting हाथ से की जाने वाली छँटाई है, रोज़ का उपाय नहीं। और index का बिखरना तो ख़ुद एक बीमारी है।
Embedded SQL keeps a small set of fixed statements inside the host program, and they run again and again with new host variable values. Caching the prepared statement together with its plan therefore gives the biggest gain, since parsing and optimization are skipped each time. That is query caching, so option 1 is correct. Lazy loading is an application fetch pattern, hinting is occasional manual tuning, and index fragmentation is a problem rather than a technique.
प्रश्न 3उत्तर + हल
जिस query को एक ही table से बहुत बड़ी संख्या में पंक्तियाँ पढ़नी हों, उसके लिए आम तौर पर कौन-सा evaluation plan चुना जाता है?
Which of the following query evaluation plans is likely to be chosen for a query that requires accessing a large number of rows from a single table?
Aपूरी table का क्रमिक scan (full table scan)Full table scan
Bहैश join (hash join)Hash join
Cइंडेक्स join (index join)Index join
Dमर्ज join (merge join)Merge join
सही उत्तर / Answer: (A)
हल / Solution
यहाँ table एक ही है, इसलिए join का कोई तरीक़ा लगता ही नहीं और विकल्प 2, 3, 4 अपने-आप हट जाते हैं। बड़ा हिस्सा पंक्तियों का चाहिए हो तो खंड क्रम से पढ़ लेना सबसे सस्ता पड़ता है, क्योंकि index के रास्ते जाने पर हर पंक्ति के लिए बेतरतीब पढ़ाई होती है और वही खंड बार-बार छू जाते हैं। इसीलिए एक हद से ज़्यादा पंक्तियाँ निकलने पर optimizer index छोड़कर पूरा scan चुन लेता है।
Only one table is involved here, so no join method applies at all and options 2, 3 and 4 drop out immediately. When a large share of the rows is needed, reading the blocks in order is the cheapest route, because going through an index means a random read per row and the same blocks get touched again and again. Past a certain selectivity the optimizer therefore abandons the index and scans the whole table.
प्रश्न 4उत्तर + हल
सबसे अच्छा query evaluation plan चुनने का मुख्य फ़ायदा क्या है?
What is the primary benefit of choosing an optimal query evaluation plan?
Aquery की parsing तेज़ हो जाती हैImproved query parsing performance
Bquery की जटिलता घट जाती हैReduced query complexity
Cquery तेज़ी से चलती हैFaster query execution
Ddatabase को कम storage चाहिएLower database storage requirements
सही उत्तर / Answer: (C)
हल / Solution
सस्ता plan कम खंड पढ़ता है और कम पंक्तियाँ बीच में सँभालता है, इसलिए वही query कम समय में पूरी हो जाती है। यही सारी कसरत का फल है, इसलिए विकल्प 3 सही है। parsing तो plan बनने से पहले ही हो चुकी होती है, इसलिए 1 ग़लत है। query की जटिलता वैसी ही रहती है जैसी उपयोगकर्ता ने लिखी, plan उसे घटाता नहीं। और storage की ज़रूरत सामान पर टिकी है, plan पर नहीं।
A cheaper plan reads fewer blocks and carries fewer intermediate rows, so the same query finishes in less time. That is the whole point of the exercise, which makes option 3 correct. Parsing already happened before any plan was built, so option 1 is wrong. Query complexity stays exactly as the user wrote it; a plan does not reduce it. Storage requirements depend on the stored data, not on the chosen plan.
प्रश्न 5उत्तर + हल
query evaluation plan चुनते समय आम तौर पर किस बात को नहीं देखा जाता?
Which of the following factors is NOT typically considered when choosing a query evaluation plan?
Aबची हुई storage (available storage)Available storage
Bquery की जटिलताQuery complexity
CCPU की गतिCPU speed
Ddatabase का schemaDatabase schema
सही उत्तर / Answer: (A)
हल / Solution
disk पर कितनी जगह बची है, इससे यह नहीं बदलता कि दो plan में कौन सस्ता है, इसलिए optimizer उसे देखता ही नहीं और विकल्प 1 सही है। बाक़ी तीनों काम आते हैं: query जितनी जटिल हो, उतने plan टटोले जाते हैं; CPU की गति लागत मॉडल के स्थिरांकों में बैठी होती है; और schema बताता है कि कौन-से index, कुंजी और अड़चनें मौजूद हैं, जिनसे रास्ते और रूपांतरण तय होते हैं।
How much free space is left on disk does not change which of two plans is cheaper, so the optimizer never consults it and option 1 is correct. The other three do matter. The more complex the query, the larger the plan space searched; CPU speed is baked into the constants of the cost model; and the schema states which indexes, keys and constraints exist, which decides the legal access paths and transformations.
प्रश्न 6उत्तर + हल
Query optimization में index चुनने (index selection) का मुख्य लक्ष्य क्या है?
In query optimization, what is the primary goal of index selection?
Aexecution plan में join क्रियाओं की संख्या घटानाTo reduce the number of join operations in the query execution plan
Bquery चलाने के लिए ज़रूरी memory घटानाTo minimize the amount of memory required for query processing
Cindex के सहारे disk I/O क्रियाओं की संख्या घटानाTo minimize the number of disk I/O operations by utilizing indexes
Dexecution plan में क्रियाओं का क्रम सुधारनाTo optimize the order of operations in the query execution plan
सही उत्तर / Answer: (C)
हल / Solution
index सीधे उन्हीं पंक्तियों तक पहुँचा देता है जो शर्त पर खरी हैं, इसलिए पूरी table के खंड पढ़ने की ज़रूरत नहीं पड़ती और पढ़े जाने वाले खंड घट जाते हैं। यही index चुनने का असली मक़सद है, इसलिए विकल्प 3 सही है। join हटाना अलग तकनीक है, जिसे join elimination कहते हैं। memory बचाना लक्ष्य नहीं, क्योंकि index ख़ुद अतिरिक्त जगह लेता है। और क्रियाओं का क्रम plan बनाते समय तय होता है।
An index leads straight to the rows that satisfy a predicate, so the engine need not read every block of the table and the number of blocks fetched drops sharply. That is the real aim of index selection, making option 3 correct. Removing joins is a separate technique called join elimination. Saving memory is not the goal, since an index itself occupies extra space, and operation ordering is decided while building the plan.
प्रश्न 7उत्तर + हल
जिस query में बहुत बड़े सामान को क्रम में लगाना पड़े, उसके लिए आम तौर पर कौन-सा evaluation plan चुना जाता है?
Which of the following query evaluation plans is likely to be chosen for a query that requires sorting a large amount of data?
सॉर्ट-मर्ज join दोनों तरफ़ का सामान बाहरी मर्ज सॉर्ट (external merge sort) से क्रम में लगाता है और फिर एक ही चाल में मिला देता है। क्रम वैसे भी ज़रूरी हो, जैसे ORDER BY या GROUP BY के लिए, तो वह मेहनत दोहरा काम कर जाती है और नतीजा भी क्रम में रहता है। इसलिए विकल्प 3 सही है। हैश join का नतीजा बेतरतीब होता है, nested loop क्रम नहीं लगाता, और index join के लिए ठीक index चाहिए।
A sort-merge join sorts both inputs with an external merge sort and then combines them in a single pass. When the query needs sorted data anyway, say for an ORDER BY or a GROUP BY, that sorting effort serves two purposes at once and the output stays ordered. Hence option 3. A hash join leaves its output unordered, a nested loop never sorts, and an index join depends on having a suitable index.
प्रश्न 8उत्तर + हल
query evaluation plan में कार्डिनैलिटी आँकने (cardinality estimation) का उद्देश्य क्या है?
In query evaluation plans, what is the purpose of cardinality estimation?
Aquery चलाने में लगने वाले CPU चक्र आँकनाTo estimate the number of CPU cycles required for query execution
Bquery चलते समय memory का इस्तेमाल आँकनाTo estimate the memory usage during query execution
Cplan की हर क्रिया से निकलने वाली पंक्तियों की संख्या आँकनाTo estimate the number of rows returned by each operation in the query plan
Dquery चलाने में लगने वाली disk I/O क्रियाएँ आँकनाTo estimate the disk I/O operations required for query execution
सही उत्तर / Answer: (C)
हल / Solution
कार्डिनैलिटी का अर्थ है पंक्तियों की गिनती। optimizer plan की हर क्रिया पर यह आँकता है कि उसमें से कितनी पंक्तियाँ निकलेंगी, इसलिए विकल्प 3 सही है। यह अंक आँकड़ों और histogram से आता है और नीचे से ऊपर चलता है: चुनाव की गिनती से join की गिनती बनती है। बाक़ी तीनों विकल्प संसाधनों का अंदाज़ा हैं, जो इसी गिनती के बाद निकलते हैं। गिनती बिगड़ी तो पूरा लागत अनुमान बिगड़ जाता है।
Cardinality simply means a row count. For every operation in the plan the optimizer estimates how many rows will come out of it, so option 3 is correct. The figure comes from statistics and histograms and flows upward: the row count of a selection feeds the row count of the join above it. The other three options are resource estimates derived afterwards. A bad row count spoils the whole cost estimate.
प्रश्न 9उत्तर + हल
भिन्न-भिन्न query evaluation plan की लागत आँकने के लिए query optimizer आम तौर पर कौन-सी तकनीक काम में लेता है?
Which of the following techniques is commonly used by the query optimizer to estimate the cost of different query evaluation plans?
लागत-आधारित optimization में हर उम्मीदवार plan की लागत आँकड़ों से गिनी जाती है: table की पंक्तियाँ, खंडों की संख्या, index की ऊँचाई और histogram। फिर यही अंक आपस में तुलने पर सबसे सस्ता plan चुना जाता है, इसलिए विकल्प 3 सही है। अनुभव-आधारित विश्लेषण तय नियमों से plan चुनता है, लागत गिनता ही नहीं। नमूना लेना आँकड़े जमा करने का तरीक़ा है, और query folding expression सरल करने का क़दम है।
In cost-based optimization the cost of every candidate plan is computed from stored statistics: row counts, the number of blocks, index height and histograms. These numbers are then compared and the cheapest plan wins, so option 3 is correct. Heuristic analysis picks a plan from fixed rules without computing any cost. Random sampling is a way of gathering statistics, and query folding is a step that simplifies expressions.
प्रश्न 10उत्तर + हल
query evaluation plan परखते समय query optimizer का मुख्य लक्ष्य क्या होता है?
When evaluating query evaluation plans, what is the primary goal of the query optimizer?
Aquery चलाने में लगने वाले CPU चक्रों की संख्या घटानाTo minimize the number of CPU cycles required for query execution
Bquery चलाने में लगने वाली disk I/O क्रियाओं की संख्या घटानाTo minimize the number of disk I/O operations required for query execution
Cquery चलते समय memory का इस्तेमाल घटानाTo minimize the memory usage during query execution
Dलागत मॉडल (cost model) के हिसाब से query चलाने की कुल लागत घटानाTo minimize the total cost of query execution based on a cost model
सही उत्तर / Answer: (D)
हल / Solution
optimizer हर plan पर एक लागत मॉडल (cost model) लगाता है। वह मॉडल खंड पढ़ने, disk की खोज (seek), CPU और memory, सबको एक ही पैमाने में जोड़ देता है, और सबसे सस्ता कुल जोड़ वाला plan चुन लिया जाता है। इसलिए विकल्प 4 सही है। विकल्प 1, 2 और 3 उसी जोड़ के हिस्से हैं। अकेले किसी एक को घटाने पर दूसरा बढ़ सकता है, जैसे disk I/O बचाने के लिए बहुत memory लेना; इसीलिए लक्ष्य कुल लागत है।
The optimizer applies a cost model to every candidate plan. That model adds block transfers, disk seeks, CPU work and memory use into one common measure, and the plan with the smallest total is chosen. So option 4 is correct. Options 1, 2 and 3 are only components of that total. Cutting one alone can raise another, as when saving disk reads demands a large amount of memory, which is why the goal is total cost.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
कौन-सा तुल्यता नियम कहता है कि कोई शर्त AND या OR से जुड़ी शर्तों में समा सकती है, बशर्ते वह उनमें से किसी एक को निहित करती हो?
Which of the following equivalence rules states that a condition can be absorbed into a conjunction or disjunction of conditions if it implies one of them?
तुल्यता नियमों में वह कौन-सा गुण है जो कहता है कि दो शर्तें तुल्य हों तो किसी expression में एक को दूसरी से बदला जा सकता है?
In equivalence rules, which property states that if two conditions are equivalent, then any expression containing one condition can be replaced by an expression containing the other condition?