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 436

EN + हिं
GB What is the output: scanf("%d",&n) with input 42; printf("%d",n);
IN आउटपुट क्या है: scanf("%d",&n) इनपुट 42 के साथ; प्रिंटफ ("%d",n);
42 42
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) scanf reads 42; printf outputs 42.
व्याख्या (हिन्दी) स्कैनफ़ 42 पढ़ता है; प्रिंटफ आउटपुट 42.
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 437

EN + हिं Easy
GB What does perror("msg") do in C++?
IN पेरर ("msg") C++ में क्या करता है?
Print msg only केवल संदेश प्रिंट करें
Print msg + colon + system error message for errno त्रुटि के लिए संदेश + कोलन + सिस्टम त्रुटि संदेश प्रिंट करें
Set errno ग़लती से सेट करें
Clear error त्रुटि साफ़ करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) perror outputs description of last system error.
व्याख्या (हिन्दी) पेरर अंतिम सिस्टम त्रुटि का विवरण आउटपुट करता है।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms ("Introduction to DSA" sub-topic) category का है — difficulty level "Easy", और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 438

EN + हिं
GB The output of: FILE* f=tmpfile(); fprintf(f,"test"); rewind(f); char buf[10]; fscanf(f,"%s",buf); cout<
IN इसका आउटपुट: FILE* f=tmpfile(); fprintf(f,"परीक्षण"); रिवाइंड(एफ); चार बफ़[10]; fscanf(f,"%s",buf); अदालत
test परीक्षा
Error गलती
empty खाली
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Write test to temp file, rewind, read back test.
व्याख्या (हिन्दी) अस्थायी फ़ाइल में परीक्षण लिखें, रिवाइंड करें, वापस परीक्षण पढ़ें।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 439

EN + हिं
GB What is the output: jmp_buf jb; if(!setjmp(jb)){cout<<"A"; longjmp(jb,1);} cout<<"B";
IN आउटपुट क्या है: jmp_buf jb; if(!setjmp(jb)){cout
AB अब
A
B बी
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) setjmp saves point; prints A; longjmp jumps back; now setjmp returns 1 (truthy); else: print B.
व्याख्या (हिन्दी) setjmp बिंदु बचाता है; ए प्रिंट करता है; लॉन्गजम्प वापस कूदता है; अब setjmp रिटर्न 1 (सत्य); अन्य: बी प्रिंट करें।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 440

EN + हिं Medium
GB longjmp in C++ is:
IN C++ में longjmp है:
Safer than exception अपवाद से अधिक सुरक्षित
Dangerous - does not call destructors (use C++ exceptions instead) खतरनाक - विध्वंसकों को कॉल नहीं करता (इसके बजाय C++ अपवादों का उपयोग करें)
Same as throw फेंकने के समान
Same as return वापसी के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) longjmp skips destructors; use throw/catch in C++.
व्याख्या (हिन्दी) longjmp विध्वंसकों को छोड़ देता है; C++ में थ्रो/कैच का उपयोग करें।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं — difficulty level "Medium"। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 441

EN + हिं
GB The output of: int x=5; auto l=coroutine_not_shown; cout<
IN का आउटपुट: int x=5; ऑटो l=coroutine_not_show; अदालत
Error गलती
5 5
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Without coroutine context, normal code prints 5.
व्याख्या (हिन्दी) कॉरआउटिन संदर्भ के बिना, सामान्य कोड प्रिंट होता है 5।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 442

EN + हिं Medium
GB Which C++20 concept checks if type T has operator<< for ostream?
IN कौन सा C++20 कॉन्सेप्ट यह जाँचता है कि टाइप T में ऑपरेटर है या नहीं
std::printable एसटीडी::मुद्रण योग्य
Must define custom concept or use std::formattable कस्टम अवधारणा को परिभाषित करना चाहिए या std::formattable का उपयोग करना चाहिए
std::streamable std::स्ट्रीमयोग्य
std::insertable std::डालने योग्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) No standard concept for streamable; use requires or custom concept.
व्याख्या (हिन्दी) स्ट्रीम करने योग्य के लिए कोई मानक अवधारणा नहीं; उपयोग की आवश्यकता या कस्टम अवधारणा।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को — difficulty level "Medium" कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 443

EN + हिं
GB The output of: for(int i=2;i<=20;i+=2) cout<
IN का आउटपुट: for(int i=2;i
10 10
11 11
9 9
20 20
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Even numbers 2,4,...,20: 10 numbers.
व्याख्या (हिन्दी) सम संख्याएँ 2,4,...,20: 10 संख्याएँ।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms ("Introduction to DSA" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 444

EN + हिं
GB The output of: int n=1000; for(;n>1;n/=10) cout<
IN इसका आउटपुट: int n=1000; for(;n>1;n/=10) cout
0 0 1 0 0 1
001 001
001 001
1 0 0 1 1 0 0 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n=1000: 0; n=100: 0; n=10: 0; n=1: print 1. Outputs 001.
व्याख्या (हिन्दी) n=1000: 0; n=100: 0; n=10: 0; n=1: प्रिंट 1. आउटपुट 001.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 445

EN + हिं
GB What is the output: int arr[]={10,20,30}; for(int &x:arr) x*=2; cout<
IN आउटपुट क्या है: int arr[]={10,20,30}; for(int &x:arr) x*=2; अदालत
20 20
40 40
30 30
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Range-based for with reference doubles each; arr[1]=20*2=40.
व्याख्या (हिन्दी) संदर्भ के साथ रेंज-आधारित प्रत्येक को दोगुना कर देता है; गिरफ्तार[1]=20*2=40.
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 446

EN + हिं
GB The output of: string words[]={"hello","world","foo"}; sort(words,words+3); cout<
IN इसका आउटपुट: स्ट्रिंग शब्द[]={"हैलो","दुनिया","फू"}; सॉर्ट करें (शब्द, शब्द+3); अदालत
foo फू
hello नमस्ते
world दुनिया
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Alphabetical sort: foo < hello < world.
व्याख्या (हिन्दी) वर्णमाला क्रम: फू <हैलो <दुनिया।
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 447

EN + हिं
GB The output of: vector v={"c","a","b"}; sort(v.begin(),v.end()); cout<
IN का आउटपुट: वेक्टर v={"c","a","b"}; क्रमबद्ध करें (v.begin(),v.end()); अदालत
ac ए.सी
ab अब
ca सीए
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: a,b,c; v[0]=a, v[2]=c.
व्याख्या (हिन्दी) क्रमबद्ध: ए, बी, सी; वी[0]=ए, वी[2]=सी.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 448

EN + हिं
GB What is the output: auto it=max_element(begin("abcZ"),end("abcZ")-1); cout<<*it;
IN आउटपुट क्या है: auto it=max_element(begin("abcZ"),end("abcZ")-1); अदालत
c सी
Z जेड
a
b बी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ASCII: a=97,b=98,c=99,Z=90; max is c(99).
व्याख्या (हिन्दी) ASCII: a=97,b=98,c=99,Z=90; अधिकतम c(99) है।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 449

EN + हिं
GB The output of: int n=7; int sum=0; for(int i=2;i<=n/2;i++) if(n%i==0){sum=1; break;} cout<<(sum?"Composite":"Prime");
IN का आउटपुट: int n=7; पूर्णांक योग=0; for(int i=2;i
Composite कम्पोजिट
Prime मुख्य
7 7
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7 has no divisors in 2..3; sum stays 0; Prime.
व्याख्या (हिन्दी) 2..3 में 7 का कोई भाजक नहीं है; योग 0 रहता है; मुख्य।
🎯 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 450

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