OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 1915 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
1915 questions
1441
EN + हिं
GB What is the output: template T clamp2(T v,T lo,T hi){return max(lo,min(v,hi));} cout<
IN आउटपुट क्या है: टेम्पलेट टी क्लैंप2(टी वी,टी लो,टी हाय){रिटर्न मैक्स(लो,मिन(वी,हाय));} कॉउट
A
100 100
B
15 0 15 0
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) clamp2(15,1,10)=10; clamp2(-5,0,5)=0. Output: 100.
व्याख्या (हिन्दी) क्लैंप2(15,1,10)=10; क्लैंप2(-5,0,5)=0. आउटपुट: 100.
1442
EN + हिं
GB What is the output: template void printN(){cout<1) printN();} printN<5>();
IN आउटपुट क्या है: टेम्पलेट void printN(){cout
A
5 4 3 2 1 5 4 3 2 1
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
1 2 3 4 5 1 2 3 4 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Prints 5,4,3,2,1. Output: 5 4 3 2 1.
व्याख्या (हिन्दी) 5,4,3,2,1 प्रिंट करता है। आउटपुट: 5 4 3 2 1.
1443
EN + हिं
GB What is the output: template auto makeRange(T start,T end,T step){vectorv;for(T i=start;i
IN आउटपुट क्या है: टेम्पलेट ऑटो मेकरेंज (टी स्टार्ट, टी एंड, टी स्टेप) {वेक्टरव; फॉर (टी आई = स्टार्ट; आई)
A
49 49
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
4 9 4 9
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0,3,6,9: 4 elements. back=9. Output: 49.
व्याख्या (हिन्दी) 0,3,6,9: 4 तत्व। वापस=9. आउटपुट: 49.
1444
EN + हिं
GB What is the output: template bool isPalindrome(vectorv){return equal(v.begin(),v.begin()+v.size()/2,v.rbegin());} cout<({1,2,3,2,1})<({1,2,3});
IN आउटपुट क्या है: टेम्पलेट बूल isPalindrome(vectorv){returnqual(v.begin(),v.begin()+v.size()/2,v.rbegin());} cout
A
10 10
B
11 11
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First is palindrome=1; second not=0. Output: 10.
व्याख्या (हिन्दी) पहला है पैलिन्ड्रोम=1; दूसरा नहीं=0. आउटपुट: 10.
1445
EN + हिं
GB What is the output: template T fromBinary(string s){T n=0;for(char c:s) n=n*2+(c-'0');return n;} cout<("1010");
IN आउटपुट क्या है: टेम्प्लेट T fromBinary(string s){T n=0;for(char c:s) n=n*2+(c-'0');return n;} cout
A
10 10
B
4 4
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1010 binary=10. Output: 10.
व्याख्या (हिन्दी) 1010 बाइनरी=10. आउटपुट: 10.
1446
EN + हिं
GB What is the output: template class Bimap{mapfwd;mapbwd; public:void insert(K k,V v){fwd[k]=v;bwd[v]=k;} V get(K k){return fwd[k];} K rget(V v){return bwd[v];}}; Bimapm; m.insert(1,"one"); cout<
IN आउटपुट क्या है: टेम्पलेट क्लास Bimap{mapfwd;mapbwd; सार्वजनिक: शून्य सम्मिलित करें (के के, वी वी) {एफडब्ल्यूडी [के] = वी; बीडब्ल्यूडी [वी] = के;} वी प्राप्त करें (के के) {रिटर्न एफडब्ल्यूडी [के];} के आरगेट (वी वी) {रिटर्न बीडब्ल्यूडी [वी];}}; बिमापम; m.insert(1,'एक'); अदालत
A
one1 one1
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
1one 1एक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) get(1)=one; rget(one)=1. Output: one1.
व्याख्या (हिन्दी) प्राप्त करें(1)=एक; rget(एक)=1. आउटपुट: one1.
1447
EN + हिं
GB What is the output: template struct NTuple{arrayd; NTuple(initializer_listil){copy(il.begin(),il.begin()+N,d.begin());} T& get(size_t i){return d[i];}}; NTuple<3,int>t={1,2,3}; cout<
IN आउटपुट क्या है: टेम्पलेट struct Ntuple{arrayd; NTuple(initializer_listil){copy(il.begin(),il.begin()+N,d.begin());} T& get(size_t i){return d[i];}}; NTuplet={1,2,3}; अदालत
A
4 4
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+3=4. Output: 4.
व्याख्या (हिन्दी) 1+3=4. आउटपुट: 4.
1448
EN + हिं
GB What is the output: int x=5; cout<<(x<<1)-(x>>1);
IN आउटपुट क्या है: int x=5; अदालत
A
8 8
B
3 3
C
12 12
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10-2=8. Output: 8.
व्याख्या (हिन्दी) 10-2=8. आउटपुट: 8.
1449
EN + हिं
GB What is the output: auto x=5; auto y=2; cout<<(x/y)<<(x%y);
IN आउटपुट क्या है: ऑटो x=5; ऑटो y=2; अदालत
A
21 21
B
25 25
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5/2=2, 5%2=1. Output: 21.
व्याख्या (हिन्दी) 5/2=2, 5%2=1. आउटपुट: 21.
1450
EN + हिं
GB What is the output: constexpr int arr[]={1,2,3,4,5}; constexpr int s=arr[0]+arr[4]; cout<
IN आउटपुट क्या है: constexpr int arr[]={1,2,3,4,5}; constexpr int s=arr[0]+arr[4]; अदालत
A
6 6
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+5=6. Output: 6.
व्याख्या (हिन्दी) 1+5=6. आउटपुट: 6.
1451
EN + हिं
GB What is the output: int x=0b1010; int y=0b0101; cout<<(x+y);
IN आउटपुट क्या है: int x=0b1010; int y=0b0101; अदालत
A
15 15
B
10 10
C
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10+5=15. Output: 15.
व्याख्या (हिन्दी) 10+5=15. आउटपुट: 15.
1452
EN + हिं
GB What is the output: string s="hello"; cout<
IN आउटपुट क्या है: स्ट्रिंग s='हैलो'; अदालत
A
5ho 5हो
B
5he 5वह
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) length=5, s[0]='h', back='o'. Output: 5ho.
व्याख्या (हिन्दी) लंबाई=5, s[0]='h', पीछे='o'। आउटपुट: 5ho.
1453
EN + हिं
GB What is 'std::string::npos'?
IN 'std::string::npos' क्या है?
A
Maximum value of size_t; returned when search fails size_t का अधिकतम मान; खोज विफल होने पर वापस आ गया
B
A null pointer एक शून्य सूचक
C
Zero index शून्य सूचकांक
D
End iterator पुनरावर्तक समाप्त करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) npos = string::size_type(-1); find() returns it when pattern not found.
व्याख्या (हिन्दी) npos = स्ट्रिंग::आकार_प्रकार(-1); पैटर्न नहीं मिलने पर ढूंढें() इसे वापस कर देता है।
1454
EN + हिं
GB What is the output: string s="hello world"; cout<
IN आउटपुट क्या है: स्ट्रिंग s='हैलो वर्ल्ड'; अदालत
A
6 6
B
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 'world' starts at index 6. Output: 6.
व्याख्या (हिन्दी) 'दुनिया' सूचकांक 6 से शुरू होती है। आउटपुट: 6।
1455
EN + हिं
GB What is the output: string s="abcde"; s.erase(1,3); cout<
IN आउटपुट क्या है: स्ट्रिंग s='abcde'; s.मिटाना(1,3); अदालत
A
ae
B
bcde बीसीडीई
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Remove b,c,d leaving a,e. Output: ae.
व्याख्या (हिन्दी) ए,ई छोड़कर बी,सी,डी हटाएं। आउटपुट: एई.
1441–1455 of 1915