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
751
EN + हिं
GB The output of: cout<2)<<" "<<(2>3);
IN का आउटपुट: कॉउट
A
1 0 1 0
B
true false सच्चा झूठ
C
True False सच्चा झूठ
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) boolalpha mode: true/false words.
व्याख्या (हिन्दी) बूलल्फा मोड: सही/गलत शब्द।
752
EN + हिं
GB What is the output: int x=42; cout<
IN आउटपुट क्या है: int x=42; अदालत
A
2a 42 2ए 42
B
42 2a 42 2ए
C
0x2a 42 0x2a 42
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 42 in hex = 2a; then back to decimal = 42.
व्याख्या (हिन्दी) हेक्स में 42 = 2ए; फिर दशमलव पर वापस = 42.
753
EN + हिं
GB The output of: int a[]={1,2,3,4,5}; cout<
IN इसका आउटपुट: int a[]={1,2,3,4,5}; अदालत
A
5 5
B
4 4
C
20 20
D
1 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 20 bytes total / 4 bytes per int = 5 elements.
व्याख्या (हिन्दी) कुल 20 बाइट्स / 4 बाइट्स प्रति इंट = 5 तत्व।
754
EN + हिं
GB The output of: vector v={3,1,4,1,5,9}; sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); cout<
IN का आउटपुट: वेक्टर v={3,1,4,1,5,9}; क्रमबद्ध करें (v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); अदालत
A
5 5
B
6 6
C
4 4
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After removing duplicate 1: {1,3,4,5,9} = 5 elements.
व्याख्या (हिन्दी) डुप्लिकेट 1 को हटाने के बाद: {1,3,4,5,9} = 5 तत्व।
755
EN + हिं
GB What is the output: map m={{1,10},{2,20},{3,30}}; for(auto [k,v]:m) cout<
IN आउटपुट क्या है: मानचित्र m={{1,10},{2,20},{3,30}}; for(ऑटो [k,v]:m) कॉउट
A
102030 102030
B
112233 112233
C
101020203030 101020203030
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Structured binding: key value pairs 1 10 2 20 3 30.
व्याख्या (हिन्दी) संरचित बाइंडिंग: कुंजी मान जोड़े 1 10 2 20 3 30।
756
EN + हिं
GB The output of: auto v=vector(5); iota(v.begin(),v.end(),1); cout<
IN का आउटपुट: ऑटो v=वेक्टर(5); iota(v.begin(),v.end(),1); अदालत
A
3 3
B
4 4
C
1 1
D
5 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) iota(begin,end,1) fills {1,2,3,4,5}; v[3]=4.
व्याख्या (हिन्दी) iota(शुरू, अंत,1) {1,2,3,4,5} भरता है; वी[3]=4.
757
EN + हिं
GB The output of: int n=10; int sum=accumulate(begin({1,2,3,4,5,6,7,8,9,10}),end({1,2,3,4,5,6,7,8,9,10}),0); cout<
IN का आउटपुट: int n=10; पूर्णांक योग=संचय(शुरू({1,2,3,4,5,6,7,8,9,10}),अंत({1,2,3,4,5,6,7,8,9,10}),0); अदालत
A
50 50
B
55 55
C
45 45
D
100 100
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sum 1 to 10 = 55.
व्याख्या (हिन्दी) 1 से 10 का योग = 55.
758
EN + हिं
GB The output of: string s="Race Car"; remove_if(s.begin(),s.end(),::isspace); cout<
IN इसका आउटपुट: स्ट्रिंग s='रेस कार'; delete_if(s.begin(),s.end(),::isspace); अदालत
A
Race Car रेस कार
B
RaceCar रेसकार
C
raceCar रेसकार
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) remove_if does not actually erase; only rearranges.
व्याख्या (हिन्दी) delete_if वास्तव में मिटाता नहीं है; केवल पुनर्व्यवस्थित करता है।
759
EN + हिं
GB The output of: auto s=set{5,3,1,4,2}; cout<
IN का आउटपुट: auto s=set{5,3,1,4,2}; अदालत
A
5 5
B
3 3
C
1 1
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Set has 5 unique elements; distance = 5.
व्याख्या (हिन्दी) सेट में 5 अद्वितीय तत्व हैं; दूरी = 5.
760
EN + हिं
GB The output of: int x=7; cout<<(x%2==0?"Even":"Odd")<<" "<<(x>0?"Pos":"NonPos");
IN का आउटपुट: int x=7; अदालत
A
Even Pos यहां तक ​​कि पॉज़
B
Odd Pos अजीब स्थिति
C
Even NonPos यहां तक ​​कि नॉनपोस भी
D
Odd NonPos अजीब नॉनपोज़
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7 is odd and positive.
व्याख्या (हिन्दी) 7 विषम और सकारात्मक है.
761
EN + हिं
GB What is the output: int x=0; do {x++; if(x==3) break;} while(x<10); cout<
IN आउटपुट क्या है: int x=0; करो {x++; if(x==3) breaking;} while(x
A
3 3
B
10 10
C
4 4
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Loop increments to 3, then breaks.
व्याख्या (हिन्दी) लूप 3 तक बढ़ता है, फिर टूट जाता है।
762
EN + हिं
GB The output of: int a=2; switch(a){case 1: case 2: cout<<"1or2"; break; case 3: cout<<"3";}
IN का आउटपुट: int a=2; स्विच(ए){केस 1: केस 2: कॉउट
A
1or2 1 ओर 2
B
2 2
C
3 3
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) case 2 falls through from case 1 label; matches case 2, outputs 1or2.
व्याख्या (हिन्दी) केस 2, केस 1 लेबल से गिरता है; केस 2 से मेल खाता है, आउटपुट 1or2।
763
EN + हिं
GB The output of: int x=5; if(x>0) if(x>3) cout<<"A"; else cout<<"B"; else cout<<"C";
IN का आउटपुट: int x=5; if(x>0) if(x>3) cout
A
A
B
B बी
C
C सी
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=5>0 and 5>3; outputs A.
व्याख्या (हिन्दी) x=5>0 और 5>3; आउटपुट ए.
764
EN + हिं
GB The output of: int x=1; if(x>0) if(x>3) cout<<"A"; else cout<<"B"; else cout<<"C";
IN का आउटपुट: int x=1; if(x>0) if(x>3) cout
A
A
B
B बी
C
C सी
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=1>0 but 1 not >3; else (inner) outputs B.
व्याख्या (हिन्दी) x=1>0 लेकिन 1 नहीं >3; अन्यथा (आंतरिक) आउटपुट बी।
765
EN + हिं
GB The output of: int x=-1; if(x>0) if(x>3) cout<<"A"; else cout<<"B"; else cout<<"C";
IN का आउटपुट: int x=-1; if(x>0) if(x>3) cout
A
A
B
B बी
C
C सी
D
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=-1, not >0; outer else outputs C.
व्याख्या (हिन्दी) x=-1, नहीं >0; बाहरी अन्य आउटपुट C.
751–765 of 1018