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

Question 151

EN + हिं
GB What is the output: int f(int n){ return n?n+f(n-1):0; } cout<
IN आउटपुट क्या है: int f(int n){ return n?n+f(n-1):0; } कोउट
10 10
4 4
24 24
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(4)=4+f(3)=4+3+f(2)=4+3+2+f(1)=4+3+2+1+f(0)=4+3+2+1+0=10.
व्याख्या (हिन्दी) f(4)=4+f(3)=4+3+f(2)=4+3+2+f(1)=4+3+2+1+f(0)=4+3+2+1+0=10.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 152

EN + हिं
GB What is 'memoization' in the context of recursive functions?
IN पुनरावर्ती कार्यों के संदर्भ में 'संस्मरण' क्या है?
Caching results of function calls फ़ंक्शन कॉल के कैशिंग परिणाम
Memory optimization technique मेमोरी अनुकूलन तकनीक
Using static variables स्थैतिक चर का उपयोग करना
Tail call optimization टेल कॉल अनुकूलन
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Memoization stores the results of expensive function calls and returns cached results when the same inputs occur again.
व्याख्या (हिन्दी) मेमोइज़ेशन महंगे फ़ंक्शन कॉल के परिणामों को संग्रहीत करता है और समान इनपुट दोबारा होने पर कैश्ड परिणाम लौटाता है।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 153

EN + हिं
GB What is the output: int x=10; auto f=[&](){ return ++x; }; cout<
IN आउटपुट क्या है: int x=10; ऑटो f=[&](){वापसी++x; }; अदालत
1112 1112
Unspecified अनिर्दिष्ट
1112 1112
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Order of evaluation of arguments to << is unspecified before C++17; both calls modify x but print order is unspecified.
व्याख्या (हिन्दी) तर्कों के मूल्यांकन का क्रम
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 154

EN + हिं
GB What is 'noexcept' specifier in C++?
IN C++ में 'noexcept' विनिर्देशक क्या है?
Guarantees function throws no exceptions गारंटी फ़ंक्शन कोई अपवाद नहीं देता है
Prevents exception handling अपवाद प्रबंधन को रोकता है
Makes function constexpr फ़ंक्शन कॉन्स्टेक्सपीआर बनाता है
Catches all exceptions सभी अपवादों को पकड़ता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) noexcept declares that a function will not throw exceptions; if it does, std::terminate is called.
व्याख्या (हिन्दी) noexcept घोषित करता है कि कोई फ़ंक्शन अपवाद नहीं फेंकेगा; यदि ऐसा होता है, तो std::terminet को कॉल किया जाता है।
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 155

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; }
Works in C++17 C++17 में काम करता है
Compile error संकलन त्रुटि
Undefined behavior अपरिभाषित व्यवहार
Works if x is const यदि x स्थिरांक है तो काम करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Default argument cannot refer to another parameter; this is a compile error.
व्याख्या (हिन्दी) डिफ़ॉल्ट तर्क किसी अन्य पैरामीटर को संदर्भित नहीं कर सकता; यह एक संकलन त्रुटि है.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 156

EN + हिं
GB What is the output: void f(int* p){ *p=20; } int a=10; f(&a); cout<
IN आउटपुट क्या है: void f(int* p){ *p=20; } int a=10; एफ(&ए); अदालत
10 10
20 20
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f takes pointer to int, dereferences and sets to 20, modifying a. Output: 20.
व्याख्या (हिन्दी) f पॉइंटर को int, dereferences पर ले जाता है और a को संशोधित करते हुए 20 पर सेट करता है। आउटपुट: 20.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 157

EN + हिं
GB What is the output: int f(int n){ return n>0?f(n/2)+1:0; } cout<
IN आउटपुट क्या है: int f(int n){ return n>0?f(n/2)+1:0; } कोउट
3 3
4 4
8 8
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(8)=f(4)+1=f(2)+2=f(1)+3=f(0)+4=0+4=4. Wait: f(8)=f(4)+1; f(4)=f(2)+1; f(2)=f(1)+1; f(1)=f(0)+1=1; f(2)=2; f(4)=3; f(8)=4. Answer: 4.
व्याख्या (हिन्दी) f(8)=f(4)+1=f(2)+2=f(1)+3=f(0)+4=0+4=4. रुको: f(8)=f(4)+1; f(4)=f(2)+1; f(2)=f(1)+1; f(1)=f(0)+1=1; एफ(2)=2; एफ(4)=3; एफ(8)=4. उत्तर: 4.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 158

