OOP Using C++ — MCQ Practice

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

📚 163 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
163 questions
91
EN + हिं
GB What is 'operator<=> auto' return?
IN 'ऑपरेटर ऑटो' रिटर्न क्या है?
A
Compiler deduces comparison category from member comparisons कंपाइलर सदस्य तुलनाओं से तुलना श्रेणी निकालता है
B
Always strong_ordering हमेशा मजबूत_आदेश देना
C
Runtime deduction रनटाइम कटौती
D
Same as bool बूल के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) auto operator<=>(const A&)const=default; deduces weakest category of member types.
व्याख्या (हिन्दी) ऑटो ऑपरेटर(स्थिरांक A&) स्थिरांक=डिफ़ॉल्ट; सदस्य प्रकारों की सबसे कमजोर श्रेणी निकालता है।
92
EN + हिं
GB What is the output: int x=5; x=x>3?(x<10?x*2:x):x/2; cout<
IN आउटपुट क्या है: int x=5; x=x>3?(x
A
10 10
B
5 5
C
2 2
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x>3=true; x<10=true; x=5*2=10. Output: 10.
व्याख्या (हिन्दी) x>3=सत्य; एक्स
93
EN + हिं
GB What is the output: int x=5,y=3; int z=x>y?x-y:y-x; cout<
IN आउटपुट क्या है: int x=5,y=3; int z=x>y?x-y:y-x; अदालत
A
2 2
B
8 8
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x>y: z=5-3=2. Output: 2.
व्याख्या (हिन्दी) x>y: z=5-3=2. आउटपुट: 2.
94
EN + हिं
GB What is the output: int x=5; cout<<(x*2>>1);
IN आउटपुट क्या है: int x=5; cout1);
A
5 5
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5*2=10; 10>>1=5. Output: 5.
व्याख्या (हिन्दी) 5*2=10; 10>>1=5. आउटपुट: 5.
95
EN + हिं
GB What is the output: int x=0b1111; x&=0b1010; cout<
IN आउटपुट क्या है: int x=0b1111; x&=0b1010; अदालत
A
10 10
B
15 15
C
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1111&1010=1010=10. Output: 10.
व्याख्या (हिन्दी) 1111&1010=1010=10. आउटपुट: 10.
96
EN + हिं
GB What is the output: int x=3; cout<<(x|=x<<1);
IN आउटपुट क्या है: int x=3; अदालत
A
7 7
B
6 6
C
3 3
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x<<1=6=110. 3=011. 011|110=111=7. x=7. Output: 7.
व्याख्या (हिन्दी) एक्स
97
EN + हिं
GB What is the output: int x=5,y=5; cout<<(x^=y,y^=x,x^=y);
IN आउटपुट क्या है: int x=5,y=5; अदालत
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) XOR swap of equal values: x=5,y=5. x^=y=0; y^=x=5; x^=y=5. Returns x=5. Output: 5.
व्याख्या (हिन्दी) समान मानों का XOR स्वैप: x=5,y=5. x^=y=0; y^=x=5; x^=y=5. x=5 लौटाता है। आउटपुट: 5.
98
EN + हिं
GB What is the output: int x=5; cout<<(~x+1);
IN आउटपुट क्या है: int x=5; अदालत
A
-5 -5
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ~x=-6; -6+1=-5. Output: -5.
व्याख्या (हिन्दी) ~x=-6; -6+1=-5. आउटपुट:-5.
99
EN + हिं
GB What is the output: int x=10; cout<<(x&1?'O':'E')<<(x>>1);
IN आउटपुट क्या है: int x=10; अदालत
A
E5 E5
B
O5 ओ 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10&1=0: E; 10>>1=5. Output: E5.
व्याख्या (हिन्दी) 10&1=0: ई; 10>>1=5. आउटपुट: E5.
100
EN + हिं
GB What is the output: int a=5,b=10; a^=b^=a^=b; cout<
IN आउटपुट क्या है: int a=5,b=10; a^=b^=a^=b; अदालत
A
105 105
B
510 510
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Multiple modifications of a without sequencing is UB. Output: UB.
व्याख्या (हिन्दी) अनुक्रमण के बिना एक के एकाधिक संशोधन यूबी है। आउटपुट: यूबी.
101
EN + हिं
GB What is the output: int x=100; cout<<(x/=10/=1);
IN आउटपुट क्या है: int x=100; अदालत
A
Compile error संकलन त्रुटि
B
10 10
C
100 100
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10/=1 is not valid (10 is not assignable). Compile error.
व्याख्या (हिन्दी) 10/=1 मान्य नहीं है (10 असाइन करने योग्य नहीं है)। संकलन त्रुटि.
102
EN + हिं
GB What is the output: bool a=true,b=false; a^=b; cout<
IN आउटपुट क्या है: bool a=true,b=false; ए^=बी; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) true^false=true=1. Output: 1.
व्याख्या (हिन्दी) सत्य^झूठा=सत्य=1. आउटपुट: 1.
103
EN + हिं
GB What is the output: int x=5; cout<<((x%2==0)?"even":"odd");
IN आउटपुट क्या है: int x=5; अदालत
A
odd विषम
B
even यहां तक ​​की
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5%2=1!=0: odd. Output: odd.
व्याख्या (हिन्दी) 5%2=1!=0: विषम। आउटपुट: विषम.
104
EN + हिं
GB What is the output: int x=5; cout<<(x&&!x)<<(!x||x);
IN आउटपुट क्या है: int x=5; अदालत
A
01 01
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x&&!x=1&&0=0; !x||x=0||1=1. Output: 01.
व्याख्या (हिन्दी) x&&!x=1&&0=0; !x||x=0||1=1. आउटपुट: 01.
105
EN + हिं
GB What is the output: int x=7; cout<<(x&~(1<<2));
IN आउटपुट क्या है: int x=7; अदालत
A
3 3
B
7 7
C
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1<<2=4=100. ~4=...11111011. 7=111. 111&011=011=3. Output: 3.
व्याख्या (हिन्दी) 1
91–105 of 163