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
571
EN + हिं
GB What is the output: auto t=make_tuple(1,2.0,'A'); cout<(t)<(t);
IN आउटपुट क्या है: auto t=make_tuple(1,2.0,'A'); अदालत
A
1A 1 क
B
12 12
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) get<0>=1, get<2>='A'. Output: 1A.
व्याख्या (हिन्दी) प्राप्त करें = 1, प्राप्त करें = 'ए'। आउटपुट: 1ए.
572
EN + हिं
GB What is 'std::variant::visit'?
IN 'std::variant::visit' क्या है?
A
Calls correct overload for currently held type वर्तमान में रखे गए प्रकार के लिए सही ओवरलोड कॉल करता है
B
Runtime type switch रनटाइम प्रकार स्विच
C
Dynamic dispatch गतिशील प्रेषण
D
Same as get जैसा मिलता है वैसा ही
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::visit(overloaded{...}, v) applies the matching handler for the active type in v.
व्याख्या (हिन्दी) std::visit(overloaded{...}, v) v में सक्रिय प्रकार के लिए मिलान हैंडलर लागू करता है।
573
EN + हिं
GB What is the output: variant v=3.14; cout<(v);
IN आउटपुट क्या है: वैरिएंट v=3.14; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v holds double. holds_alternative(v)=true=1. Output: 1.
व्याख्या (हिन्दी) v दोगुना रखता है। धारक_वैकल्पिक(v)=सत्य=1. आउटपुट: 1.
574
EN + हिं
GB What is the output: int x=5; cout<<(x&1?'O':'E');
IN आउटपुट क्या है: int x=5; अदालत
A
O हे
B
E
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5&1=1: odd. Output: O.
व्याख्या (हिन्दी) 5&1=1: विषम। आउटपुट: ओ.
575
EN + हिं
GB What is the output: int x=12; cout<<(x&(x-1));
IN आउटपुट क्या है: int x=12; अदालत
A
8 8
B
12 12
C
4 4
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 12=1100, 11=1011. AND=1000=8. Output: 8.
व्याख्या (हिन्दी) 12=1100, 11=1011. तथा=1000=8. आउटपुट: 8.
576
EN + हिं
GB What is the output: cout<<(true?1:2.0);
IN आउटपुट क्या है: cout
A
1 1
B
1.0 1.0
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Common type is double. Returns 1.0. Output: 1.
व्याख्या (हिन्दी) सामान्य प्रकार डबल है। रिटर्न 1.0. आउटपुट: 1.
577
EN + हिं
GB What is the output: int x=5; cout<<(!x)<<(!!x)<<(!!!x);
IN आउटपुट क्या है: int x=5; अदालत
A
010 010
B
101 101
C
001 001
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) !5=0, !!5=1, !!!5=0. Output: 010.
व्याख्या (हिन्दी) !5=0, !!5=1, !!!5=0. आउटपुट: 010.
578
EN + हिं
GB What is the output: int a=6,b=3; cout<<(a/=b,a*=b,a);
IN आउटपुट क्या है: int a=6,b=3; अदालत
A
6 6
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a/=3=2, a*=3=6, return a=6. Output: 6.
व्याख्या (हिन्दी) a/=3=2, a*=3=6, वापसी a=6। आउटपुट: 6.
579
EN + हिं
GB What is 'conditional assignment' idiom?
IN 'सशर्त असाइनमेंट' मुहावरा क्या है?
A
x = cond ? a : b; assign based on condition एक्स = शर्त? ए : बी; शर्त के आधार पर असाइन करें
B
Same as if-else यदि-अन्यथा के समान
C
Short-circuit assignment शॉर्ट-सर्किट असाइनमेंट
D
Macro pattern मैक्रो पैटर्न
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Ternary for assignment: x=(n>0)?n:0 is concise conditional assignment.
व्याख्या (हिन्दी) असाइनमेंट के लिए टर्नरी: x=(n>0)?n:0 संक्षिप्त सशर्त असाइनमेंट है।
580
EN + हिं
GB What is the output: int x=0xFF; cout<<(x^=0x0F);
IN आउटपुट क्या है: int x=0xFF; अदालत
A
240 240
B
255 255
C
15 15
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0xFF^0x0F=0xF0=240. Output: 240.
व्याख्या (हिन्दी) 0xFF^0x0F=0xF0=240. आउटपुट: 240.
581
EN + हिं
GB What is the output: int x=5; cout<<(x<<0);
IN आउटपुट क्या है: int x=5; अदालत
A
5 5
C
1 1
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Shift by 0 = no change. Output: 5.
व्याख्या (हिन्दी) 0 से शिफ्ट = कोई परिवर्तन नहीं। आउटपुट: 5.
582
EN + हिं
GB What is the output: int x=5; cout<<(x>3&&x<10);
IN आउटपुट क्या है: int x=5; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5>3=true, 5<10=true. true&&true=1. Output: 1.
व्याख्या (हिन्दी) 5>3=सत्य, 5
583
EN + हिं
GB What is 'safe bool idiom'?
IN 'सुरक्षित बूल मुहावरा' क्या है?
A
Explicit operator bool to prevent implicit numeric conversions अंतर्निहित संख्यात्मक रूपांतरणों को रोकने के लिए स्पष्ट ऑपरेटर बूल
B
A macro एक मैक्रो
C
A template एक टेम्पलेट
D
A design pattern एक डिज़ाइन पैटर्न
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) explicit operator bool() on smart pointers prevents accidental arithmetic like ptr+1.
व्याख्या (हिन्दी) स्मार्ट पॉइंटर्स पर स्पष्ट ऑपरेटर बूल() पीटीआर+1 जैसे आकस्मिक अंकगणित को रोकता है।
584
EN + हिं
GB What is the output: int x=5; auto r=x>3?++x: (1, 6, 73, 3, 4, 'What is the output: int x=8; while(x&(x-1)) x&=x-1; cout<
IN आउटपुट क्या है: int x=5; ऑटो r=x>3?++x: (1, 6, 73, 3, 4, 'आउटपुट क्या है: int x=8; while(x&(x-1)) x&=x-1; cout
A
2026-05-25 2026-05-25
✅ Correct Answer:
585
EN + हिं
GB What is the output: int x=8; while(x&(x-1)) x&=x-1; cout<
IN आउटपुट क्या है: int x=8; जबकि(x&(x-1)) x&=x-1; अदालत
A
8 8
B
4 4
C
1 1
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 8=1000 is already power of 2. 8&7=0: loop doesn't execute. Output: 8.
व्याख्या (हिन्दी) 8=1000 पहले से ही 2 की शक्ति है। 8&7=0: लूप निष्पादित नहीं होता है। आउटपुट: 8.
571–585 of 1915