91. What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool IsOdd (int i)
{
return (i%2)==1;
}
int main ()
{
vector<int> v;
for (int i=1; i<=10; ++i)
v.push_back(i);
vector<int>::iterator bound;
bound = partition (v.begin(), v.end(), IsOdd);
for (vector<int>::iterator it=v.begin(); it!=bound; ++it)
cout << ' ' << *it;
cout << '\n';
for (vector<int>::iterator it=bound; it!=v.end(); ++it)
cout << ' ' << *it;
cout << '\n';
return 0;
}
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool IsOdd (int i)
{
return (i%2)==1;
}
int main ()
{
vector<int> v;
for (int i=1; i<=10; ++i)
v.push_back(i);
vector<int>::iterator bound;
bound = partition (v.begin(), v.end(), IsOdd);
for (vector<int>::iterator it=v.begin(); it!=bound; ++it)
cout << ' ' << *it;
cout << '\n';
for (vector<int>::iterator it=bound; it!=v.end(); ++it)
cout << ' ' << *it;
cout << '\n';
return 0;
}92. Which of the following is correct about the second parameter of the main function?
93. What will be the output of the following C++ code?
#include <iostream>
#include <complex>
using namespace std;
int main()
{
complex <double> cn(3.0, 5.0);
cout<<"Complex number with magnitude "<<abs(cn)<<"
and phase angle "<<arg(cn)<<" is:
"<<polar(abs(cn), arg(cn))<<endl;
return 0;
}
#include <iostream>
#include <complex>
using namespace std;
int main()
{
complex <double> cn(3.0, 5.0);
cout<<"Complex number with magnitude "<<abs(cn)<<"
and phase angle "<<arg(cn)<<" is:
"<<polar(abs(cn), arg(cn))<<endl;
return 0;
}94. How many types of container classes are there in c++?
95. What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool IsOdd (int i)
{
return (i % 2) == 1;
}
int main ()
{
vector<int> myvector;
for (int i = 1; i < 10; ++i) myvector.push_back(i);
vector<int> :: iterator bound;
bound = partition (myvector.begin(), myvector.end(), IsOdd);
for (vector<int> :: iterator it = myvector.begin(); it != bound; ++it)
cout << ' ' << *it;
return 0;
}
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool IsOdd (int i)
{
return (i % 2) == 1;
}
int main ()
{
vector<int> myvector;
for (int i = 1; i < 10; ++i) myvector.push_back(i);
vector<int> :: iterator bound;
bound = partition (myvector.begin(), myvector.end(), IsOdd);
for (vector<int> :: iterator it = myvector.begin(); it != bound; ++it)
cout << ' ' << *it;
return 0;
}96. Which header file is required to use complex class in your program?
97. What will be the output of the following C++ code?
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int ran = rand();
cout << ran << endl;
}
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int ran = rand();
cout << ran << endl;
}98. Which of the following is correct about shift() and cshift()?
1. shift() makes some values of Valarray equal to 0 after shifting by a non-zero number
2. cshift() makes some values of Valarray equal to 0 after shifting by a non-zero number
1. shift() makes some values of Valarray equal to 0 after shifting by a non-zero number
2. cshift() makes some values of Valarray equal to 0 after shifting by a non-zero number
99. What kind of object is modifying sequence algorithm?
100. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main ()
{
int n;
n = -77;
cout.width(4);
cout << internal << n << endl;
return 0;
}
#include <iostream>
using namespace std;
int main ()
{
int n;
n = -77;
cout.width(4);
cout << internal << n << endl;
return 0;
}Read More Section(C plus plus miscellaneous)
Each Section contains maximum 100 MCQs question on C plus plus miscellaneous. To get more questions visit other sections.
- C plus plus miscellaneous - Section 1
- C plus plus miscellaneous - Section 2
- C plus plus miscellaneous - Section 4
- C plus plus miscellaneous - Section 5
- C plus plus miscellaneous - Section 6
- C plus plus miscellaneous - Section 7
- C plus plus miscellaneous - Section 8
- C plus plus miscellaneous - Section 9
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11
