What happens when you attempt to compile and run the following code? #include <iostream> #include <set> #include <list> using namespace std; int main(){ int t[] = { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 }; list<int> v(t, t+10); set<int> s1(v.begin(),v.end()); if (s1.count(3) == 2) { s1.erase(3); } for(set<int>::iterator i=s1.begin();i!= s1.end(); i++) { cout<<*i<<" "; } return 0; }
Answer(s): A
What happens when you attempt to compile and run the following code? #include <vector> #include <iostream> #include <algorithm> #include <functional> using namespace std; template<class T>struct Out { ostream & out; Out(ostream & o): out(o){} void operator() (const T & val ) { out<<val<<" "; } }; int Add(int a, int b) { return a+b; } int main() { int t[]={1,2,3,4,5,6,7,8,9,10}; vector<int> v1(t, t+10); vector<int> v2(10); transform(v1.begin(), v1.end(), v2.begin(), bind2nd(ptr_fun (Add),1)); vector<int>::iterator it = find_if(v2.begin(), v2.end(),bind2nd(equal_to<int>(),10)); cout<<*it<<endl; return 0; }Program outputs:
Answer(s): C
What happens when you attempt to compile and run the following code? #include <iostream> #include <algorithm> #include <vector> #include <deque> using namespace std; void myfunction(int i) { cout << " " << i; } int main() { int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 }; deque<int> d1(t, t+10); vector<int> v1(d1.rbegin(), d1.rend()); sort(d1.begin(), d1.end()); swap_ranges(v1.begin(), v1.end(), d1.begin()); for_each(v1.begin(), v1.end(), myfunction); for_each(d1.begin(), d1.end(), myfunction); return 0; }Program outputs:
Answer(s): D
What happens when you attempt to compile and run the following code? #include <vector> #include <iostream> #include <algorithm> using namespace std; template<class T>struct Out { ostream & out; Out(ostream & o): out(o){} void operator() (const T & val ) { out<<val<<" "; } }; int main() { int t1[]={3,2,4,1,5}; int t2[]={5,6,8,2,1}; vector<int> v1(10); sort(t1, t1+5); sort(t2, t2+5); set_union(t1,t1+5,t2,t2+5,v1.begin()); for_each(v1.begin(), v1.end(), Out<int>(cout));cout<<endl; return 0; }Program outputs:
What happens when you attempt to compile and run the following code? #include <vector> #include <iostream> #include <algorithm> using namespace std; template<class T>struct Out { ostream & out; Out(ostream & o): out(o){} void operator() (const T & val ) { out<<val<<" "; } }; int main() { int t[]={3,2,4,1,5,10,9,7,8,6}; vector<int> v1(t,t+10); sort(v1.begin(), v1.end(), greater<int>()); cout<<min_element(v1.begin(), v1.end()); return 0; }Program outputs:
Answer(s): E
Post your Comments and Discuss C++ Institute CPP exam dumps with other Community members:
ajlanemed Commented on July 31, 2025 thank you for your help ! SWITZERLAND
Anonny Commented on July 31, 2025 Will check after I complete Anonymous
Cindy Commented on July 31, 2025 SC-401 was definitely one of the tougher exams I’ve taken. The premium version of this exam dumps pdf exam dumps pdf really helped me pass. EUROPEAN UNION
Anonymous Commented on July 31, 2025 Helpful and realistic question exam dumps pdf for preparing for PSM1 exam. HONG KONG
yash Commented on July 31, 2025 this is nice set of questions which help on getting your topic understand more clearly Anonymous
LMB Commented on July 31, 2025 Question 55 is: NO YES YES GERMANY
Sanjay Commented on July 31, 2025 Awesome exam dump. Helped in the passing the exam Anonymous
Sanjay Commented on July 31, 2025 THis is awesome exam dump. It matched most of the questions in the exam Anonymous
G Commented on July 31, 2025 Most of the answers here are accurate AUSTRALIA
G Commented on July 31, 2025 Very helpful exam dumps pdf for higher success rates AUSTRALIA
pooja Commented on July 31, 2025 I am reading these questions and found them really helpful to understand . Anonymous
Pooja Commented on July 31, 2025 Very nice set of questions for preparation of AZ-104 Anonymous
Den Commented on July 30, 2025 answers have explanation which really helps to understand the topic Anonymous