OOP Using C++ — MCQ Practice

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

📚 127 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
127 questions

Question 16

EN + हिं
GB What does 'delete[]' do vs 'delete'?
IN 'डिलीट[]' बनाम 'डिलीट' क्या करता है?
delete[] frees array, delete frees single object हटाएँ[] सरणी को मुक्त करता है, हटाएँ एकल वस्तु को मुक्त करता है
They are identical वे समान हैं
delete[] is for vectors delete[] वैक्टर के लिए है
delete[] calls destructor once delete[] डिस्ट्रक्टर को एक बार कॉल करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) delete[] calls destructor for each element and frees the array; delete only calls destructor once.
व्याख्या (हिन्दी) हटाएं[] प्रत्येक तत्व के लिए विध्वंसक को कॉल करता है और सरणी को मुक्त करता है; कॉल डिस्ट्रक्टर को केवल एक बार हटाएं।
🎯 Exam Perspective
OOP Using C++ ("Pointers" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 17

EN + हिं
GB What is the output: int* p=new int(42); cout<<*p; delete p; cout<<*p;
IN आउटपुट क्या है: int* p=new int(42); अदालत
42 42 42 42
42 0 42 0
42 then UB 42 फिर यूबी
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Accessing memory after delete is undefined behavior (use-after-free).
व्याख्या (हिन्दी) डिलीट के बाद मेमोरी तक पहुंच अपरिभाषित व्यवहार (उपयोग-बाद-मुक्त) है।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Pointers" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 18

EN + हिं
GB What is 'wild pointer'?
IN 'वाइल्ड पॉइंटर' क्या है?
Uninitialized pointer अप्रारंभीकृत सूचक
Null pointer नल पॉइंटर
Pointer past array end सूचक पिछले सरणी अंत
Pointer to global वैश्विक की ओर सूचक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A wild pointer is an uninitialized pointer that may point to arbitrary memory location.
व्याख्या (हिन्दी) वाइल्ड पॉइंटर एक अप्रारंभीकृत पॉइंटर है जो मनमाने ढंग से मेमोरी स्थान को इंगित कर सकता है।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Pointers" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 19

EN + हिं
GB What is the output: int a=1,b=2; int *p=&a,*q=&b; *p=*q; cout<
IN आउटपुट क्या है: int a=1,b=2; int *p=&a,*q=&b; *पी=*क्यू; अदालत
22 22
12 12
21 21
11 11
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=*q copies value of b into a. a becomes 2, b stays 2. Output: 22.
व्याख्या (हिन्दी) *p=*q b के मान को a में कॉपी करता है। ए 2 हो जाता है, बी 2 रहता है। आउटपुट: 22।
🎯 Exam Perspective
OOP Using C++ ("Pointers" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 20

EN + हिं
GB What is the output: int x=5; int *p=&x; p=nullptr; cout<<(p?*p:0);
IN आउटपुट क्या है: int x=5; int *p=&x; p=nullptr; अदालत
5 5
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p is set to nullptr; (p?*p:0): p is false, returns 0.
व्याख्या (हिन्दी) p को nullptr पर सेट किया गया है; (पी?*पी:0): पी गलत है, 0 लौटाता है।
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Pointers" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 21

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
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Pointers" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 22

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
OOP Using C++ ("Pointers" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 23

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
यह सवाल OOP Using C++ ("Pointers" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 24

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++ ("Pointers" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 25

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++ ("Pointers" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 26

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
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Pointers" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 27

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
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Pointers" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 28

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
OOP Using C++ ("Pointers" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 29

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
यह सवाल OOP Using C++ ("Pointers" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 30

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++ ("Pointers" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।