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

Question 421

EN + हिं Medium
GB Which C++ keyword marks a variable as thread-local storage?
IN कौन सा C++ कीवर्ड एक वेरिएबल को थ्रेड-लोकल स्टोरेज के रूप में चिह्नित करता है?
static स्थिर
thread_local थ्रेड_लोकल
thread धागा
local स्थानीय
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) thread_local int x; each thread has its own x.
व्याख्या (हिन्दी) थ्रेड_लोकल int x; प्रत्येक धागे का अपना x होता है।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल — difficulty level "Medium" उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 422

EN + हिं
GB The output of: constexpr int sq(int n){return n*n;} static_assert(sq(5)==25); cout<<"OK";
IN इसका आउटपुट: constexpr int sq(int n){return n*n;} static_assert(sq(5)==25); अदालत
Error गलती
OK ठीक है
25 25
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) constexpr sq is evaluated at compile time; static_assert passes.
व्याख्या (हिन्दी) संकलन समय पर constexpr sq का मूल्यांकन किया जाता है; static_assert पास हो जाता है।
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 423

EN + हिं Medium
GB static_assert in C++ checks:
IN C++ जाँच में static_assert:
Runtime assertion रनटाइम दावा
Compile-time assertion; program fails to compile if condition is false संकलन-समय का दावा; यदि स्थिति गलत है तो प्रोग्राम संकलित करने में विफल रहता है
Dynamic assertion गतिशील दावा
Memory assertion स्मृति दावा
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) static_assert(condition, "message") is a compile-time check.
व्याख्या (हिन्दी) static_assert(condition, "message") एक संकलन-समय जाँच है।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है — difficulty level "Medium"। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 424

EN + हिं
GB The output of: template void f(T&&x){cout<::value;} int a=5; f(a); f(5);
IN इसका आउटपुट: टेम्पलेट शून्य f(T&&x){cout
10 10
01 01
11 11
00 00
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(a): T deduced as int& (lvalue ref = 1); f(5): T deduced as int (rvalue = 0).
व्याख्या (हिन्दी) f(a): T को int& के रूप में निकाला गया (lvalue Ref = 1); f(5): T को int (rvalue = 0) के रूप में निकाला गया।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 425

EN + हिं
GB What is the output: int arr[3][3]={{1,2,3},{4,5,6},{7,8,9}}; cout<
IN आउटपुट क्या है: int arr[3][3]={{1,2,3},{4,5,6},{7,8,9}}; अदालत
5 5
6 6
7 7
8 8
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) arr[1][2]: row 1 (second row), col 2 (third col) = 6.
व्याख्या (हिन्दी) एआर[1][2]: पंक्ति 1 (दूसरी पंक्ति), कॉलम 2 (तीसरा कॉलम) = 6।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms ("Introduction to DSA" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 426

EN + हिं
GB The output of: int** p; int a[2][2]={{1,2},{3,4}}; p=new int*[2]; for(int i=0;i<2;i++) p[i]=a[i]; cout<
IN का आउटपुट: int** p; int a[2][2]={{1,2},{3,4}}; पी=नया पूर्णांक*[2]; for(int i=0;i
2 2
3 3
4 4
1 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p[1][0] = a[1][0] = 3.
व्याख्या (हिन्दी) पी[1][0] = ए[1][0] = 3.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 427

EN + हिं
GB The output of: char* s="Hello"; cout<
IN का आउटपुट: char* s='हैलो'; अदालत
5 5
6 6
4 4
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) strlen counts chars before null: H-e-l-l-o = 5.
व्याख्या (हिन्दी) स्ट्रेलेन शून्य से पहले वर्णों की गिनती करता है: एच-ई-एल-एल-ओ = 5।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 428

EN + हिं
GB The output of: char a[]="Hello"; char b[]="World"; strcat(a,b); cout<
IN का आउटपुट: char a[]='हैलो'; चार बी[]='विश्व'; स्ट्रैटकैट(ए,बी); अदालत
Hello नमस्ते
World दुनिया
HelloWorld हैलो वर्ल्ड
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) strcat appends b to a.
व्याख्या (हिन्दी) strcat b को a से जोड़ता है।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 429

EN + हिं
GB The output of: char a[]="Hello"; char b[]="Hello"; cout<
IN का आउटपुट: char a[]='हैलो'; चार बी[]='हैलो'; अदालत
1 1
-1 -1
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Identical strings; strcmp returns 0.
व्याख्या (हिन्दी) समान तार; strcmp 0 लौटाता है।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 430

EN + हिं
GB The output of: char a[]="Apple"; char b[]="Banana"; cout<<(strcmp(a,b)<0?"a=b");
IN का आउटपुट: char a[]='Apple'; चार बी[]='केला'; अदालत
a>=b ए>=बी
a<b
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A < B alphabetically; strcmp<0.
व्याख्या (हिन्दी) ए <बी वर्णानुक्रम में; strcmp
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 431

EN + हिं
GB The output of: char s[]="Hello World"; char* p=strtok(s," "); cout<
IN का आउटपुट: char s[]='हैलो वर्ल्ड'; char* p=strtok(s," "); अदालत
Hello World हैलो वर्ल्ड
Hello नमस्ते
World दुनिया
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) strtok splits on space; first token = "Hello".
व्याख्या (हिन्दी) स्ट्रोक अंतरिक्ष पर विभाजित होता है; पहला टोकन = "हैलो"।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms ("Introduction to DSA" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 432

EN + हिं Medium
GB memcpy vs memmove difference:
IN मेमसीपीवाई बनाम मेममूव अंतर:
Same function वही कार्य
memmove handles overlapping source/dest; memcpy does not मेमूव ओवरलैपिंग स्रोत/गंतव्य को संभालता है; memcpy नहीं करता है
memcpy is safer memcpy अधिक सुरक्षित है
memmove is undefined मेममूव अपरिभाषित है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) memmove is safe for overlapping regions.
व्याख्या (हिन्दी) ओवरलैपिंग क्षेत्रों के लिए मेमोव सुरक्षित है।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है — difficulty level "Medium"। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 433

EN + हिं
GB The output of: int arr[5]={1,2,3,4,5}; memset(arr,0,sizeof(arr)); cout<
IN इसका आउटपुट: int arr[5]={1,2,3,4,5}; मेमसेट(arr,0,sizeof(arr)); अदालत
3 3
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) memset fills all bytes with 0.
व्याख्या (हिन्दी) मेमसेट सभी बाइट्स को 0 से भरता है।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 434

EN + हिं
GB The output of: int a=1,b=2; memcpy(&a,&b,sizeof(int)); cout<
IN का आउटपुट: int a=1,b=2; memcpy(&a,&b,sizeof(int)); अदालत
1 1
2 2
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) memcpy copies b into a; a becomes 2.
व्याख्या (हिन्दी) memcpy b को a में कॉपी करता है; ए 2 हो जाता है.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 435

EN + हिं
GB What is the output: printf("%d %d %d",1,2,3);
IN आउटपुट क्या है: printf("%d %d %d",1,2,3);
1 2 3 1 2 3
123 123
1,2,3 1,2,3
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) printf with %d for each int.
व्याख्या (हिन्दी) प्रत्येक इंट के लिए %d के साथ प्रिंटफ।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।