Data Structures and Algorithms — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 819 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
819 questions
166
EN + हिं Medium
GB Catalan number C(n) counts?
IN कैटलन संख्या सी(एन) मायने रखती है?
A
Nodes in BST बीएसटी में नोड्स
B
Distinct BSTs with n keys एन कुंजी के साथ विशिष्ट बीएसटी
C
Graph paths ग्राफ़ पथ
D
Complete graph edges पूर्ण ग्राफ किनारे
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Catalan number = number of structurally distinct BSTs with n keys.
व्याख्या (हिन्दी) कैटलन संख्या = एन कुंजी के साथ संरचनात्मक रूप से अलग बीएसटी की संख्या।
167
EN + हिं Medium
GB Which sorting is best for only 0s, 1s, 2s?
IN केवल 0s, 1s, 2s के लिए कौन सी सॉर्टिंग सर्वोत्तम है?
A
Merge sort मर्ज सॉर्ट
B
Quick sort त्वरित छँटाई
C
Dutch National Flag (3-way partition) डच राष्ट्रीय ध्वज (तीन-तरफा विभाजन)
D
Heap sort ढेर बनाएं और छांटें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Dutch National Flag sorts 0s/1s/2s in O(n) with single pass.
व्याख्या (हिन्दी) डच राष्ट्रीय ध्वज एकल पास के साथ O(n) में 0s/1s/2s सॉर्ट करता है।
168
EN + हिं Hard
GB Building a heap from n elements time complexity?
IN एन तत्वों समय जटिलता से एक ढेर का निर्माण?
A
O(n log n) ओ(एन लॉग एन)
B
O(n) पर)
C
O(n²) ओ(एन²)
D
O(log n) ओ(लॉग एन)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Heapify from n elements (Floyd's algorithm) = O(n).
व्याख्या (हिन्दी) n तत्वों से ढेर बनाएं (फ्लोयड का एल्गोरिदम) = O(n)।
169
EN + हिं Easy
GB What is a sparse graph?
IN विरल ग्राफ क्या है?
A
Few edges relative to vertices शीर्षों के सापेक्ष कुछ किनारे
B
Many edges अनेक किनारे
C
No vertices कोई शीर्ष नहीं
D
Complete graph पूरा ग्राफ
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sparse graph: E << V². Use adjacency list for sparse graphs.
व्याख्या (हिन्दी) विरल ग्राफ: ई
170
EN + हिं Medium
GB 2-3 tree is?
IN 2-3 पेड़ है?
A
Binary tree 2 or 3 children बाइनरी ट्री 2 या 3 बच्चे
B
B-tree of order 3 (each internal node 2 or 3 children) क्रम 3 का बी-ट्री (प्रत्येक आंतरिक नोड 2 या 3 बच्चे)
C
2 levels, 3 nodes 2 स्तर, 3 नोड
D
Exactly 3 leaves बिल्कुल 3 पत्ते
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2-3 tree: B-tree of order 3 — all leaves at same level.
व्याख्या (हिन्दी) 2-3 पेड़: क्रम 3 का बी-पेड़ - सभी पत्तियाँ समान स्तर पर।
171
EN + हिं Medium
GB Python list.pop(0) vs list.pop() difference?
IN पायथन list.pop(0) बनाम list.pop() अंतर?
A
Both remove from end दोनों सिरे से हटा देते हैं
B
pop(0) removes front O(n); pop() removes end O(1) पॉप(0) सामने वाले O(n) को हटा देता है; पॉप() अंत O(1) को हटा देता है
C
pop(0) O(1); pop() O(n) पॉप(0) ओ(1); पर पॉप)
D
Identical समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) pop(0): O(n) due to shifting. pop(): O(1) from end.
व्याख्या (हिन्दी) पॉप(0): शिफ्टिंग के कारण O(n)। पॉप(): O(1) अंत से।
172
EN + हिं Medium
GB BTreeSearch returns if key not found?
IN यदि कुंजी नहीं मिली तो BTreeSearch वापस आ जाता है?
A
-1 -1
C
NIL (NULL) शून्य (शून्य)
D
False असत्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) BTreeSearch returns NIL when key not found (leaf reached without finding).
व्याख्या (हिन्दी) कुंजी नहीं मिलने पर BTreeSearch शून्य लौटाता है (पत्ता बिना खोजे पहुंच जाता है)।
173
EN + हिं Medium
GB mid in mergesort([5,9,10,1,66])?
IN मर्जसॉर्ट में मध्य([5,9,10,1,66])?
B
2 2
C
3 3
D
5 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) mid=5//2=2. left=[5,9], right=[10,1,66].
व्याख्या (हिन्दी) मध्य=5//2=2. बाएँ=[5,9], दाएँ=[10,1,66]।
174
EN + हिं Medium
GB Result of quicksort([56,25,93,15,31,44])?
IN क्विकसॉर्ट का परिणाम([56,25,93,15,31,44])?
A
[93,56,44,31,25,15] [93,56,44,31,25,15]
B
[15,25,31,44,56,93] [15,25,31,44,56,93]
C
[15,44,25,31,56,93] [15,44,25,31,56,93]
D
[25,15,44,31,56,93] [25,15,44,31,56,93]
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Quicksort ascending: [15,25,31,44,56,93].
व्याख्या (हिन्दी) क्विकॉर्ट आरोही: [15,25,31,44,56,93]।
175
EN + हिं Medium
GB Binary search on [12,24,32,39,45,50,54] for 45 returns?
IN 45 रिटर्न के लिए [12,24,32,39,45,50,54] पर बाइनरी खोज?
A
3 3
B
4 4
C
5 5
D
-1 -1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 45 is at index 4 (0-indexed).
व्याख्या (हिन्दी) 45 सूचकांक 4 (0-अनुक्रमित) पर है।
176
EN + हिं Medium
GB dict.items() returns?
IN dict.items() रिटर्न?
A
Only keys केवल चाबियाँ
B
Only values केवल मूल्य
C
All key-value pairs as tuples सभी कुंजी-मूल्य जोड़े टुपल्स के रूप में
D
Count of items वस्तुओं की गिनती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) dict.items() returns all key-value pairs as tuples.
व्याख्या (हिन्दी) dict.items() सभी कुंजी-मूल्य जोड़े को टुपल्स के रूप में लौटाता है।
177
EN + हिं Medium
GB Python set vs list membership check?
IN पायथन सेट बनाम सूची सदस्यता जांच?
A
Both O(1) दोनों O(1)
B
Both O(n) दोनों पर)
C
List O(n); Set O(1) average सूची ओ(एन); O(1) औसत सेट करें
D
List O(log n); Set O(1) सूची ओ(लॉग एन); सेट ओ(1)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) List: O(n) scan; Set: O(1) average with hashing.
व्याख्या (हिन्दी) सूची: O(n) स्कैन; सेट: हेशिंग के साथ ओ(1) औसत।
178
EN + हिं Medium
GB Tuple vs list in Python?
IN पायथन में टुपल बनाम सूची?
A
Both mutable दोनों परिवर्तनशील
B
List immutable; Tuple mutable सूची अपरिवर्तनीय; टपल परिवर्तनशील
C
Tuple immutable and hashable; List mutable टपल अपरिवर्तनीय और धोने योग्य; सूची परिवर्तनशील
D
Both immutable दोनों अपरिवर्तनीय
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Tuple: immutable, hashable. List: mutable, not hashable.
व्याख्या (हिन्दी) टपल: अपरिवर्तनीय, धोने योग्य। सूची: परिवर्तनशील, धोने योग्य नहीं।
179
EN + हिं Medium
GB Ford-Fulkerson algorithm solves:
IN फोर्ड-फ़ल्कर्सन एल्गोरिदम हल करता है:
A
Shortest path सबसे छोटा रास्ता
B
Maximum flow in a network किसी नेटवर्क में अधिकतम प्रवाह
C
Minimum spanning tree न्यूनतम फैलाव वाला पेड़
D
Topological sort टोपोलॉजिकल सॉर्ट
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Ford-Fulkerson finds max-flow using augmenting paths.
व्याख्या (हिन्दी) फोर्ड-फ़ल्कर्सन संवर्द्धन पथों का उपयोग करके अधिकतम-प्रवाह पाता है।
180
EN + हिं Medium
GB Longest Increasing Subsequence (LIS) of {3,10,2,1,20} has length:
IN {3,10,2,1,20} की सबसे लंबी बढ़ती अनुवर्ती (एलआईएस) की लंबाई है:
A
2 2
B
3 3
C
4 4
D
5 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) LIS = {3,10,20} or {1,20} → max length 3.
व्याख्या (हिन्दी) एलआईएस = {3,10,20} या {1,20} → अधिकतम लंबाई 3।
166–180 of 819