What will happen when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
template
while (start != end) {
std::cout << *start << " "; start++;
}
}
int main(){
vector
set
for(int i=10; i>0; i??) {
v.push_back(i);
s.push_back(i);
}
print(v.begin(), v.end()); print(s.begin(), s.end());cout< return 0; } A. 10 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10 B. 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1 C. 10 9 8 7 6 5 4 3 2 1 and unpredictable sequence of number range 1 to 10 D. compilation error
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main ()
{
int t[] = {1, 2 ,3 ,4 ,5, 6 , 7, 8 , 9, 10};
vector
deque
vector
deque
d1.erase(it2+5);
it2 = d1.begin();
cout<<*(it2+5)<<" ";
v1.erase(it1+5);
it1 = v1.begin();
cout<<*(it1+5)< } A. program outputs: 7 7 B. program outputs: 6 6 C. compilation error D. result is unpredictable
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
using namespace std;
template
ostream and out;
Out(ostream and o): out(o){}
void operator() (const T and val ) { out< int main() { int t[]={8, 10, 5, 1, 4, 6, 2, 7, 9, 3}; int t1[]={1,2,3,4}; deque set sort(d1.begin(), d1.end()); cout< < return 0; } Program outputs: A. 1 1 B. 1 0 C. 0 1 D. 0 0
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
using namespace std;
void myfunction(int i) {
cout << " " << i;
}
int main() {
int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 };
set
vector
swap(s1, v1);
for_each(v1.begin(), v1.end(), myfunction);
for_each(s1.begin(), s1.end(), myfunction);
return 0;
}
Program outputs:
A. 10 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10
B. compilation error
C. 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
D. 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
using namespace std;
void myfunction(int i) {
cout << " " << i;
}
int main() {
vector
fill(v1.begin()+2, v1.end()?2,2);
fill_n(v1.begin()+4,2,3);
for_each(v1.begin(), v1.end(), myfunction);
return 0;
}
Program outputs:
A. 1 1 2 2 3 3 2 2 1 1
B. 1 1 2 2 2 2 2 2 1 1
C. compilation error
D. none of these
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
int main() {
int t[] = { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
string s[] = { "one", "one", "two", "two", "three","three", "four", "four", "five", "five"};
multimap
for (int i = 0; i < 10; i++) {
m.insert(pair
}
if (m.count(3) == 2) {
m.erase(3);
}
for (multimap
cout << i?>first << " ";
}
return 0;
}
A. program outputs: 1 2 3 4 5
B. program outputs: 1 2 4 5
C. program outputs: 1 1 2 2 3 4 4 5 5
D. program outputs: 1 1 2 2 4 4 5 5
E. program outputs: one two three four five
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
#include
using namespace std;
template
public:
B(T v):val(v){}
T getV() const {return val;} };
template template ostream and out; Out(ostream and o): out(o){} void operator() (const T and val ) { out< string tolower(const string and s) { string tmp(s); for(unsigned i = 0; i< tmp.size(); ++i){ tmp[i] = tolower(tmp[i]); } return tmp; } bool Less(const B int main() { string t[]={"aaa","bbb","Aaa", "Bbb","aAa","bBb","aaA","bbB"}; vector > v1; v1.assign(t, t+8); stable_sort(v1.begin(), v1.end(), Less); for_each(v1.begin(), v1.end(), Out >(cout));cout< return 0; } Program outputs: A. Aaa aaa aAa aaA bbb Bbb bBb bbB B. Aaa aaa aAa aaA bbb Bbb bbB bBb C. aaa Aaa aAa aaA bbb Bbb bBb bbB D. the exact output is impossible to determine
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main(){
int second[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 10 };
string first[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight"," ten"};
multimap
for(int i=0; i<10; i++) {
m.insert(pair
}
if (m[11] == "eleven") {
cout<<"eleven ";
}
for(multimap
cout<second<<" ";
}
cout< return 0; } A. program outputs: one two three four five six seven eight nine ten 11 B. program outputs: one two three four five six seven eight nine ten 10 C. program outputs: one two three four five six seven eight nine ten 10 D. program outputs: eleven one two three four five six seven eight nine ten 10 E. 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(Add(),1)); for_each(v2.rbegin(), v2.rend(), Out return 0; } Program outputs: A. 1 2 3 4 5 6 7 8 9 10 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
#include
using namespace std;
int main ()
{
int t[] = {1, 2 ,3 ,4 ,5, 6 , 7, 8 , 9, 10};
vector
deque
d1.empty();
v1.empty();
if (v1.isempty())
{
cout<<"I am empty ";
}
else
{
cout<<"I am not empty ";
}
cout< return 0; } A. program outputs: I am empty 0 0 B. program outputs: I am not empty 0 0 C. compilation error D. program outputs: I am not empty 10 10
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 exam preparations and C++ Institute certification application, do not hesitate to visit our Vcedump.com to find your solutions here.