Searching for workable clues to ace the C++ Institute CPP Exam? You’re on the right place! ExamCert has realistic, trusted and authentic exam prep tools to help you achieve your desired credential. ExamCert’s CPP PDF Study Guide, Testing Engine and Exam Dumps follow a reliable exam preparation strategy, providing you the most relevant and updated study material that is crafted in an easy to learn format of questions and answers. ExamCert’s study tools aim at simplifying all complex and confusing concepts of the exam and introduce you to the real exam scenario and practice it with the help of its testing engine and real exam dumps
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include <algorithm>
#include
using namespace std;
template
public:
B(T v):val(v){}
T getV() const {return val;} };
template
template
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) { out<<val<<" "; } };
string tolower(const string & s) {
string tmp(s);
for(unsigned i = 0; i< tmp.size(); ++i){
tmp[i] = tolower(tmp[i]); }
return tmp; }
bool Less(const B
return tolower(a.getV()) 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<<endl; return 0; } Program outputs:
What happens when you attempt to compile and run the following code?
#include
using namespace std;
template
void f(A a)
{
cout<<1<<endl;
}
void f(int a)
{
cout<<2<<endl;
}
int main()
{
int a = 1;
f
return 0;
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main ()
{
std::vector
v1.push_back(10);
return 0;
}
What happens when you attempt to compile and run the following code?
#include
#include <algorithm>
#include
using namespace std;
void myfunction(int i) {
cout << " " << i;
}
void multiply (int a) {
a*2;
}
int main() {
int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 };
vector
for_each(v1.begin(), v1.end(), multiply);
iter_swap(v1.begin(),t+9);
for_each(v1.begin(), v1.end(), myfunction);
return 0;
}
Program outputs:
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main ()
{
int t[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
vector
deque
deque
d2 = d1;
d2.insert(d1.rbegin(), 10);
for(int i = 0; i { cout<<d1[i]<<" "; } return 0; }
What happens when you attempt to compile and run the following code?
#include
#include
#include <algorithm>
using namespace std;
template
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) { out<<val<<" "; } };
struct Add {
int operator()(int & a, int & 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(), bind2nd(Add(),1));
for_each(v2.rbegin(), v2.rend(), Out
return 0;
}
Program outputs:
What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: one two three
#include
#include
using namespace std;
int main ()
{
string a;
cin>>a;
cout<<a<<endl;
return 0;
}
Program will output:
What happens when you attempt to compile and run the following code?
#include
#include <algorithm>
#include
#include
#include
using namespace std;
struct display {
void operator() (int i) {cout << " " << i;}
};
int main() {
int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 };
vector
deque
set
for_each(v1.begin(), v1.end(), display); //Line I
for_each(d1.begin(), d1.end(), *(new display())); // Line II
for_each(s1.begin(), s1.end(), display()); // Line III
return 0;
}