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
241
EN + हिं Medium
GB DFS explores?
IN डीएफएस अन्वेषण करता है?
A
All adjacent simultaneously सभी एक साथ आसन्न
B
Deep as possible along each branch before backtracking पीछे हटने से पहले प्रत्येक शाखा के साथ जितना संभव हो उतना गहरा करें
C
All same level सभी समान स्तर के
D
Randomly बेतरतीब
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) DFS goes as deep as possible, then backtracks via stack.
व्याख्या (हिन्दी) डीएफएस जितना संभव हो उतना गहराई तक जाता है, फिर स्टैक के माध्यम से पीछे जाता है।
242
EN + हिं Hard
GB Time complexity of BFS (V vertices, E edges)?
IN बीएफएस की समय जटिलता (वी कोने, ई किनारे)?
A
O(V) ओ(वी)
B
O(E) ओ(ई)
C
O(V+E) ओ(वी+ई)
D
O(V×E) ओ(वी×ई)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) BFS: O(V+E) — each vertex and edge visited once.
व्याख्या (हिन्दी) बीएफएस: ओ(वी+ई) - प्रत्येक शीर्ष और किनारे का एक बार दौरा किया गया।
243
EN + हिं Hard
GB Time complexity of DFS?
IN डीएफएस की समय जटिलता?
A
O(V) ओ(वी)
B
O(E) ओ(ई)
C
O(V×E) ओ(वी×ई)
D
O(V+E) ओ(वी+ई)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) DFS: O(V+E) — same as BFS.
व्याख्या (हिन्दी) डीएफएस: ओ(वी+ई) - बीएफएस के समान।
244
EN + हिं Medium
GB 2D array graph representation?
IN 2डी सरणी ग्राफ प्रतिनिधित्व?
A
Adjacency list निकटवर्ती सूची
B
Adjacency matrix सहखंडज मैट्रिक्स
C
Edge list किनारे की सूची
D
Incidence matrix घटना मैट्रिक्स
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Adjacency matrix: V×V 2D array; matrix[i][j]=1 if edge exists.
व्याख्या (हिन्दी) निकटवर्ती मैट्रिक्स: V×V 2D सरणी; मैट्रिक्स[i][j]=1 यदि किनारा मौजूद है।
245
EN + हिं Medium
GB Linked list graph representation?
IN लिंक्ड सूची ग्राफ प्रतिनिधित्व?
A
Adjacency matrix सहखंडज मैट्रिक्स
B
Adjacency list निकटवर्ती सूची
C
Edge matrix एज मैट्रिक्स
D
Incidence list घटना सूची
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Adjacency list: each vertex has a list of its adjacent vertices.
व्याख्या (हिन्दी) आसन्नता सूची: प्रत्येक शीर्ष पर उसके आसन्न शीर्षों की एक सूची होती है।
246
EN + हिं Hard
GB Space complexity of adjacency matrix?
IN आसन्न मैट्रिक्स की अंतरिक्ष जटिलता?
A
O(V) ओ(वी)
B
O(V+E) ओ(वी+ई)
C
O(V²) ओ(वी²)
D
O(E) ओ(ई)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Adjacency matrix requires O(V²) space.
व्याख्या (हिन्दी) आसन्न मैट्रिक्स को O(V²) स्थान की आवश्यकता होती है।
247
EN + हिं Medium
GB Graph used in social networks?
IN सामाजिक नेटवर्क में ग्राफ़ का उपयोग किया जाता है?
A
AVL tree एवीएल पेड़
B
Graph (users=vertices, connections=edges) ग्राफ़ (उपयोगकर्ता=शीर्ष, कनेक्शन=किनारे)
C
BST बीएसटी
D
Stack ढेर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Social networks: each user is a vertex, friendships are edges.
व्याख्या (हिन्दी) सामाजिक नेटवर्क: प्रत्येक उपयोगकर्ता एक शीर्ष है, मित्रता एक किनारा है।
248
EN + हिं Medium
GB BFS finds shortest path in?
IN बीएफएस को सबसे छोटा रास्ता मिला?
A
Weighted graphs भारित ग्राफ़
B
Unweighted graphs अभारित ग्राफ़
C
Directed only केवल निर्देशित किया
D
Cyclic only केवल चक्रीय
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) BFS finds shortest path (fewest edges) in unweighted graphs.
व्याख्या (हिन्दी) बीएफएस बिना भार वाले ग्राफ़ में सबसे छोटा रास्ता (सबसे कम किनारा) ढूंढता है।
249
EN + हिं Easy
GB DAG stands for?
IN DAG का मतलब है?
A
Data and Graph डेटा और ग्राफ़
B
Directed Acyclic Graph निर्देशित अचक्रीय ग्राफ
C
Dense Adjacency Graph सघन निकटवर्ती ग्राफ
D
Degree Arrangement Graph डिग्री व्यवस्था ग्राफ़
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) DAG = Directed Acyclic Graph.
व्याख्या (हिन्दी) डीएजी = निर्देशित चक्रीय ग्राफ़।
250
EN + हिं Medium
GB Topological sort applies to?
IN टोपोलॉजिकल सॉर्ट किस पर लागू होता है?
A
Undirected graphs अप्रत्यक्ष रेखांकन
B
DAG (Directed Acyclic Graphs) डीएजी (निर्देशित एसाइक्लिक ग्राफ़)
C
Weighted graphs भारित ग्राफ़
D
Complete graphs पूर्ण ग्राफ़
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Topological sort only for DAGs.
व्याख्या (हिन्दी) केवल डीएजी के लिए टोपोलॉजिकल सॉर्ट।
251
EN + हिं Medium
GB DFS detects cycle using?
IN DFS का उपयोग करके चक्र का पता लगाता है?
A
BFS check बीएफएस जांच
B
Back edge detection बैक एज डिटेक्शन
C
Binary search द्विआधारी खोज
D
Stack comparison ढेर तुलना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) DFS: if visited node encountered via back edge = cycle exists.
व्याख्या (हिन्दी) डीएफएस: यदि विज़िट किए गए नोड का पिछले किनारे से सामना होता है = चक्र मौजूद है।
252
EN + हिं Medium
GB Maximum edges in undirected graph with 5 vertices?
IN 5 शीर्षों के साथ अप्रत्यक्ष ग्राफ़ में अधिकतम किनारे?
A
5 5
B
10 10
C
15 15
D
20 20
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n(n-1)/2 = 5×4/2 = 10.
व्याख्या (हिन्दी) n(n-1)/2 = 5×4/2 = 10.
253
EN + हिं Medium
GB Number of edges in complete graph Kn?
IN संपूर्ण ग्राफ़ में किनारों की संख्या Kn?
A
n एन
B
n-1 एन-1
C
n(n-1)/2 n(n-1)/2
D
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Complete graph K_n has n(n-1)/2 edges.
व्याख्या (हिन्दी) पूर्ण ग्राफ़ K_n में n(n-1)/2 किनारे हैं।
254
EN + हिं Hard
GB Dijkstra's algorithm finds?
IN डिज्क्स्ट्रा का एल्गोरिदम ढूँढता है?
A
MST एमएसटी
B
Single-source shortest path (non-negative weights) एकल-स्रोत सबसे छोटा पथ (गैर-नकारात्मक भार)
C
All cycles सभी चक्र
D
Topological ordering टोपोलॉजिकल ऑर्डरिंग
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Dijkstra: single-source shortest path with non-negative edge weights.
व्याख्या (हिन्दी) डिज्क्स्ट्रा: गैर-नकारात्मक किनारे भार के साथ एकल-स्रोत सबसे छोटा पथ।
255
EN + हिं Medium
GB Kruskal's or Prim's algorithm finds?
IN क्रुस्कल या प्राइम का एल्गोरिदम ढूँढता है?
A
BFS tree बीएफएस पेड़
B
DFS tree डीएफएस पेड़
C
Minimum Spanning Tree न्यूनतम फैलाव वाला पेड़
D
Shortest path सबसे छोटा रास्ता
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Kruskal's and Prim's find the Minimum Spanning Tree (MST).
व्याख्या (हिन्दी) क्रुस्कल और प्राइम मिनिमम स्पैनिंग ट्री (एमएसटी) ढूंढते हैं।
241–255 of 1018