EN + हिं
GB What is 'function template argument deduction'?
IN 'फ़ंक्शन टेम्प्लेट तर्क कटौती' क्या है?
Compiler deducing template args from function arguments कंपाइलर फ़ंक्शन तर्कों से टेम्प्लेट तर्क निकालता है
Manually specifying template arguments टेम्पलेट तर्कों को मैन्युअल रूप से निर्दिष्ट करना
Runtime type deduction रनटाइम प्रकार की कटौती
Only works with auto केवल ऑटो के साथ काम करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) When calling a function template, the compiler deduces template type parameters from the types of the provided arguments.
व्याख्या (हिन्दी) फ़ंक्शन टेम्प्लेट को कॉल करते समय, कंपाइलर प्रदान किए गए तर्कों के प्रकारों से टेम्प्लेट प्रकार के पैरामीटर निकालता है।
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 159

EN + हिं
GB What is the output: int f(int x){ return x; } double f(double x){ return x; } cout<
IN आउटपुट क्या है: int f(int x){ return x; } डबल एफ (डबल एक्स) { रिटर्न एक्स; } कोउट
1 1
1.0 1.0
Ambiguous अस्पष्ट
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1 is int literal; exact match to f(int). Output: 1.
व्याख्या (हिन्दी) 1 पूर्णांक शाब्दिक है; f(int) से सटीक मिलान। आउटपुट: 1.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 160

EN + हिं
GB What is the output: auto f=[]()mutable{ static int x=0; return x++; }; cout<
IN आउटपुट क्या है: auto f=[]()mutable{static int x=0; वापसी x++; }; अदालत
012 012
000 000
Unspecified अनिर्दिष्ट
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Order of evaluation of arguments to << is unspecified, so print order of 0,1,2 is unspecified.
व्याख्या (हिन्दी) तर्कों के मूल्यांकन का क्रम
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 161

EN + हिं
GB What is the output: int a[]={1,2,3}; int *p=a; cout<<*(p+2);
IN आउटपुट क्या है: int a[]={1,2,3}; int *p=a; अदालत
3 3
2 2
1 1
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p+2 points to a[2]=3.
व्याख्या (हिन्दी) p+2 a[2]=3 की ओर इंगित करता है।
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 162

EN + हिं
GB What is the output: int a[3][2]={{1,2},{3,4},{5,6}}; cout<
IN What is the output: int a[3][2]={{1,2},{3,4},{5,6}}; अदालत
4 4
3 3
2 2
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a[1][1] is row 1, col 1 = 4.
व्याख्या (हिन्दी) a[1][1] पंक्ति 1 है, कॉलम 1 = 4।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 163

EN + हिं
GB What is the size of: int arr[10]; cout<
IN What is the size of: int arr[10]; अदालत
10 10
40 40
8 8
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sizeof(arr)=10*sizeof(int)=10*4=40 on most platforms.
व्याख्या (हिन्दी) अधिकांश प्लेटफ़ॉर्म पर sizeof(arr)=10*sizeof(int)=10*4=40।
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 164

EN + हिं
GB What is the output: int a[5]={1}; cout<
IN What is the output: int a[5]={1}; अदालत
1 1
Undefined अपरिभाषित
Garbage कचरा
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Partial initialization zero-fills remaining elements: a[4]=0.
व्याख्या (हिन्दी) आंशिक आरंभीकरण शून्य-शेष तत्वों को भरता है: a[4]=0।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 165

EN + हिं
GB What is the output: int a[]={1,2,3}; cout<
IN आउटपुट क्या है: int a[]={1,2,3}; अदालत
1 1
3 3
4 4
12 12
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sizeof(a)=12, sizeof(a[0])=4. 12/4=3 (array length).
व्याख्या (हिन्दी) आकार(ए)=12, आकार(ए[0])=4. 12/4=3 (सरणी लंबाई)।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।