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
646
EN + हिं
GB What is the output: for(int i=2;i<10;i++) if(i%2==0&&i%3==0) cout<
IN आउटपुट क्या है: for(int i=2;i
A
6 6
B
236 236
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Only 6. Output: 6.
व्याख्या (हिन्दी) केवल 6. आउटपुट: 6.
647
EN + हिं
GB What is the output: for(int i=0;i<5;i++) cout<<(i%2?'-':'+');
IN आउटपुट क्या है: for(int i=0;i
A
+-+-+ +-+-+
B
-+-+- -+-+-
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0:+, 1:-, 2:+, 3:-, 4:+. Output: +-+-+.
व्याख्या (हिन्दी) i=0:+, 1:-, 2:+, 3:-, 4:+. आउटपुट: +-+-+.
648
EN + हिं
GB What is the output: int x=100; int c=0; while(x>0){x/=2;c++;} cout<
IN आउटपुट क्या है: int x=100; पूर्णांक सी=0; while(x>0){x/=2;c++;} cout
A
7 7
B
6 6
C
8 8
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 100->50->25->12->6->3->1->0. 7 steps. Output: 7.
व्याख्या (हिन्दी) 100->50->25->12->6->3->1->0. 7 कदम. आउटपुट: 7.
649
EN + हिं
GB What is the output: for(auto c:'A','B','C') cout<
IN आउटपुट क्या है: for(auto c:'A','B','C') cout
A
Compile error संकलन त्रुटि
B
ABC एबीसी
C
A
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Comma expression; range-for on a char ('C') is invalid. Compile error.
व्याख्या (हिन्दी) अल्पविराम अभिव्यक्ति; चार पर रेंज-फॉर ('सी') अमान्य है। संकलन त्रुटि.
650
EN + हिं
GB What is the output: int x=0; while(++x<5) cout<
IN आउटपुट क्या है: int x=0; जबकि(++x
A
1234 1234
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=1<5:print 1; x=2<5:print 2; x=3<5:print 3; x=4<5:print 4; x=5<5 false. Output: 1234.
व्याख्या (हिन्दी) एक्स=1
651
EN + हिं
GB What is the output: int x=4; switch(x>>1){case 0:cout<<'Z';break;case 1:cout<<'O';break;case 2:cout<<'T';break;}
IN आउटपुट क्या है: int x=4; स्विच(x>>1){केस 0:काउट
A
T टी
B
O हे
C
Z जेड
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 4>>1=2: case 2 prints T. Output: T.
व्याख्या (हिन्दी) 4>>1=2: केस 2 टी प्रिंट करता है। आउटपुट: टी।
652
EN + हिं
GB What is the output: int s=0; for(int i=1;i<=10;i++) s^=i; cout<
IN आउटपुट क्या है: int s=0; for(int i=1;i
A
11 11
C
55 55
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) XOR of 1 to 10: 1^2^3^4^5^6^7^8^9^10=11. Output: 11.
व्याख्या (हिन्दी) 1 से 10 तक का XOR: 1^2^3^4^5^6^7^8^9^10=11. आउटपुट: 11.
653
EN + हिं
GB What is the output: int x=0; for(int i=0;i<4;i++) for(int j=0;j<4;j++) if(i+j==3) x++; cout<
IN आउटपुट क्या है: int x=0; for(int i=0;i
A
4 4
B
3 3
C
6 6
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (0,3),(1,2),(2,1),(3,0): 4 pairs. Output: 4.
व्याख्या (हिन्दी) (0,3),(1,2),(2,1),(3,0): 4 जोड़े। आउटपुट: 4.
654
EN + हिं
GB What is the output: for(int i=1;i<=5;i++) cout<<(i*(i+1)/2);
IN आउटपुट क्या है: for(int i=1;i
A
136 10 15 136 10 15
B
13610 15 13610 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1,3,6,10,15 concatenated: 136 10 15. Without spaces: 136 1015. Output: 1361015.
व्याख्या (हिन्दी) 1,3,6,10,15 संयोजित: 136 10 15. रिक्त स्थान के बिना: 136 1015। आउटपुट: 1361015।
655
EN + हिं
GB What is the output: int n=6; bool isPrime=n>1; for(int i=2;i*i<=n;i++) if(n%i==0){isPrime=false;break;} cout<
IN आउटपुट क्या है: int n=6; बूल isPrime=n>1; for(int i=2;i*i
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 6=2*3. Not prime. isPrime=false=0. Output: 0.
व्याख्या (हिन्दी) 6=2*3. प्रधान नहीं. isPrime=गलत=0. आउटपुट: 0.
656
EN + हिं
GB What is the output: for(int i=0,j=10;i<5;i++,j-=2) cout<
IN आउटपुट क्या है: for(int i=0,j=10;i
A
10 9 8 7 6 10 9 8 7 6
B
1098765 1098765
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0,j=10:10; i=1,j=8:9; i=2,j=6:8; i=3,j=4:7; i=4,j=2:6. Output: 1098 76... concatenated: 1098 76. Without spaces: 109876. Hmm: 10,9,8,7,6 = 109876.
व्याख्या (हिन्दी) i=0,j=10:10; i=1,j=8:9; i=2,j=6:8; i=3,j=4:7; i=4,j=2:6. आउटपुट: 1098 76... संयोजित: 1098 76. रिक्त स्थान के बिना: 109876। हम्म: 10,9,8,7,6 = 109876।
657
EN + हिं
GB What is the output: int x=1; for(int i=0;i<10;i++) x=(x%10)*2; cout<
IN आउटपुट क्या है: int x=1; for(int i=0;i
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1->2->4->8->16%10*2=12... wait: x%10 gives last digit. 1->2->4->8->6(16%10=6,*2=12)->2(12%10=2,*2=4)->4->8->6->2->4. After 10: 4. Hmm, let me recount. Start 1: i=0:2, i=1:4, i=2:8, i=3:6(16%10=6), i=4:2(12%10*2... wait 16%10=6, 6*2=12), i=5:4(12%10=2,2*2=4), i=6:8, i=7:6, i=8:2, i=9:4. Output:4.
व्याख्या (हिन्दी) 1->2->4->8->16%10*2=12... प्रतीक्षा करें: x%10 अंतिम अंक देता है। 1->2->4->8->6(16%10=6,*2=12)->2(12%10=2,*2=4)->4->8->6->2->4। 10:4 के बाद। हम्म, मुझे फिर से गिनने दीजिए। प्रारंभ 1: i=0:2, i=1:4, i=2:8, i=3:6(16%10=6), i=4:2(12%10*2... प्रतीक्षा करें 16%10=6, 6*2=12), i=5:4(12%10=2,2*2=4), i=6:8, i=7:6, i=8:2, i=9:4। आउटपुट:4.
658
EN + हिं
GB What is the output: int x=0; for(int i=1;i<=5;i++) x+=(i%2?i:-i); cout<
IN आउटपुट क्या है: int x=0; for(int i=1;i
A
3 3
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1-2+3-4+5=3. Output: 3.
व्याख्या (हिन्दी) 1-2+3-4+5=3. आउटपुट: 3.
659
EN + हिं
GB What is the output: for(int i=0;i<5;i++) {if(i==2) goto skip; cout<
IN आउटपुट क्या है: for(int i=0;i
A
01 01
B
0123 0123
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0:print 0; i=1:print 1; i=2: goto skip exits loop. Output: 01.
व्याख्या (हिन्दी) मैं=0:प्रिंट 0; मैं=1:प्रिंट 1; i=2: गोटो स्किप एग्जिट लूप। आउटपुट: 01.
660
EN + हिं
GB What is the output: int x=5; cout<<(x==5?x==4?'A':'B':'C');
IN आउटपुट क्या है: int x=5; अदालत
A
B बी
B
A
C
C सी
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x==5=true; inner x==4=false; 'B'. Output: B.
व्याख्या (हिन्दी) x==5=सत्य; आंतरिक x==4=गलत; 'बी'। आउटपुट: बी.
646–660 of 1915