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

Question 391

EN + हिं Medium
GB Which is correct for checking if number is even without %?
IN यह जांचने के लिए कौन सा सही है कि संख्या % के बिना भी है या नहीं?
n%2==0 n%2==0
(n&1)==0 (bitwise AND with 1 checks last bit) (n&1)==0 (बिटवाइज और अंतिम बिट 1 चेक के साथ)
n/2*2==n एन/2*2==एन
All equivalent सभी समकक्ष
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All three methods check for even number.
व्याख्या (हिन्दी) तीनों विधियाँ सम संख्या की जाँच करती हैं।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल — difficulty level "Medium" उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 392

EN + हिं
GB The output of: int a=3,b=3; cout<<(a==b && !(a^b));
IN का आउटपुट: int a=3,b=3; अदालत
1 1
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3==3 true AND !(3^3)=!(0)=true; both true = 1.
व्याख्या (हिन्दी) 3==3 सत्य और !(3^3)=!(0)=सत्य; दोनों सत्य = 1.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 393

EN + हिं Medium
GB To multiply by 4 using bit shift:
IN बिट शिफ्ट का उपयोग करके 4 से गुणा करने के लिए:
n*4 एन*4
n<<2 (left shift by 2 = multiply by 2^2=4) एन
n>>2 n>>2
n^4 एन^4
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n<<2 is equivalent to n*4.
व्याख्या (हिन्दी) एन
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है — difficulty level "Medium"। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 394

EN + हिं Medium
GB To divide by 8 using bit shift:
IN बिट शिफ्ट का उपयोग करके 8 से विभाजित करने के लिए:
n/8 एन/8
n>>3 (right shift by 3 = divide by 2^3=8) n>>3 (3 से दायां बदलाव = 2^3=8 से भाग दें)
n<<3 एन
n&8 एन&8
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n>>3 is equivalent to n/8 for positive n.
व्याख्या (हिन्दी) n>>3 सकारात्मक n के लिए n/8 के बराबर है।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को — difficulty level "Medium" कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 395

EN + हिं
GB The output of: int x=100; cout<<(x/10)<<(x%10);
IN का आउटपुट: int x=100; अदालत
100 100
10 0 10 0
100 100
1 0 0 1 0 0
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x/10=10, x%10=0; cout<<10<<0 = 100.
व्याख्या (हिन्दी) x/10=10, x%10=0; अदालत
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 396

EN + हिं
GB The output of: string s=""; for(int i=65;i<70;i++) s+=(char)i; cout<
IN इसका आउटपुट: स्ट्रिंग s=''; for(int i=65;i
ABCDE एबीसीडीई
abcde एबीसीडीई
12345 12345
EFGHI ईएफजीएचआई
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ASCII 65-69 = A,B,C,D,E.
व्याख्या (हिन्दी) एएससीआईआई 65-69 = ए, बी, सी, डी, ई।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 397

EN + हिं
GB Which OOP concept is violated when a class has public data members?
IN जब किसी वर्ग में सार्वजनिक डेटा सदस्य होते हैं तो किस OOP अवधारणा का उल्लंघन होता है?
Polymorphism बहुरूपता
Encapsulation (data hiding) एनकैप्सुलेशन (डेटा छिपाना)
Inheritance विरासत
Abstraction मतिहीनता
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Public data breaks encapsulation; should be private with accessors.
व्याख्या (हिन्दी) सार्वजनिक डेटा एनकैप्सुलेशन तोड़ता है; एक्सेसर्स के साथ निजी होना चाहिए।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 398

EN + हिं Easy
GB What is cohesion in software design?
IN सॉफ़्टवेयर डिज़ाइन में सामंजस्य क्या है?
How modules are related मॉड्यूल कैसे संबंधित हैं
Degree to which a class/module has a single, focused purpose वह डिग्री जिस तक कक्षा/मॉड्यूल का एक ही, केंद्रित उद्देश्य होता है
Coupling between modules मॉड्यूल के बीच युग्मन
Number of methods विधियों की संख्या
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) High cohesion: class does one thing well.
व्याख्या (हिन्दी) उच्च सामंजस्य: वर्ग एक काम अच्छी तरह से करता है।
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं — difficulty level "Easy"। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 399

