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>
#include <vector>
using namespace std;
int main()
{
vector<int> vect;
vect.assign( 5, 50 );
for (int k = 0; k < vect.size(); k++)
{
cout << vect[k] << " ";
}
}

A. 50
B. 50 50
C. 50 50 50
D. 50 50 50 50
E. 50 50 50 50 50
Answer» F.
2.

What is the output of this program?
#include <iostream>
#include <list>
#include <queue>
using namespace std;
int main()
{
queue<char> que;
que.push('I');
que.push('L');
que.push('U');
cout << que.front() << " ";
que.pop();
cout << que.front() << " ";
que.pop();
cout << que.front();
que.pop();
}

A. L U I
B. I U L
C. L I U
D. I L U
E. None of these
Answer» E. None of these
3.

Pick out the wrong header file about strings.

A. <ios>
B. <string>
C. <regex>
D. All of above
E. None of these
Answer» B. <string>
4.

What is meant by standard c++ library?

A. It is a header file
B. Collection of algorithms
C. It is the collection of class definitions for standard data structures and a collection of algorithms
D. All of above
E. None of these
Answer» D. All of above
5.

What is the use of header

A. It is used to arise an exception in the program
B. Contains the standard library files
C. Contains the standard exception files
D. All of above
E. None of these
Answer» D. All of above
6.

Pick out parameter for rehash method in unordered_set in c++?

A. hash
B. count
C. size
D. All of above
E. None of these
Answer» C. size
7.

Pick out the wrong header file.

A. <process>
B. <iterators>
C. <containers>
D. <algorithm>
E. None of these
Answer» B. <iterators>