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 211

EN + हिं
GB What is std::unique_ptr?
IN std::unique_ptr क्या है?
Shared ownership smart pointer साझा स्वामित्व स्मार्ट सूचक
Exclusive ownership smart pointer (non-copyable) विशिष्ट स्वामित्व स्मार्ट पॉइंटर (गैर-प्रतिलिपि योग्य)
Weak reference smart pointer कमजोर संदर्भ स्मार्ट सूचक
Raw pointer wrapper कच्चा सूचक आवरण
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) unique_ptr has exclusive ownership; it cannot be copied, only moved; deletes object on destruction.
व्याख्या (हिन्दी) अद्वितीय_पीटीआर के पास विशेष स्वामित्व है; इसे कॉपी नहीं किया जा सकता, केवल स्थानांतरित किया जा सकता है; नष्ट होने पर वस्तु को हटा देता है।
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 212

EN + हिं
GB What is the output: int a[]={10,20,30}; int *p=a; cout<<*(p++);
IN आउटपुट क्या है: int a[]={10,20,30}; int *p=a; अदालत
10 10
20 20
30 30
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p++ returns current p (pointing to a[0]=10), then increments. Dereferences to 10.
व्याख्या (हिन्दी) p++ वर्तमान p लौटाता है (a[0]=10 की ओर इंगित करता है), फिर वृद्धि करता है। 10 से सन्दर्भ.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 213

EN + हिं
GB What is 'pointer to function' in C++?
IN C++ में 'पॉइंटर टू फंक्शन' क्या है?
A variable storing address of a function किसी फ़ंक्शन का एक वैरिएबल भंडारण पता
A function returning pointer एक फ़ंक्शन रिटर्निंग पॉइंटर
A member function pointer एक सदस्य फ़ंक्शन सूचक
A lambda एक लैम्ब्डा
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Function pointers store the address of a function and can be used to call it indirectly.
व्याख्या (हिन्दी) फ़ंक्शन पॉइंटर्स किसी फ़ंक्शन का पता संग्रहीत करते हैं और इसे अप्रत्यक्ष रूप से कॉल करने के लिए उपयोग किया जा सकता है।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 214

EN + हिं
GB What is the output: int f(){return 42;} int (*p)()=f; cout<
IN आउटपुट क्या है: int f(){return 42;} int (*p)()=f; अदालत
42 42
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p is function pointer to f; p() calls f() which returns 42.
व्याख्या (हिन्दी) p, f का फ़ंक्शन सूचक है; p() f() को कॉल करता है जो 42 लौटाता है।
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 215

EN + हिं
GB What is the output: int x=10; void *p=&x; cout<<*(int*)p;
IN आउटपुट क्या है: int x=10; शून्य *p=&x; अदालत
10 10
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) void* p stores address of x; cast to int* and dereference gives 10.
व्याख्या (हिन्दी) void* p, x का पता संग्रहीत करता है; int* पर कास्ट करें और डीरेफ़रेंस 10 देता है।
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 216

EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *p=a+5; cout<<*(p-1);
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *p=a+5; अदालत
5 5
4 4
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p=a+5 (one past end). p-1=&a[4]. *(p-1)=5.
व्याख्या (हिन्दी) p=a+5 (एक पिछला छोर)। पी-1=&ए[4]. *(पी-1)=5.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 217

EN + हिं
GB What is shared_ptr reference count?
IN Shared_ptr संदर्भ संख्या क्या है?
Number of shared_ptrs owning the object ऑब्जेक्ट के स्वामित्व वाले share_ptrs की संख्या
Number of times pointer is used पॉइंटर का उपयोग कितनी बार किया गया है
Garbage collection metric कचरा संग्रहण मीट्रिक
Memory address स्मृति पता
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) shared_ptr maintains a reference count; when it drops to 0, the managed object is deleted.
व्याख्या (हिन्दी) Shared_ptr एक संदर्भ गणना बनाए रखता है; जब यह 0 पर गिरता है, तो प्रबंधित ऑब्जेक्ट हटा दिया जाता है।
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 218

