Explore topic-wise MCQs in C++ Programming.

This section includes 7 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 <iostream>
using namespace std;
int main()
{
unsigned long num = 56;
cout << num << oct < return 0;
}

A. 56
B. 70
C. 70 56
D. 56 70
E. None of these
Answer» E. None of these
2.

What is the output of this program?
 #include <iostream>
#include <iomanip>
using namespace std;
void showDate(int mm, int dd, int yy)
{
cout << setfill('0');
cout << setw(2) << mm << '/'
<< setw(2) << dd << '/'
<< setw(4) << yy << endl;
}
int main()
{
showDate(1, 1, 2019);
return 0;
}

A. 01
B. 01
C. 2019
D. 01/01/2019
E. None of these
Answer» E. None of these
3.

What is the use of the function showbase ?

A. Function Argument
B. Indicate the base used
C. Indicate the variable
D. Indicate the base used & variable
E. None of these
Answer» C. Indicate the variable
4.

Which is used for formatting purpose in c++?

A. Vector
B. &
C. Container
D. Whitespace
E. None of these
Answer» E. None of these
5.

What can be improved by formatting the source code?

A. User interface
B. Memory
C. Address
D. All of above
E. None of these
Answer» D. All of above
6.

How many number of spaces should be set in default tab?

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

Which function allows you to set minimum width for the next input?

A. setwidth
B. setfill
C. setw
D. All of above
E. None of these
Answer» D. All of above