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
586
EN + हिं
GB What is the output: int x=0; cout<<(x=5,x*x);
IN आउटपुट क्या है: int x=0; अदालत
A
25 25
B
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Evaluates x=5, then x*x=25. Output: 25.
व्याख्या (हिन्दी) x=5 का मूल्यांकन करता है, फिर x*x=25. आउटपुट: 25.
587
EN + हिं
GB What is the output: cout<<(10>>1)<<(10<<1)<<(10%3);
IN आउटपुट क्या है: cout1)
A
5201 5201
B
520 520
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10>>1=5, 10<<1=20, 10%3=1. Output: 5201.
व्याख्या (हिन्दी) 10>>1=5, 10
588
EN + हिं
GB What is the output: int x=5; cout<<~x;
IN आउटपुट क्या है: int x=5; अदालत
A
-6 -6
B
5 5
C
6 6
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ~5 flips all bits = -6 in two's complement. Output: -6.
व्याख्या (हिन्दी) ~5 सभी बिट्स को फ़्लिप करता है = -6 दो के पूरक में। आउटपुट: -6.
589
EN + हिं
GB What is the output: int x=7,y=3; cout<<(x/y)<<(x%y)<<(x/y*y+x%y);
IN आउटपुट क्या है: int x=7,y=3; अदालत
A
221 221
B
217 217
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7/3=2, 7%3=1. 2*3+1=7. Output: 217.
व्याख्या (हिन्दी) 7/3=2, 7%3=1. 2*3+1=7. आउटपुट: 217.
590
EN + हिं
GB What is the output: bool a=true,b=true; cout<<(a^b)<<(a==b)<<(a!=b);
IN आउटपुट क्या है: bool a=true,b=true; अदालत
A
010 010
B
011 011
C
110 110
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) T^T=0, T==T=1, T!=T=0. Output: 010.
व्याख्या (हिन्दी) T^T=0, T==T=1, T!=T=0. आउटपुट: 010.
591
EN + हिं
GB What is the output: int x=5; cout<<(x|=0);
IN आउटपुट क्या है: int x=5; अदालत
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x|0=x=5. Output: 5.
व्याख्या (हिन्दी) x|0=x=5. आउटपुट: 5.
592
EN + हिं
GB What is the output: int x=5; cout<<(x&=x);
IN आउटपुट क्या है: int x=5; अदालत
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x&x=x=5. Output: 5.
व्याख्या (हिन्दी) x&x=x=5. आउटपुट: 5.
593
EN + हिं
GB What is the output: int a=0b1010,b=0b1100; cout<<(a&b)<<(a|b)<<(a^b);
IN आउटपुट क्या है: int a=0b1010,b=0b1100; अदालत
A
8148 8148
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
8122 8122
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1010&1100=1000=8; 1010|1100=1110=14; 1010^1100=0110=6. Output: 8146.
व्याख्या (हिन्दी) 1010&1100=1000=8; 1010|1100=1110=14; 1010^1100=0110=6. आउटपुट: 8146.
594
EN + हिं
GB What is the output: int x=256; cout<<(x>>8);
IN आउटपुट क्या है: int x=256; cout8);
A
1 1
C
256 256
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 256=1<<8. 256>>8=1. Output: 1.
व्याख्या (हिन्दी) 256=18=1. आउटपुट: 1.
595
EN + हिं
GB What is 'operator new' overloading purpose?
IN 'ऑपरेटर नया' ओवरलोडिंग उद्देश्य क्या है?
A
Custom memory allocation (pool, arena, debug) कस्टम मेमोरी आवंटन (पूल, एरेना, डीबग)
B
Faster new तेज़ नया
C
Thread-safe allocation थ्रेड-सुरक्षित आवंटन
D
All of above उपरोक्त सभी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Overloading operator new allows custom allocators for performance, memory pools, or debugging.
व्याख्या (हिन्दी) ओवरलोडिंग ऑपरेटर नया प्रदर्शन, मेमोरी पूल या डिबगिंग के लिए कस्टम आवंटनकर्ताओं को अनुमति देता है।
596
EN + हिं
GB What is the output: int x=5; cout<<(x+=1)+(x+=1);
IN आउटपुट क्या है: int x=5; अदालत
A
14 14
B
Undefined अपरिभाषित
C
Compile error संकलन त्रुटि
D
13 13
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Pre-C++17 UB; C++17 still unspecified for +operands. UB.
व्याख्या (हिन्दी) प्री-सी++17 यूबी; C++17 अभी भी +ऑपरेंड के लिए निर्दिष्ट नहीं है। यूबी.
597
EN + हिं
GB What is the output: int x=5; cout<<(x&&=0);
IN आउटपुट क्या है: int x=5; अदालत
A
Compile error संकलन त्रुटि
C
5 5
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) &&= is not a valid compound assignment operator in C++. Compile error.
व्याख्या (हिन्दी) &&= C++ में वैध कंपाउंड असाइनमेंट ऑपरेटर नहीं है। संकलन त्रुटि.
598
EN + हिं
GB What is the output: int x=15; cout<<(x&=~0x7);
IN आउटपुट क्या है: int x=15; अदालत
A
8 8
B
15 15
C
7 7
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ~0x7=...11111000. 15=00001111. AND=00001000=8. Output: 8.
व्याख्या (हिन्दी) ~0x7=...111111000. 15=00001111. तथा=00001000=8. आउटपुट: 8.
599
EN + हिं
GB What is the output: int a=5,b=10; int c=(a>b)?a:b; cout<
IN आउटपुट क्या है: int a=5,b=10; int c=(a>b)?a:b; अदालत
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a>b=false; returns b=10. Output: 10.
व्याख्या (हिन्दी) ए>बी=झूठा; रिटर्न b=10. आउटपुट: 10.
600
EN + हिं
GB What is the output: int x=5; cout<<(x=x+1);
IN आउटपुट क्या है: int x=5; अदालत
A
6 6
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=x+1=6. Assignment returns 6. Output: 6.
व्याख्या (हिन्दी) x=x+1=6. असाइनमेंट रिटर्न 6. आउटपुट: 6.
586–600 of 1915