Data Structures and Algorithms — MCQ Practice

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

📚 1018 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
1018 questions
76
EN + हिं Medium
GB Python's list.sort() vs sorted(list) — key difference?
IN पायथन की list.sort() बनाम sorted(list) — मुख्य अंतर?
A
Both return new list दोनों नई सूची लौटाते हैं
B
list.sort() in-place; sorted() returns new list list.sort() यथास्थान; sorted() नई सूची लौटाता है
C
sorted() in-place; list.sort() returns new सॉर्ट किया गया() इन-प्लेस; list.sort() नया लौटाता है
D
Identical समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) list.sort() modifies in-place; sorted() returns new sorted list.
व्याख्या (हिन्दी) list.sort() यथास्थान संशोधित करता है; sorted() नई क्रमबद्ध सूची लौटाता है।
77
EN + हिं Hard
GB Radix sort time complexity?
IN रेडिक्स सॉर्ट समय जटिलता?
A
O(n log n) ओ(एन लॉग एन)
B
O(n²) ओ(एन²)
C
O(nk) where k=number of digits O(nk) जहां k=अंकों की संख्या
D
O(n) पर)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Radix sort: O(nk) where n=elements, k=digits in max element.
व्याख्या (हिन्दी) मूलांक प्रकार: O(nk) जहां n=तत्व, k=अधिकतम तत्व में अंक।
78
EN + हिं Medium
GB After sorting [5,3,7,1,9,6] using selection sort, first element placed?
IN चयन सॉर्ट का उपयोग करके [5,3,7,1,9,6] सॉर्ट करने के बाद, पहला तत्व रखा गया?
A
5 5
B
3 3
C
1 1
D
7 7
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Min of [5,3,7,1,9,6]=1, swapped to index 0.
व्याख्या (हिन्दी) [5,3,7,1,9,6]=1 का न्यूनतम, सूचकांक 0 पर बदल दिया गया।
79
EN + हिं Hard
GB How many passes does bubble sort need worst case for n elements?
IN एन तत्वों के लिए सबसे खराब स्थिति में बबल सॉर्ट को कितने पास की आवश्यकता होती है?
A
n एन
B
n/2 एन/2
C
n-1 एन-1
D
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n-1 passes needed in worst case (reverse sorted).
व्याख्या (हिन्दी) सबसे खराब स्थिति में n-1 पास की आवश्यकता होती है (रिवर्स सॉर्ट किया गया)।
80
EN + हिं Medium
GB In quick sort, elements smaller than pivot go to:
IN त्वरित क्रम में, धुरी से छोटे तत्व यहां जाते हैं:
A
Right side दाहिनी ओर
B
Both sides दोनों पक्षों
C
Left side बाईं तरफ
D
Random side यादृच्छिक पक्ष
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Elements < pivot → left partition; elements > pivot → right partition.
व्याख्या (हिन्दी) तत्व < धुरी → बायां विभाजन; तत्व > धुरी → दायां विभाजन।
81
EN + हिं Easy
GB In insertion sort, what does pos=pos-1 do?
IN सम्मिलन प्रकार में, pos=pos-1 क्या करता है?
A
Moves to next element अगले तत्व पर ले जाता है
B
Moves position left to find insertion spot सम्मिलन स्थान ढूंढने के लिए स्थिति को बाईं ओर ले जाता है
C
Deletes current वर्तमान हटाता है
D
Increments outer loop बाहरी लूप को बढ़ाता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) pos=pos-1 moves left to compare with previous sorted element.
व्याख्या (हिन्दी) pos=pos-1 पिछले क्रमबद्ध तत्व के साथ तुलना करने के लिए बाईं ओर चलता है।
82
EN + हिं Medium
GB Stack follows which principle?
IN स्टैक किस सिद्धांत का पालन करता है?
A
FIFO फीफो
B
LIFO जीवन
C
FILO FILO
D
Random access यादृच्छिक पहुंच
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Stack: LIFO — Last In First Out.
व्याख्या (हिन्दी) स्टैक: LIFO - लास्ट इन फर्स्ट आउट।
83
EN + हिं Medium
GB Operation to add element to stack?
IN स्टैक में तत्व जोड़ने के लिए ऑपरेशन?
A
Enqueue कतारबद्ध करें
B
Insert डालना
C
Push धकेलना
D
Add जोड़ना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Push adds an element to the top of the stack.
व्याख्या (हिन्दी) पुश स्टैक के शीर्ष पर एक तत्व जोड़ता है।
84
EN + हिं Medium
GB Operation to remove element from stack?
IN स्टैक से तत्व को हटाने के लिए ऑपरेशन?
A
Dequeue विपंक्ति
B
Delete मिटाना
C
Remove निकालना
D
Pop जल्दी से आना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Pop removes and returns the top element of the stack.
व्याख्या (हिन्दी) पॉप स्टैक के शीर्ष तत्व को हटाता है और लौटाता है।
85
EN + हिं Medium
GB Python list method to push onto stack?
IN स्टैक पर पुश करने के लिए पायथन सूची विधि?
A
add() जोड़ना()
B
insert() डालना()
C
append() जोड़ें()
D
push() धकेलना()
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) list.append() adds to end — simulates stack push.
व्याख्या (हिन्दी) list.append() अंत में जोड़ता है - स्टैक पुश का अनुकरण करता है।
86
EN + हिं Medium
GB Python list method to pop from stack?
IN स्टैक से पॉप करने के लिए पायथन सूची विधि?
A
remove() निकालना()
B
pop() जल्दी से आना()
C
delete() मिटाना()
D
dequeue() कतार()
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) list.pop() removes and returns last element — simulates stack pop.
व्याख्या (हिन्दी) list.pop() अंतिम तत्व को हटाता है और लौटाता है - स्टैक पॉप का अनुकरण करता है।
87
EN + हिं Medium
GB Error when popping from empty stack?
IN खाली स्टैक से पॉपिंग करते समय त्रुटि?
A
Queue Overflow कतार अतिप्रवाह
B
Stack Underflow स्टैक अंडरफ़्लो
C
Memory Leak मेमोरी लीक
D
Index Error अनुक्रमणिका त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Stack Underflow: popping from empty stack.
व्याख्या (हिन्दी) स्टैक अंडरफ्लो: खाली स्टैक से पॉपिंग।
88
EN + हिं Medium
GB Error when pushing to full array-based stack?
IN पूर्ण सरणी-आधारित स्टैक पर पुश करते समय त्रुटि?
A
Stack Underflow स्टैक अंडरफ़्लो
B
Queue Overflow कतार अतिप्रवाह
C
Stack Overflow स्टैक ओवरफ़्लो
D
Memory Error स्मृति त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Stack Overflow: pushing to a full stack.
व्याख्या (हिन्दी) स्टैक ओवरफ़्लो: पूर्ण स्टैक की ओर धकेलना।
89
EN + हिं Easy
GB What does peek() do on a stack?
IN पीक() स्टैक पर क्या करता है?
A
Removes top element शीर्ष तत्व को हटा देता है
B
Returns top without removing बिना हटाए शीर्ष पर लौट आता है
C
Checks if empty जाँचता है कि क्या खाली है
D
Adds to bottom नीचे जोड़ता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) peek() returns top element without removing it.
व्याख्या (हिन्दी) peek() शीर्ष तत्व को हटाए बिना लौटाता है।
90
EN + हिं Hard
GB Time complexity of push and pop on a stack?
IN स्टैक पर पुश और पॉप की समय जटिलता?
A
O(n) पर)
B
O(log n) ओ(लॉग एन)
C
O(1) हे(1)
D
O(n²) ओ(एन²)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Both push and pop are O(1) — constant time.
व्याख्या (हिन्दी) पुश और पॉप दोनों O(1) हैं - स्थिर समय।
76–90 of 1018