Explore topic-wise MCQs in C++ Programming.

This section includes 3 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the output of this program?
#include 
using namespace std;
int main()
{
int k;
for (k = 0; k < 20; k++);
{
cout << k;
}
return 0;
}

A. 0
B. 20
C. Compilation Error
D. Runtime Error
E. None of these
Answer» C. Compilation Error
2.

What is the output of this program?
#include 
using namespace std;
int main()
{
int num = 20;
for ( ; ;)
cout << num;
return 0;
}

A. 20
B. Compilation Error
C. Runtime Error
D. infinite times of printing num
E. None of these
Answer» E. None of these
3.

How many types of loops are there?

A. 1
B. 2
C. 3
D. 4
E. None of these
Answer» E. None of these