EN + हिं Easy
GB What is coupling in software design?
IN सॉफ़्टवेयर डिज़ाइन में कपलिंग क्या है?
Internal module focus आंतरिक मॉड्यूल फोकस
Degree of interdependence between modules (lower is better) मॉड्यूल के बीच परस्पर निर्भरता की डिग्री (कम बेहतर है)
Number of classes कक्षाओं की संख्या
Code complexity कोड जटिलता
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Low coupling: modules independent, easier to change.
व्याख्या (हिन्दी) कम युग्मन: मॉड्यूल स्वतंत्र, बदलने में आसान।
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है — difficulty level "Easy"। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 400

EN + हिं Medium
GB High cohesion and low coupling is:
IN उच्च सामंजस्य और निम्न युग्मन है:
Bad design ख़राब डिज़ाइन
Good design (focused modules, minimal interdependence) अच्छा डिज़ाइन (केंद्रित मॉड्यूल, न्यूनतम परस्पर निर्भरता)
Only for OOP केवल OOP के लिए
Only for large systems केवल बड़े सिस्टम के लिए
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) High cohesion + low coupling = maintainable, modular design.
व्याख्या (हिन्दी) उच्च सामंजस्य + कम युग्मन = रखरखाव योग्य, मॉड्यूलर डिज़ाइन।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को — difficulty level "Medium" कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 401

EN + हिं
GB A God class (class that does everything) violates:
IN एक ईश्वर वर्ग (वह वर्ग जो सब कुछ करता है) उल्लंघन करता है:
Open/Closed Principle खुला/बंद सिद्धांत
Single Responsibility Principle एकल उत्तरदायित्व सिद्धांत
Liskov Substitution लिस्कोव प्रतिस्थापन
Interface Segregation इंटरफ़ेस पृथक्करण
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) God class has too many responsibilities - SRP violation.
व्याख्या (हिन्दी) ईश्वर वर्ग की बहुत अधिक जिम्मेदारियाँ हैं - एसआरपी उल्लंघन।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 402

EN + हिं Easy
GB What is composition over inheritance principle?
IN वंशानुक्रम सिद्धांत पर संरचना क्या है?
Always use inheritance हमेशा इनहेरिटेंस का उपयोग करें
Prefer building objects from components rather than inheriting विरासत में मिलने के बजाय घटकों से वस्तुओं का निर्माण करना पसंद करें
Never use inheritance विरासत का उपयोग कभी न करें
Only use templates केवल टेम्प्लेट का उपयोग करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Composition is more flexible and avoids inheritance coupling.
व्याख्या (हिन्दी) संरचना अधिक लचीली है और वंशानुक्रम युग्मन से बचती है।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है — difficulty level "Easy"। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 403

EN + हिं Medium
GB Law of Demeter (Principle of Least Knowledge) says:
IN डेमेटर का नियम (न्यूनतम ज्ञान का सिद्धांत) कहता है:
Talk to everyone सबसे बात करो
Object should only talk to immediate friends (not friends of friends) वस्तु को केवल निकटतम मित्रों से बात करनी चाहिए (दोस्तों के मित्रों से नहीं)
Share all data सभी डेटा साझा करें
Use global variables वैश्विक चर का प्रयोग करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) obj.getA().getB().doC() violates LoD.
व्याख्या (हिन्दी) obj.getA().getB().doC() LoD का उल्लंघन करता है।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल — difficulty level "Medium" उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 404

EN + हिं Medium
GB Which is an anti-pattern?
IN कौन सा एक विरोधी पैटर्न है?
Design pattern डिज़ाइन पैटर्न
Singleton overuse, God class, Copy-paste programming सिंगलटन अति प्रयोग, गॉड क्लास, कॉपी-पेस्ट प्रोग्रामिंग
Inheritance विरासत
Encapsulation कैप्सूलीकरण
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Anti-patterns are commonly used but counterproductive solutions.
व्याख्या (हिन्दी) आमतौर पर विरोधी पैटर्न का उपयोग किया जाता है लेकिन प्रतिउत्पादक समाधान।
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं — difficulty level "Medium"। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 405

EN + हिं
GB The output of: class C{int x; public: C():x(0){} C(int x):x(x){} void print(){cout<
IN का आउटपुट: वर्ग C{int x; सार्वजनिक: C():x(0){} C(int x):x(x){} void print(){cout
05 05
50 50
00 00
55 55
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) c1 uses default ctor (x=0); c2 uses parameterized (x=5).
व्याख्या (हिन्दी) c1 डिफ़ॉल्ट ctor (x=0) का उपयोग करता है; c2 पैरामीटरयुक्त (x=5) का उपयोग करता है।
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।