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
1246
EN + हिं
GB 'What is the output: int n=5,f=1; for(int i=n;i>1;i (1, 6, 74, 4, 4, 'What is the output: for(int i=1;i<=5;i++) if(i==3) continue; else cout<
IN 'आउटपुट क्या है: int n=5,f=1; for(int i=n;i>1;i (1, 6, 74, 4, 4, 'आउटपुट क्या है: for(int i=1;i
A
i=4:4. Sum=1+2+4=7. Output: 7.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'What is the output: int f(int n){return n<=0?0:n+f(n-2);} cout<<f(5)+f(6);', 'f(5)=5+3+1=9 मैं=4:4. योग=1+2+4=7. आउटपुट: 7.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'आउटपुट क्या है: int f(int n){return n
B
f(6)=12. 9+12=21. Output: 21.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'What is the output: auto f=[](int x)->int{return x>1?x*f(x-1):1;}; cout<<f(4);', 'Recursive lambda (C++14 way without self)?', 'Compile error', 'Compile error', '24', '24', '4', '4', 'Undefined', 'Undefined', NULL, 'option_a', 'Lambda can\'t call itself by name (f is not captured). Compile error.' एफ(6)=12. 9+12=21. आउटपुट: 21.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'आउटपुट क्या है: auto f=[](int x)->int{return x>1?x*f(x-1):1;}; cout
C
2026-05-25 2026-05-25
✅ Correct Answer:
1247
EN + हिं
GB What is the output: for(int i=1;i<=5;i++) if(i==3) continue; else cout<
IN आउटपुट क्या है: for(int i=1;i
A
1245 1245
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=3: continue (skip else). Others: print. Output: 1245.
व्याख्या (हिन्दी) i=3: जारी रखें (अन्यथा छोड़ें)। Others: print. Output: 1245.
1248
EN + हिं
GB What is the output: int x=1; for(int i=0;i<5;i++) x*=(i+1); cout<
IN आउटपुट क्या है: int x=1; for(int i=0;i
A
120 120
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5!=120. Output: 120.
व्याख्या (हिन्दी) 5!=120. आउटपुट: 120.
1249
EN + हिं
GB What is the output: int x=0; for(int i=0;i<5;i++) if(i%3) x+=i; cout<
IN आउटपुट क्या है: int x=0; for(int i=0;i
A
1 2 4 1 2 4
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=1:1,i=2:2,i=4:4. Sum=1+2+4=7. Output: 7.
व्याख्या (हिन्दी) मैं=1:1,मैं=2:2,मैं=4:4. योग=1+2+4=7. आउटपुट: 7.
1250
EN + हिं
GB What is the output: int f(int n){return n<=0?0:n+f(n-2);} cout<
IN आउटपुट क्या है: int f(int n){return n
A
21 21
B
9 9
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(5)=9,f(6)=12. 9+12=21. Output: 21.
व्याख्या (हिन्दी) f(5)=9,f(6)=12. 9+12=21. आउटपुट: 21.
1251
EN + हिं
GB What is the output: auto f=[](int x)->int{return x>1?x*f(x-1):1;}; cout<
IN आउटपुट क्या है: auto f=[](int x)->int{return x>1?x*f(x-1):1;}; अदालत
A
Compile error संकलन त्रुटि
B
24 24
C
4 4
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Lambda can't call itself by name (f is not captured). Compile error.
व्याख्या (हिन्दी) लैम्ब्डा खुद को नाम से नहीं बुला सकता (एफ कैप्चर नहीं किया गया है)। संकलन त्रुटि.
1252
EN + हिं
GB What is 'std::function' recursive pattern?
IN 'std::function' पुनरावर्ती पैटर्न क्या है?
A
std::function<int(int)> f; f=[&f](int n){return n<=1?1:n*f(n-1);} std::फ़ंक्शन f; f=[&f](int n){रिटर्न n
B
Not possible संभव नहीं
C
Only with templates केवल टेम्पलेट्स के साथ
D
A design pattern एक डिज़ाइन पैटर्न
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Using std::function and capturing by reference allows self-referential lambdas.
व्याख्या (हिन्दी) std::function का उपयोग करना और संदर्भ द्वारा कैप्चर करना स्व-संदर्भित लैम्ब्डा की अनुमति देता है।
1253
EN + हिं
GB What is the output: int f(int x){return x;} float f(float x){return x;} double f(double x){return x;} cout<
IN आउटपुट क्या है: int f(int x){रिटर्न x;} फ्लोट f(फ्लोट x){रिटर्न x;} डबल f(डबल x){रिटर्न x;} कॉउट
A
4 4
B
8 8
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1 is int literal; f(int) called; sizeof(int)=4. Output: 4.
व्याख्या (हिन्दी) 1 पूर्णांक शाब्दिक है; f(int) कहा जाता है; sizeof(int)=4. आउटपुट: 4.
1254
EN + हिं
GB What is the output: int f(int x,int y){return x*y;} int f(int x){return x*x;} cout<
IN आउटपुट क्या है: int f(int x,int y){return x*y;} int f(int x){return x*x;} cout
A
1612 1612
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
16 12 16 12
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(4)=4*4=16; f(3,4)=3*4=12. Output: 1612.
व्याख्या (हिन्दी) f(4)=4*4=16; f(3,4)=3*4=12. आउटपुट: 1612.
1255
EN + हिं
GB What is 'std::bind' placeholder _1?
IN 'std::bind' प्लेसहोल्डर _1 क्या है?
A
First argument of the bound call forwarded to original position बाउंड कॉल का पहला तर्क मूल स्थिति पर अग्रेषित किया गया
B
A default argument एक डिफ़ॉल्ट तर्क
C
A template parameter एक टेम्पलेट पैरामीटर
D
An index एक अनुक्रमणिका
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) bind(f,_1,5) creates callable where first arg goes to f's first param, 5 to second.
व्याख्या (हिन्दी) बाइंड (f,_1,5) कॉल करने योग्य बनाता है जहां पहला तर्क एफ के पहले पैरामीटर पर जाता है, 5 से दूसरे पर।
1256
EN + हिं
GB What is the output: template T applyN(F f,T x,int n){return n?applyN(f,f(x),n-1):x;} cout<
IN आउटपुट क्या है: टेम्पलेट T applyN(F f,T x,int n){return n?applyN(f,f(x),n-1):x;} cout
A
32 32
B
16 16
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1*2^5=32. Output: 32.
व्याख्या (हिन्दी) 1*2^5=32. आउटपुट: 32.
1257
EN + हिं
GB What is the output: int f(int x){return x>0?f(x-1)+x:0;} int g(int y){return f(y)*2;} cout<
IN आउटपुट क्या है: int f(int x){return x>0?f(x-1)+x:0;} int g(int y){return f(y)*2;} cout
A
30 30
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(5)=15; g=15*2=30. Output: 30.
व्याख्या (हिन्दी) एफ(5)=15; जी=15*2=30. आउटपुट: 30.
1258
EN + हिं
GB What is the output: auto f=[](auto self,int n,int acc)->int{return n?self(self,n-1,acc+n):acc;}; cout<
IN आउटपुट क्या है: auto f=[](auto self,int n,int acc)->int{return n?self(self,n-1,acc+n):acc;}; अदालत
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5+4+3+2+1+0=15. Output: 15.
व्याख्या (हिन्दी) 5+4+3+2+1+0=15. आउटपुट: 15.
1259
EN + हिं
GB What is 'std::regular_invocable' concept?
IN 'std::regular_invocable' अवधारणा क्या है?
A
Callable with args that also models equality_comparable on result तर्कों के साथ कॉल करने योग्य जो परिणाम पर समानता_तुलनीय को भी मॉडल करता है
B
Same as invocable आह्वान योग्य के समान
C
A function type एक फ़ंक्शन प्रकार
D
A template एक टेम्पलेट
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) regular_invocable adds to invocable the requirement that f(args) is equality-preserving.
व्याख्या (हिन्दी) रेगुलर_इनवोकेबल इनवोकेबल में यह आवश्यकता जोड़ता है कि f(args) समानता-संरक्षण है।
1260
EN + हिं
GB What is the output: int sum=0; auto f=[&](auto self,int n)->void{if(n<=0)return;sum+=n;self(self,n-1);}; f(f,10); cout<
IN आउटपुट क्या है: int sum=0; auto f=[&](auto self,int n)->void{if(n
A
55 55
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10+9+...+1=55. Output: 55.
व्याख्या (हिन्दी) 10+9+...+1=55. आउटपुट: 55.
1246–1260 of 1915