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
706
EN + हिं
GB What is the output: int f(int n){return n==1?1:f(n/2)+(n%2);} cout<
IN आउटपुट क्या है: int f(int n){return n==1?1:f(n/2)+(n%2);} cout
A
3 3
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(7)=f(3)+1=f(1)+1+1=1+1+1=3. Output: 3.
व्याख्या (हिन्दी) f(7)=f(3)+1=f(1)+1+1=1+1+1=3. आउटपुट: 3.
707
EN + हिं
GB What is 'std::compose' equivalent in C++?
IN C++ में 'std::compose' समतुल्य क्या है?
A
Not standard; use lambda chaining मानक नहीं; लैम्ब्डा चेनिंग का उपयोग करें
B
A range view एक रेंज दृश्य
C
A bind expression एक बंधी हुई अभिव्यक्ति
D
std::transform एसटीडी::परिवर्तन
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C++ has no std::compose; function composition done via lambdas: auto compose=[](auto f,auto g){return [=](auto x){return f(g(x));};};
व्याख्या (हिन्दी) C++ में कोई std::compose नहीं है; लैम्ब्डा के माध्यम से किया गया फ़ंक्शन संयोजन: ऑटो कंपोज़ = [] (ऑटो एफ, ऑटो जी) {रिटर्न [=] (ऑटो एक्स) {रिटर्न एफ (जी (एक्स));};};
708
EN + हिं
GB What is the output: int (*fp[3])(int)={[](int x){return x;}, [](int x){return x*2;}, [](int x){return x*3;}}; cout<
IN आउटपुट क्या है: int (*fp[3])(int)={[](int x){return x;}, [](int x){return x*2;}, [](int x){return x*3;}}; अदालत
A
15 15
B
10 10
C
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) fp[2]=x*3. fp[2](5)=15. Output: 15.
व्याख्या (हिन्दी) एफपी[2]=x*3. एफपी[2](5)=15। आउटपुट: 15.
709
EN + हिं
GB What is the output: int f(int x){return x*(x+1)*(x+2)/6;} cout<
IN आउटपुट क्या है: int f(int x){return x*(x+1)*(x+2)/6;} cout
A
20 20
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 4*5*6/6=20. Output: 20.
व्याख्या (हिन्दी) 4*5*6/6=20. आउटपुट: 20.
710
EN + हिं
GB 'What is the output: int a=0; auto inc=[&](){a++;}; auto dec=[&](){a (1, 6, 75, 5, 4, 'What is the output: auto square=[](auto x){return x*x;}; cout<
IN 'आउटपुट क्या है: int a=0; ऑटो इंक=[&](){a++;}; ऑटो डिक=[&](){a (1, 6, 75, 5, 4, 'आउटपुट क्या है: ऑटो स्क्वायर = [] (ऑटो एक्स) {रिटर्न x*x;}; कॉउट
A
result=91. f(99)=91. Output: 91.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'What is the output: int f(int x){return x?f(x>>1)*2+(x&1):0;} cout<<f(10);', 'f reconstructs value?', '10', '10', '5', '5', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', 'f(10): rebuilds bits: f(10)=f(5)*2+0=10. Output: 10.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'What is the output: int f(int a,int b){return b?f(b,a%b):a;} cout<<f(100,75);', 'GCD(100,75)?', '25', '25', '75', '75', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', 'GCD(100,75)=GCD(75,25)=GCD(25,0)=25. Output: 25.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'What is the output: auto f=[]<typename T>(T x){return x+x;}; cout<<f(5)<<f(string("ab"));', 'C++20 template lambda?', '10ab', '10ab', 'Compile error', 'Compile error', 'Undefined', 'Undefined', '10abab', '10abab', NULL, 'option_d', 'C++20 template lambda: f(5)=10 परिणाम=91. एफ(99)=91. आउटपुट: 91.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'आउटपुट क्या है: int f(int x){return x?f(x>>1)*2+(x&1):0;} cout
B
2 2
C
4 4
D
2}; cout<<a[3];', 'Partial init: a[3]?', '0', '0', 'Garbage', 'Garbage', 'Undefined', 'Undefined', 'Compile error', 'Compile error', NULL, 'option_a', 'Remaining elements zero-initialized. a[3]=0. Output: 0.', 0, '2026-05-25', '2026-05-25'), (1, 6, 76, 6, 4, 'What is the output: int a[]={1 2}; अदालत
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3
व्याख्या (हिन्दी) 3
711
EN + हिं
GB What is the output: auto square=[](auto x){return x*x;}; cout<
IN आउटपुट क्या है: ऑटो वर्ग=[](ऑटो x){रिटर्न x*x;}; अदालत
A
162.25 162.25
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
16 2.25 16 2.25
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) square(4)=16, square(1.5)=2.25. Output: 162.25.
व्याख्या (हिन्दी) वर्ग(4)=16, वर्ग(1.5)=2.25. आउटपुट: 162.25.
712
EN + हिं
GB What is the output: int f(int x){if(x>100) return x-10; return f(f(x+11));} cout<
IN आउटपुट क्या है: int f(int x){if(x>100) return x-10; return f(f(x+11));} cout
A
91 91
B
99 99
C
100 100
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) McCarthy 91: for n<=100, result=91. f(99)=91. Output: 91.
व्याख्या (हिन्दी) मैक्कार्थी 91: एन के लिए
713
EN + हिं
GB What is the output: int f(int x){return x?f(x>>1)*2+(x&1):0;} cout<
IN आउटपुट क्या है: int f(int x){return x?f(x>>1)*2+(x&1):0;} cout
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(10): rebuilds bits: f(10)=f(5)*2+0=10. Output: 10.
व्याख्या (हिन्दी) f(10): बिट्स का पुनर्निर्माण करता है: f(10)=f(5)*2+0=10। आउटपुट: 10.
714
EN + हिं
GB What is the output: int f(int a,int b){return b?f(b,a%b):a;} cout<
IN आउटपुट क्या है: int f(int a,int b){return b?f(b,a%b):a;} cout
A
25 25
B
75 75
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) GCD(100,75)=GCD(75,25)=GCD(25,0)=25. Output: 25.
व्याख्या (हिन्दी) जीसीडी(100,75)=जीसीडी(75,25)=जीसीडी(25,0)=25। आउटपुट: 25.
715
EN + हिं
GB What is the output: auto f=[](T x){return x+x;}; cout<
IN आउटपुट क्या है: auto f=[](T x){return x+x;}; अदालत
A
10ab 10ab
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
10abab 10अबाब
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C++20 template lambda: f(5)=10, f("ab")=string+string=abab. Output: 10abab.
व्याख्या (हिन्दी) C++20 टेम्प्लेट लैम्ब्डा: f(5)=10, f("ab")=स्ट्रिंग+स्ट्रिंग=अबाब। आउटपुट: 10abab.
716
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
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.
717
EN + हिं
GB What is the output: int a[5]={1,2}; cout<
IN आउटपुट क्या है: int a[5]={1,2}; अदालत
B
Garbage कचरा
C
Undefined अपरिभाषित
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Remaining elements zero-initialized. a[3]=0. Output: 0.
व्याख्या (हिन्दी) शेष तत्व शून्य-प्रारंभिक हैं। ए[3]=0. आउटपुट: 0.
718
EN + हिं
GB What is the output: int a[]={1,2,3}; cout<
IN आउटपुट क्या है: int a[]={1,2,3}; अदालत
A
12 12
B
3 3
C
8 8
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3*4=12. Output: 12.
व्याख्या (हिन्दी) 3*4=12. आउटपुट: 12.
719
EN + हिं
GB What is the output: int a[3]; fill(begin(a),end(a),7); cout<
IN आउटपुट क्या है: int a[3]; भरें(शुरू(ए),अंत(ए),7); अदालत
A
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All elements 7. a[1]=7. Output: 7.
व्याख्या (हिन्दी) सभी तत्व 7. a[1]=7. आउटपुट: 7.
720
EN + हिं
GB What is the output: int a[]={5,4,3,2,1}; stable_sort(a,a+5); cout<
IN आउटपुट क्या है: int a[]={5,4,3,2,1}; स्थिर_सॉर्ट(ए,ए+5); अदालत
A
3 3
B
4 4
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,2,3,4,5. a[2]=3. Output: 3.
व्याख्या (हिन्दी) क्रमबद्ध: 1,2,3,4,5. ए[2]=3. आउटपुट: 3.
706–720 of 1915