EN + हिं
GB What is the output: int x=5; auto p=make_unique(x); *p=10; cout<
IN आउटपुट क्या है: int x=5; ऑटो p=make_unique(x); *पी=10; अदालत
5 5
10 10
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) make_unique creates a new int with value x (copy). *p=10 doesn't affect x. Output: 5.
व्याख्या (हिन्दी) make_unique मान x (कॉपी) के साथ एक नया int बनाता है। *p=10 x को प्रभावित नहीं करता. आउटपुट: 5.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 219

EN + हिं
GB What is 'aliasing' in the context of pointers?
IN सूचकों के संदर्भ में 'अलियासिंग' क्या है?
Two pointers pointing to the same memory एक ही मेमोरी की ओर इशारा करने वाले दो संकेतक
A typedef for pointer type सूचक प्रकार के लिए एक टाइपडिफ़
Pointer casting सूचक कास्टिंग
Reference to pointer सूचक का संदर्भ
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Pointer aliasing occurs when two different pointers point to the same memory location, which can affect optimization.
व्याख्या (हिन्दी) पॉइंटर अलियासिंग तब होता है जब दो अलग-अलग पॉइंटर एक ही मेमोरी लोकेशन की ओर इशारा करते हैं, जो अनुकूलन को प्रभावित कर सकता है।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 220

EN + हिं
GB What is the output: int* p=new int[5]{1,2,3,4,5}; cout<
IN आउटपुट क्या है: int* p=new int[5]{1,2,3,4,5}; अदालत
5 5
4 4
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) new int[5]{1,2,3,4,5} initializes array; p[4]=5.
व्याख्या (हिन्दी) नया int[5]{1,2,3,4,5} सरणी प्रारंभ करता है; पी[4]=5.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 221

EN + हिं
GB What is the output: class A{public: int x=5;}; A a; cout<
IN आउटपुट क्या है: class A{public: int x=5;}; ए ए; अदालत
5 5
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) In-class member initializer sets x=5. Output: 5.
व्याख्या (हिन्दी) इन-क्लास सदस्य इनिशियलाइज़र x=5 सेट करता है। आउटपुट: 5.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 222

EN + हिं
GB What is the output: class A{int x; public: A(int v):x(v){} int get(){return x;}}; A a(10); cout<
IN आउटपुट क्या है: class A{int x; सार्वजनिक: A(int v):x(v){} int get(){return x;}}; ए ए(10); अदालत
10 10
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Constructor initializes x=10 via member initializer list. get() returns 10.
व्याख्या (हिन्दी) कंस्ट्रक्टर सदस्य इनिशियलाइज़र सूची के माध्यम से x=10 को इनिशियलाइज़ करता है। get() रिटर्न 10।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 223

EN + हिं
GB What is 'this' pointer?
IN 'यह' सूचक क्या है?
Pointer to current object instance वर्तमान वस्तु उदाहरण के लिए सूचक
Pointer to base class बेस क्लास का सूचक
Global pointer वैश्विक सूचक
Pointer to member function सदस्य फ़ंक्शन के लिए सूचक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 'this' is an implicit pointer available inside non-static member functions pointing to the current object.
व्याख्या (हिन्दी) 'यह' एक अंतर्निहित सूचक है जो गैर-स्थैतिक सदस्य फ़ंक्शंस के अंदर उपलब्ध है जो वर्तमान ऑब्जेक्ट की ओर इशारा करता है।
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 224

EN + हिं
GB What is the output: class A{public: static int x; int y;}; int A::x=5; A a; a.y=10; cout<
IN आउटपुट क्या है: वर्ग ए {सार्वजनिक: स्थिर int x; int y;}; int A::x=5; ए ए; a.y=10; अदालत
510 510
55 55
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A::x=5 (static, class-wide). a.y=10 (instance). Output: 510.
व्याख्या (हिन्दी) A::x=5 (स्थैतिक, वर्ग-व्यापी)। a.y=10 (उदाहरण). आउटपुट: 510.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 225

EN + हिं
GB What is a 'friend function'?
IN 'मित्र फ़ंक्शन' क्या है?
Function with access to private/protected members निजी/संरक्षित सदस्यों तक पहुंच के साथ कार्य
A member function एक सदस्य समारोह
A virtual function एक आभासी कार्य
A static function एक स्थिर कार्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A friend function declared inside a class can access its private and protected members.
व्याख्या (हिन्दी) किसी क्लास के अंदर घोषित मित्र फ़ंक्शन अपने निजी और संरक्षित सदस्यों तक पहुंच सकता है।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।