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 781

EN + हिं
GB The output of: union U{int i; float f; }; U u; u.i=10; cout<
IN The output of: union U{int i; फ्लोट एफ; }; उ उ; यू.आई=10; अदालत
10 10
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Last written member i=10; reading u.i is valid.
व्याख्या (हिन्दी) अंतिम लिखित सदस्य i=10; u.i पढ़ना मान्य है.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 782

EN + हिं
GB The output of: enum Color{Red=1,Green=2,Blue=4}; cout<<(Red|Blue);
IN इसका आउटपुट: enum Color{Red=1,Green=2,Blue=4}; अदालत
5 5
3 3
6 6
1 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1|4=5 (bitwise OR of enum values).
व्याख्या (हिन्दी) 1|4=5 (बिटवाइज़ या एनम मानों का)।
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 783

EN + हिं
GB The output of: enum class Day{Mon=1,Tue,Wed}; cout<<(int)Day::Wed;
IN का आउटपुट: एनम क्लास दिन{सोम=1,मंगल,बुध}; अदालत
3 3
2 2
1 1
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Wed = 3 (Mon=1, Tue=2, Wed=3).
व्याख्या (हिन्दी) बुध = 3 (सोम=1, मंगल=2, बुध=3)।
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 784

EN + हिं
GB The output of: int x=5; auto f=[x]()mutable{return ++x;}; cout<
IN का आउटपुट: int x=5; ऑटो f=[x]()म्यूटेबल{रिटर्न++x;}; अदालत
675 675
67 5 67 5
565 565
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First call captures copy x=5, increments to 6; second call x=6, increments to 7; original x=5.
व्याख्या (हिन्दी) पहली कॉल कैप्चर कॉपी x=5, वेतन वृद्धि 6; दूसरी कॉल x=6, 7 तक वृद्धि; मूल x=5.
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 785

EN + हिं
GB The output of: auto v=vector{1,2,3,4,5}; auto sum=reduce(v.begin(),v.end()); cout<
IN का आउटपुट: ऑटो v=वेक्टर{1,2,3,4,5}; स्वत: योग=कम(v.begin(),v.end()); अदालत
15 15
10 10
5 5
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) reduce sums all: 1+2+3+4+5=15.
व्याख्या (हिन्दी) सभी योगों को कम करें: 1+2+3+4+5=15.
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 786

EN + हिं
GB The output of: vector v={1,2,3,4,5}; auto r=v|views::filter([](int x){return x>3;})| views::transform([](int x){return x*x;}); for(auto x:r)cout<
IN का आउटपुट: वेक्टर v={1,2,3,4,5}; ऑटो r=v|व्यूज़::फ़िल्टर([](int x){रिटर्न x>3;})| दृश्य::परिवर्तन([](int x){रिटर्न x*x;}); for(auto x:r)cout
16 25 16 25
4 5 4 5
9 16 25 9 16 25
1 4 9 1 4 9
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Filter x>3: {4,5}; transform x*x: {16,25}.
व्याख्या (हिन्दी) फ़िल्टर x>3: {4,5}; रूपांतर x*x: {16,25}।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 787

EN + हिं
GB The output of: using namespace std; auto gcd=[](int a,int b){while(b){a%=b; swap(a,b);} return a;}; cout<
IN इसका आउटपुट: नेमस्पेस एसटीडी का उपयोग करना; ऑटो gcd=[](int a,int b){जबकि(b){a%=b; स्वैप(ए,बी);} रिटर्न ए;}; अदालत
14 14
7 7
28 28
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) GCD(56,98)=14.
व्याख्या (हिन्दी) जीसीडी(56,98)=14.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 788

EN + हिं
GB The output of: int dp[6]={0}; dp[0]=1; for(int i=1;i<=5;i++) for(int j=i;j<=5;j++) dp[j]+=dp[j-i]; cout<
IN The output of: int dp[6]={0}; डीपी[0]=1; for(int i=1;i
5 5
7 7
10 10
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Coin change ways for 5 with coins {1,2,3,4,5}=7.
व्याख्या (हिन्दी) सिक्कों के साथ 5 के लिए सिक्के बदलने के तरीके {1,2,3,4,5}=7।
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 789

EN + हिं
GB The output of: string s="Hello World"; cout<
IN इसका आउटपुट: स्ट्रिंग s='हैलो वर्ल्ड'; अदालत
5 5
6 6
4 4
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) find(" ")=5; size=11; 11-5-1=5 (length of "World").
व्याख्या (हिन्दी) ढूंढें(" ")=5; आकार=11; 11-5-1=5 ("विश्व" की लंबाई)।
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 790

EN + हिं
GB The output of: vector v={1,2,3,4,5}; int prod=1; for_each(v.begin(),v.end(),[&](int x){prod*=x;}); cout<
IN का आउटपुट: वेक्टर v={1,2,3,4,5}; पूर्णांक उत्पाद=1; for_each(v.begin(),v.end(),[&](int x){prod*=x;}); अदालत
15 15
120 120
5 5
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Product: 1*2*3*4*5=120.
व्याख्या (हिन्दी) उत्पाद: 1*2*3*4*5=120।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 791

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

Question 792

EN + हिं
GB The output of: int x=0b10110; cout<<__builtin_popcount(x);
IN इसका आउटपुट: int x=0b10110; अदालत
3 3
4 4
5 5
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10110 has 3 set bits.
व्याख्या (हिन्दी) 10110 में 3 सेट बिट हैं।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 793

EN + हिं Hard
GB What is the time complexity to find if a number is prime (trial division)?
IN यह पता लगाने में समय की जटिलता क्या है कि कोई संख्या अभाज्य है (परीक्षण प्रभाग)?
O(1) हे(1)
O(sqrt(n)) ओ(वर्ग(एन))
O(n) पर)
O(log n) ओ(लॉग एन)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Check divisors up to sqrt(n).
व्याख्या (हिन्दी) sqrt(n) तक के विभाजक की जाँच करें।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल — difficulty level "Hard" उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 794

EN + हिं Medium
GB Sieve of Eratosthenes finds all primes up to n in:
IN एराटोस्थनीज़ की छलनी में n तक के सभी अभाज्य गुण पाए जाते हैं:
O(n) पर)
O(n log log n) ओ(एन लॉग लॉग एन)
O(n^2) ओ(एन^2)
O(sqrt(n)) ओ(वर्ग(एन))
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sieve: O(n log log n) time, O(n) space.
व्याख्या (हिन्दी) चलनी: O(n लॉग लॉग n) समय, O(n) स्थान।
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं — difficulty level "Medium"। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 795

EN + हिं
GB The output of: int n=36; cout<<(int)sqrt(n)*(int)sqrt(n)==n?"Perfect Square":"Not";
IN का आउटपुट: int n=36; अदालत
Perfect Square उत्तम वर्ग
Not नहीं
Error गलती
36 36
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sqrt(36)=6; 6*6=36; perfect square.
व्याख्या (हिन्दी) sqrt(36)=6; 6*6=36; पूर्ण वर्ग.
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।