What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main(){
int myints[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };
vector
set
set
for(set
cout<<*i<<" ";
}
for(set
cout<<*i<<" ";
}
cout< return 0; }
B. program outputs: 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
C. program outputs: 0 1 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 1 0
D. program outputs: 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9
What will happen when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main(){
int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };
vector
set
s1.insert(v.begin(),v.end());
pair
range = s1.equal_range(6);
cout<<*range.first<<" "<<*range.second< return 0; } The output will be:
B. 5 7
C. 6 7
D. 1 5
E. 6 5
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
void print(int v) { cout< struct Sequence { int start; Sequence(int start):start(start){} int operator()() { return 10*(1+(start++ %3)); } }; int main() { vector generate_n(v1.begin(), 10, Sequence(1)); remove(v1.begin(), v1.end(), 10); for_each(v1.begin(), v1.end(), print);cout< return 0; } Program outputs:
B. 20 30 20 30 20 30 20
C. 20 30 20 30 20 30 20 30 10 20
D. compilation error
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
template
ostream and out;
Out(ostream and o): out(o){}
void operator() (const T and val ) { out< struct Add { int operator()(int and a, int and b) { return a+b; } }; int main() { int t[]={1,2,3,4,5,6,7,8,9,10}; vector vector transform(v1.begin(), v1.end(), v2.begin(), bind1st(1,Add())); for_each(v2.rbegin(), v2.rend(), Out return 0; } Program outputs:
B. 2 3 4 5 6 7 8 9 10 11
C. 10 9 8 7 6 5 4 3 2 1
D. 11 10 9 8 7 6 5 4 3 2
E. compilation error
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
template
class A {
T_v;
public:
A() {}
A(T v): _v(v){}
T getV() { return _v; }
void add(T and a);
void add(string and a);
};
template
void A
void A
_v.insert(0, a);
}
int main()
{
A
string s(" world!");
a.add(s);
cout << a.getV() < return 0; }
B. compilation error
C. program will display: world!Hello
D. program will run without any output
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main(){
int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };
multiset
s1.insert(s1.find(7), 3);
for(multiset
cout<<*i<<" ";
}
return 0;
}
A. program outputs: 0 1 2 3 3 4 5 6 7 8 9What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
template
int calculate(T start, T end)
{
int s = 0;
while (start != end)
s+= *start; start++;return s;
}
int main ()
{
int t[] = {1, 2 ,3 ,4 ,5, 6 , 7, 8 , 9, 10};
vector
deque
cout< cout< cout< cout< cout< return 0; }
B. runtime exception
C. program outputs 55 5 17 55
D. program outputs 55 5 17 0
What happens when you attempt to compile and run the following code? #include
#include
#include
using namespace std;
template
ostream and out;
Out(ostream and o): out(o){}
void operator()(const T and val ) { out< }; struct Sequence { int start; Sequence(int start):start(start){} int operator()() { return start++; } }; struct Odd { bool operator()(int v) { return v%2==0; } }; int main() { vector vector generate(v1.begin(), v1.end(), Sequence(1)); stable_partition(v1.begin(),v1.end(), Odd()); for_each(v1.begin(), v1.end(), Out return 0; } Program outputs:
B. 5 7 3 9 1 10 2 8 4 6
C. 10 2 8 4 6 5 7 3 9 1
D. 4 6 8 10 2 7 5 3 1 9
E. 2 4 6 8 10 1 3 5 7 9
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
cout.setf(ios::oct, ios::basefield);
cout<<100<<" ";
cout.setf(ios::showbase);
cout<<100<<" ";
return 0;
}
Program outputs:
A. 144 0144What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
template
ostream and out;
Out(ostream and o): out(o){}
void operator()(const T and val ) {
out< } }; struct Sequence { int start; Sequence(int start):start(start){} int operator()() { return start++; } }; int main() { vector vector generate(v1.begin(), v1.end(), Sequence(1)); random(v1.begin(),v1.end()); for_each(v1.begin(), v1.end(), Out return 0; } Program outputs:
B. 10 9 8 7 6 5 4 3 2 1
C. 8 2 4 9 5 7 10 6 1 3
D. compilation error
Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only C++ Institute exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your CPP-22-02 exam preparations and C++ Institute certification application, do not hesitate to visit our Vcedump.com to find your solutions here.