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
1471
EN + हिं
GB What is the output: unordered_map m; for(int i=1;i<=5;i++) m[i]=i*i; cout<
IN आउटपुट क्या है: unordered_map m; for(int i=1;i
A
9 9
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) m[3]=9. Output: 9.
व्याख्या (हिन्दी) एम[3]=9. आउटपुट: 9.
1472
EN + हिं
GB What is the output: stack s; s.push(1);s.push(2);s.push(3); cout<
IN आउटपुट क्या है: स्टैक एस; एस.पुश(1);एस.पुश(2);एस.पुश(3); अदालत
A
32 32
B
12 12
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) top=3; pop; top=2. Output: 32.
व्याख्या (हिन्दी) शीर्ष=3; जल्दी से आना; शीर्ष=2. आउटपुट: 32.
1473
EN + हिं
GB What is the output: queue q; q.push(1);q.push(2);q.push(3); cout<
IN आउटपुट क्या है: क्यू क्यू; q.पुश(1);q.पुश(2);q.पुश(3); अदालत
A
12 12
B
32 32
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) front=1; pop; front=2. Output: 12.
व्याख्या (हिन्दी) सामने=1; जल्दी से आना; सामने=2. आउटपुट: 12.
1474
EN + हिं
GB What is the output: priority_queue pq; pq.push(3);pq.push(1);pq.push(4);pq.push(2); cout<
IN आउटपुट क्या है: प्राथमिकता_क्यू पीक्यू; pq.push(3);pq.push(1);pq.push(4);pq.push(2); अदालत
A
4 4
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Max heap: top=4. Output: 4.
व्याख्या (हिन्दी) अधिकतम ढेर: शीर्ष=4. आउटपुट: 4.
1475
EN + हिं
GB What is the output: list l={1,2,3,4,5}; l.remove(3); cout<
IN आउटपुट क्या है: सूची l={1,2,3,4,5}; एल.निकालें(3); अदालत
A
4 4
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Remove 3: {1,2,4,5}. size=4. Output: 4.
व्याख्या (हिन्दी) 3 हटाएँ: {1,2,4,5}। आकार=4. आउटपुट: 4.
1476
EN + हिं
GB What is the output: int x=5; cout<<(x>0?to_string(x):"neg");
IN आउटपुट क्या है: int x=5; अदालत
A
5 5
B
neg नकारात्मक
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x>0: to_string(5)="5". Output: 5.
व्याख्या (हिन्दी) x>0: to_string(5)="5". आउटपुट: 5.
1477
EN + हिं
GB What is the output: regex r("\\\\d+"); string s="abc123def"; smatch m; regex_search(s,m,r); cout<
IN आउटपुट क्या है: regex r('\\\\d+'); स्ट्रिंग s='abc123def'; स्मैच एम; regex_search(s,m,r); अदालत
A
123 123
B
abc एबीसी
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) m[0]="123". Output: 123.
व्याख्या (हिन्दी) एम[0]='123'. आउटपुट: 123.
1478
EN + हिं
GB What is the output: auto t=make_tuple(1,string("hi"),3.14); cout<(t)<(t);
IN आउटपुट क्या है: auto t=make_tuple(1,string('hi'),3.14); अदालत
A
1hi 1हाय
B
hi1 नमस्ते1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) get<0>=1, get<1>="hi". Output: 1hi.
व्याख्या (हिन्दी) प्राप्त करें = 1, प्राप्त करें = "हाय"। आउटपुट: 1हाय.
1479
EN + हिं
GB What is the output: pair p={42,"hello"}; cout<
IN आउटपुट क्या है: जोड़ी p={42,"हैलो"}; अदालत
A
425 425
B
42hello 42हैलो
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p.first=42, p.second.size()=5. Output: 425.
व्याख्या (हिन्दी) पी.प्रथम=42, पी.सेकेंड.आकार()=5. आउटपुट: 425.
1480
EN + हिं
GB What is the output: int x=5; auto y=exchange(x,10); cout<
IN आउटपुट क्या है: int x=5; ऑटो y=एक्सचेंज(x,10); अदालत
A
105 105
B
510 510
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) exchange(x,10): returns old=5, sets x=10. Output: 105.
व्याख्या (हिन्दी) एक्सचेंज(x,10): पुराना=5 लौटाता है, x=10 सेट करता है। आउटपुट: 105.
1481
EN + हिं
GB What is the output: optional o=5; cout<
IN आउटपुट क्या है: वैकल्पिक o=5; अदालत
A
55 55
B
50 50
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) value_or(0)=5; !o=false so *o=5. Output: 55.
व्याख्या (हिन्दी) value_or(0)=5; !o=असत्य अतः *o=5. आउटपुट: 55.
1482
EN + हिं
GB What is the output: int x=5; auto& r=x; const auto& cr=x; cout<
IN आउटपुट क्या है: int x=5; ऑटो&r=x; स्थिरांक ऑटो& cr=x; अदालत
A
55 55
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
50 50
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Both read x=5. Output: 55.
व्याख्या (हिन्दी) दोनों x=5 पढ़ते हैं। आउटपुट: 55.
1483
EN + हिं
GB What is the output: volatile int x=5; cout<
IN आउटपुट क्या है: volatile int x=5; अदालत
A
5 5
B
Undefined अपरिभाषित
C
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) volatile doesn't change value; just forces memory read. Output: 5.
व्याख्या (हिन्दी) अस्थिर मूल्य नहीं बदलता है; बस स्मृति को पढ़ने पर मजबूर करता है। आउटपुट: 5.
1484
EN + हिं
GB What is the output: const int x=5; auto y=x; y=10; cout<
IN आउटपुट क्या है: const int x=5; ऑटो y=x; y=10; अदालत
A
510 510
B
55 55
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) auto y=x strips const; y is mutable copy. x=5,y=10. Output: 510.
व्याख्या (हिन्दी) ऑटो y=x स्ट्रिप्स स्थिरांक; y परिवर्तनशील प्रति है। x=5,y=10. आउटपुट: 510.
1485
EN + हिं
GB What is the output: int x=5; decltype(auto) r=x; r=10; cout<
IN आउटपुट क्या है: int x=5; डिक्लटाइप(ऑटो) r=x; आर=10; अदालत
A
5 5
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) decltype(auto) r=x deduces int (not ref, since x is lvalue expression). r is int. r=10 doesn't affect x. Output: 5. Wait: decltype(x) is int, so r is int copy. x=5. Actually decltype(auto) of a plain name is int, not int&. Output: 5.
व्याख्या (हिन्दी) decltype(auto) r=x int को घटाता है (रेफ नहीं, क्योंकि x लैवल्यू एक्सप्रेशन है)। आर पूर्णांक है. r=10 x को प्रभावित नहीं करता. आउटपुट: 5. प्रतीक्षा करें: decltype(x) int है, इसलिए r int कॉपी है। एक्स=5. वास्तव में सादे नाम का डिक्लटाइप (ऑटो) int है, int& नहीं। आउटपुट: 5.
1471–1485 of 1915