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
91
EN + हिं
GB What is the output: int a=10; cout<<(a>5)+(a<20)+(a==10);
IN आउटपुट क्या है: int a=10; अदालत
A
1 1
B
2 2
C
3 3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All three comparisons are true (=1 each): 1+1+1=3.
व्याख्या (हिन्दी) तीनों तुलनाएँ सत्य हैं (=1 प्रत्येक): 1+1+1=3।
92
EN + हिं
GB Which operator is used for pointer-to-member access?
IN पॉइंटर-टू-मेंबर एक्सेस के लिए किस ऑपरेटर का उपयोग किया जाता है?
A
-> ->
B
.* .*
C
:: ::
D
& &
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) .* and ->* are pointer-to-member access operators in C++.
व्याख्या (हिन्दी) .* और ->* C++ में पॉइंटर-टू-मेंबर एक्सेस ऑपरेटर हैं।
93
EN + हिं
GB What is the result: int x = 5; x = x > 3 ? x + 1 : x - 1; cout << x;
IN परिणाम क्या है: int x = 5; एक्स = एक्स > 3 ? एक्स + 1 : एक्स - 1; अदालत
A
4 4
B
5 5
C
6 6
D
7 7
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x>3 is true, so x = x+1 = 6.
व्याख्या (हिन्दी) x>3 सत्य है, इसलिए x = x+1 = 6.
94
EN + हिं
GB What is the output: int a = 5, b = 10; cout << (a < b ? a : b) * 2;
IN आउटपुट क्या है: int a = 5, b = 10; अदालत
A
10 10
B
20 20
C
5 5
D
15 15
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a
व्याख्या (हिन्दी)
95
EN + हिं
GB What is the output: cout << 10/3*3;
IN आउटपुट क्या है: cout
A
10 10
B
9 9
C
3 3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Left to right: 10/3=3 (integer), 3*3=9.
व्याख्या (हिन्दी) बाएँ से दाएँ: 10/3=3 (पूर्णांक), 3*3=9।
96
EN + हिं
GB What does overloading operator= return by convention?
IN ओवरलोडिंग ऑपरेटर = कन्वेंशन द्वारा क्या लौटाता है?
A
void खालीपन
B
bool बूल
C
*this (reference to self) *यह (स्वयं का संदर्भ)
D
const reference स्थिरांक संदर्भ
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) By convention, copy/move assignment operators return a reference to *this to enable chaining: a = b = c.
व्याख्या (हिन्दी) परंपरा के अनुसार, कॉपी/मूव असाइनमेंट ऑपरेटर चेनिंग को सक्षम करने के लिए *इस का संदर्भ लौटाते हैं: ए = बी = सी।
97
EN + हिं
GB What is the output: int x = -5; cout << (x >> 1);
IN आउटपुट क्या है: int x = -5; कॉउट > 1);
A
-3 -3
B
-2 -2
C
-1 -1
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Right-shifting a negative signed integer is implementation-defined. On most platforms (arithmetic shift): -5>>1 = -3 (rounds toward negative infinity).
व्याख्या (हिन्दी) एक नकारात्मक हस्ताक्षरित पूर्णांक को राइट-शिफ्टिंग कार्यान्वयन-परिभाषित है। अधिकांश प्लेटफ़ॉर्म पर (अंकगणितीय बदलाव): -5>>1 = -3 (नकारात्मक अनंत की ओर राउंड)।
98
EN + हिं
GB What is the output: int a=3,b=4; if(a=0) cout<
IN आउटपुट क्या है: int a=3,b=4; if(a=0) cout
A
3 3
B
4 4
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a=0 assigns 0 to a (evaluates to 0 = false), so else branch executes printing b=4.
व्याख्या (हिन्दी) a=0, a को 0 निर्दिष्ट करता है (0 = गलत का मूल्यांकन करता है), इसलिए अन्यथा शाखा b=4 मुद्रण निष्पादित करती है।
99
EN + हिं
GB What is the output: for(int i=0;i<5;i++) if(i==3) continue; cout<
IN आउटपुट क्या है: for(int i=0;i
A
01245 01245
B
01234 01234
C
Compile error संकलन त्रुटि
D
0124 0124
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i is declared inside for; it's not accessible after the loop. Compile error.
व्याख्या (हिन्दी) i के लिए अंदर घोषित किया गया है; यह लूप के बाद पहुंच योग्य नहीं है। संकलन त्रुटि.
100
EN + हिं
GB What is the output: int x=10; switch(x){case 10: cout<<'A'; case 20: cout<<'B'; default: cout<<'C';}
IN आउटपुट क्या है: int x=10; स्विच(x){केस 10: कॉउट
A
A
B
ABC एबीसी
C
AB अब
D
AC ए.सी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Without break statements, execution falls through all subsequent cases after matching case 10. Output: ABC.
व्याख्या (हिन्दी) ब्रेक स्टेटमेंट के बिना, केस 10 के मिलान के बाद सभी बाद के मामलों में निष्पादन गिर जाता है। आउटपुट: एबीसी।
101
EN + हिं
GB What does 'goto' do in C++?
IN C++ में 'goto' क्या करता है?
A
Jumps to a labeled statement एक लेबल किए गए कथन पर चला जाता है
B
Is removed in C++11 C++11 में हटा दिया गया है
C
Only works inside loops केवल लूप के अंदर काम करता है
D
Causes undefined behavior अपरिभाषित व्यवहार का कारण बनता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) goto transfers control to a named label within the same function. It is legal but considered poor style.
व्याख्या (हिन्दी) goto transfers control to a named label within the same function. यह कानूनी है लेकिन ख़राब शैली मानी जाती है।
102
EN + हिं
GB What is the output: int i=0; do{ cout<
IN आउटपुट क्या है: int i=0; करो {मुफ़्त करो
A
Nothing कुछ नहीं
C
01 01
D
Infinite loop अनंत लूप
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) do-while executes body at least once. Prints i=0, then i becomes 1, condition 1<0 is false, loop exits.
व्याख्या (हिन्दी) डू-व्हाइल बॉडी को कम से कम एक बार निष्पादित करता है। i=0 प्रिंट करता है, फिर i 1 हो जाता है, शर्त 1
103
EN + हिं
GB What is the output: for(;;) { static int x=0; cout<2) break; }
IN आउटपुट क्या है: for(;;) {static int x=0; अदालत
A
012 012
C
123 123
D
Infinite loop अनंत लूप
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Static x persists; loop: print 0, x=1; print 1, x=2; print 2, x=3, 3>2 break. Output: 012.
व्याख्या (हिन्दी) स्थैतिक x कायम रहता है; लूप: प्रिंट 0, x=1; प्रिंट 1, x=2; प्रिंट 2, x=3, 3>2 ​​ब्रेक। आउटपुट: 012.
104
EN + हिं
GB What is the output: int x=5; if(x>3) if(x>4) cout<<'A'; else cout<<'B';
IN आउटपुट क्या है: int x=5; if(x>3) if(x>4) cout
A
A
B
B बी
C
AB अब
D
Nothing कुछ नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Dangling else: else binds to nearest if. x>4 is true so 'A' is printed.
व्याख्या (हिन्दी) डैंगलिंग अन्य: अन्यथा निकटतम यदि से जुड़ता है। x>4 सत्य है इसलिए 'ए' मुद्रित है।
105
EN + हिं
GB What is the output: for(int i=0;i<3;i++) for(int j=0;j<3;j++) if(i==j) goto done; done: cout<<'X';
IN आउटपुट क्या है: for(int i=0;i
A
X एक्स
B
XXX XXX
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) When i==0 and j==0, goto jumps to done label, printing X once.
व्याख्या (हिन्दी) जब i==0 और j==0, गोटो पूर्ण लेबल पर चला जाता है, X को एक बार प्रिंट करता है।
91–105 of 1915