What will happen when you attempt to compile and run the following code?
#include
#include
#include
#include
#include
using namespace std;
int main() {
int t[] = { 3, 4, 2, 1, 0, 3, 4, 1, 2, 0 };
vector
multimap
for (vector
stringstream s;s << *i << *i;
m.insert(pair
}
pair
range = m.equal_range(2);
for (multimap
cout << i?>first << " ";
}
return 0;
}
The output will be:
Answer : A
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
cout< return 0; } Program outputs:
Answer : C
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
#include
using namespace std;
int main(){
int t[] ={ 3, 4, 2, 1, 0, 1, 2, 3, 4, 0 };
vector
multimap
for(vector
stringstream s; s<<*i<<*i; m.insert(pair
}
for(multimap
cout<<*i<<" ";
}
return 0;
}
Answer : E
What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: true false
#include
#include
using namespace std;
int main ()
{
bool a,b;
cin>>boolalpha>>a>>b;
Answer : D
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
template
ostream & out;
Out(ostream & o): out(o){}
void operator()(const T & 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 generate(v1.begin(), v1.end(), Sequence(1)); partition(v1.begin(),v1.end(), Odd()); for_each(v1.begin(), v1.end(), Out return 0; } Choose all possible outputs:
Answer : C, D, E
What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: 1 2 3 4 quit
#include
#include
#include
#include
using namespace std;
template
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) {out< int main () { list while(cin.good()) { string s; cin>>s; if (s == "quit") break; l.push_back(s); } for_each(l.begin(), l.end(), Out return 0; } Program will output:
Answer : A
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main() {
int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 };
map
for(int i=0; i < 10; i++) {
m[i]=t[i];
}
map
cout<
return 0;
}
Program outputs:
Answer : D