OOP Using C++ — MCQ Practice

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

📚 132 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
132 questions
76
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 से दूसरे पर।
77
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.
78
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.
79
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.
80
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) समानता-संरक्षण है।
81
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.
82
EN + हिं
GB What is the output: template auto sumAll(Args...args){return (args+...);} cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो sumAll(Args...args){return (args+...);} cout
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+2+3+4+5=15. Output: 15.
व्याख्या (हिन्दी) 1+2+3+4+5=15. आउटपुट: 15.
83
EN + हिं
GB What is the output: int f(int x,int y=x){return x+y;}
IN आउटपुट क्या है: int f(int x,int y=x){return x+y;}
A
Compile error संकलन त्रुटि
B
Works fine बढ़िया काम करता है
C
Undefined अपरिभाषित
D
10 10
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Default argument cannot refer to another parameter. Compile error.
व्याख्या (हिन्दी) डिफ़ॉल्ट तर्क किसी अन्य पैरामीटर को संदर्भित नहीं कर सकता. संकलन त्रुटि.
84
EN + हिं
GB What is the output: int f(int x){return x%2?f(x-1)+1:0;} cout<
IN आउटपुट क्या है: int f(int x){return x%2?f(x-1)+1:0;} cout
A
4 4
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(7)=f(6)+1=0+1... wait: f(7)=7%2=1: f(6)+1=0+1=1. f(5)=f(4)+1=0+1=1. f(7)=f(6)+1. f(6)=0. f(7)=1. Hmm. Let me trace: f(7)=f(6)+1; f(6)=0; f(7)=1. But what about f(5)=f(4)+1=1? f(7)=f(6)+1=1. Output: 1.
व्याख्या (हिन्दी) f(7)=f(6)+1=0+1... प्रतीक्षा करें: f(7)=7%2=1: f(6)+1=0+1=1. f(5)=f(4)+1=0+1=1. f(7)=f(6)+1. एफ(6)=0. एफ(7)=1. हम्म। मुझे ट्रेस करने दीजिए: f(7)=f(6)+1; एफ(6)=0; एफ(7)=1. लेकिन f(5)=f(4)+1=1 के बारे में क्या? f(7)=f(6)+1=1. आउटपुट: 1.
85
EN + हिं
GB What is the output: auto compose=[](auto f,auto g){return [=](auto x){return f(g(x));};}; auto fn=compose([](int x){return x+1;},[](int x){return x*2;}); cout<
IN आउटपुट क्या है: ऑटो कंपोज़ = [] (ऑटो एफ, ऑटो जी) {रिटर्न [=] (ऑटो एक्स) {रिटर्न एफ (जी (एक्स));};}; ऑटो fn=compose([](int x){return x+1;},[](int x){return x*2;}); अदालत
A
11 11
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) g(5)=10; f(10)=11. Output: 11.
व्याख्या (हिन्दी) जी(5)=10; एफ(10)=11. आउटपुट: 11.
86
EN + हिं
GB What is the output: int f(int x){return x<=1?x:f(x/2)+(f((x+1)/2))+(x%2-1)?0:0;} cout<
IN आउटपुट क्या है: int f(int x){return x
A
8 8
B
4 4
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Tricky: f(8)=f(4)+f(4)+0=2*f(4); f(4)=f(2)+f(2)=2*f(2); f(2)=f(1)+f(1)=2. f(4)=4. f(8)=8. Output: 8.
व्याख्या (हिन्दी) पेचीदा: ​​f(8)=f(4)+f(4)+0=2*f(4); f(4)=f(2)+f(2)=2*f(2); f(2)=f(1)+f(1)=2. एफ(4)=4. एफ(8)=8. आउटपुट: 8.
87
EN + हिं
GB What is 'std::invoke_r' in C++23?
IN C++23 में 'std::invoke_r' क्या है?
A
std::invoke with explicit return type conversion std::स्पष्ट रिटर्न प्रकार रूपांतरण के साथ प्रारंभ करें
B
Same as invoke आह्वान के समान
C
A cast एक निक्षेपण
D
A concept संप्रत्यय
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::invoke_r(f,args...) invokes and converts result to R.
व्याख्या (हिन्दी) std::invoke_r(f,args...) आह्वान करता है और परिणाम को R में परिवर्तित करता है।
88
EN + हिं
GB What is the output: int x=5; auto f=[x](int y){return x+y;}; auto g=f; cout<
IN आउटपुट क्या है: int x=5; ऑटो f=[x](int y){रिटर्न x+y;}; ऑटो जी=एफ; अदालत
A
8 8
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) g is copy of f with x=5. g(3)=5+3=8. Output: 8.
व्याख्या (हिन्दी) g, x=5 के साथ f की प्रतिलिपि है। जी(3)=5+3=8. आउटपुट: 8.
89
EN + हिं
GB What is the output: template auto id(T&& x)->T&&{return forward(x);} int a=5; cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो आईडी(टी&& एक्स)->टी&&{रिटर्न फॉरवर्ड(x);} int a=5; अदालत
A
5 5
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
Address पता
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) id(a) returns lvalue reference; cout<<5. Output: 5.
व्याख्या (हिन्दी) आईडी(ए) लैवैल्यू संदर्भ लौटाता है; अदालत
90
EN + हिं
GB What is the output: int f(int x){return x?f(x/2)*2+(x&1):0;} cout<
IN आउटपुट क्या है: int f(int x){return x?f(x/2)*2+(x&1):0;} cout
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(10)=f(5)*2+0; f(5)=f(2)*2+1; f(2)=f(1)*2+0; f(1)=f(0)*2+1=1. f(2)=2. f(5)=5. f(10)=10. Output: 10.
व्याख्या (हिन्दी) f(10)=f(5)*2+0; f(5)=f(2)*2+1; f(2)=f(1)*2+0; f(1)=f(0)*2+1=1. एफ(2)=2. एफ(5)=5. एफ(10)=10. आउटपुट: 10.
76–90 of 132