Free CPP Exam Braindumps (page: 11)

Page 11 of 58

Which pieces of code inserted independently into places marked 1 and 2 will cause the program to compile and display: 0 1 2 3 4 5 6 7 8 9? Choose all that apply.

#include <list>
#include <iostream>
using namespace std;
class A { int a; public:
A(int a){ this?>a=a;}
//insert code here 1
};
//insert code here 2
template<class T> void print(T start, T end) {
while (start != end) {
std::cout << *start << " "; start++;
}
}
int main() {
A t1[] = { 1, 7, 8, 4, 5 }; list<A> l1(t1, t1 + 5);
A t2[] = { 3, 2, 6, 9, 0 }; list<A> l2(t2, t2 + 5);
l1.sort(); l2.sort(); l1.merge(l2);
print(l1.begin(), l1.end());
print(l2.begin(), l2.end()); cout<<endl;
return 0;
}

  1. place 1: operator int() { return a; }
  2. place 1: operator int() { return a; }
    bool operator < (const A & b) { return this?>a< b.a;}
  3. place 1: bool operator < (const A & b) { return this?>a< b.a;}
  4. place 1: bool operator < (const A & b) { return this?>a< b.a;}
    friend ostream & operator <<(ostream & c, const A & a);
    place 2: ostream & operator <<(ostream & c, const A & a) { c<<a.a; return c;}
  5. place 1: bool operator < (const A & b) { return this?>a< b.a;}
    place 2: ostream & operator <<(ostream & c, const A & a) { c<<a.a; return c;}

Answer(s): A,B,D



What happens when you attempt to compile and run the following code?

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main () {
int t[] = {1,2,3,4,5,1,2,3,4,5};
vector<int> v (t,t+10);
vector<int>::iterator it;
int m1[] = {1, 2, 3};
it = search (v.begin(), v.end(), m1, m1+3);
cout << "found at position: " << it?v.begin() << endl;
return 0;
}

Program outputs:

  1. found at position: 5
  2. found at position: 0
  3. found at position: 6
  4. found at position: 1
  5. found at position: 10

Answer(s): B



What happens when you attempt to compile and run the following code?

#include <deque>
#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<<" "; } };
struct Sequence { int start;
Sequence(int start):start(start){}
int operator()() {return 10*(1+(start++ %3));}
};
int main() {
deque<int> d1(10);
generate(d1.begin(), d1.end(), Sequence(1));
sort(d1.begin(), d1.end());
pair<deque<int>::iterator, deque<int>::iterator > result = equal_range(d1.begin(), d1.end(), 20);
for_each(result.first, result.second, Out<int>(cout));cout<<endl;
return 0;
}

Program outputs:

  1. 10 10 10 20 20 20 20 30 30 30
  2. 20 20 20 20
  3. 10 20 20 20 20
  4. 20 20 20 20 30
  5. 10 20 20 20 20 30

Answer(s): B



Which changes, introduced independently, will allow the code to compile and display “one” “eight” “nine” “ten”? Choose all that apply

#include <iostream>
#include <map>
#include <string>
using namespace std;
class A {
int a;
public:
A(int a):a(a){}
int getA() const { return a;}
/* Insert Code Here 1 */
};
/* Insert Code Here 2 */

int main(){
int t[] = { 3, 4, 2, 1, 6, 5, 7, 9, 8, 10 };
string s[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight","ten"};
map<A, string> m; /* Replace Code Here 3 */
for(int i=0; i<10; i++) {
m.insert(pair<A,string>(A(t[i]),s[i]));
}
m.erase(m.lower_bound(2),m.upper_bound(7));
map<A, string>::iterator i=m.begin(); /* Replace Code Here 4 */
for( ;i!= m.end(); i++) {
cout<<i?>second<<" ";
}
cout<<endl;
return 0;
}

  1. operator int() const { return a;} inserted at Place 1
  2. bool operator < (const A & b) const { return a<b.a;} inserted at Place 1
  3. bool operator < (const A & b) const { return b.a<a;} inserted at Place 1
  4. struct R { bool operator ()(const A & a, const A & b) { return a.getA()<b.getA();} }; inserted at Place 2
    replacing line marked 3 with map<A, string, R> m;
    replacing line marked 4 with map<A, string,R>::iterator i=m.begin();

Answer(s): A,B,D



Page 11 of 58



Post your Comments and Discuss C++ Institute CPP exam with other Community members:

Paula commented on November 06, 2024
Useful question dumps. I will leave it to that.
Anonymous
upvote

Prabhat Kumar commented on November 06, 2024
Google Google Associate Cloud Engineer
EUROPEAN UNION
upvote

Connor commented on November 06, 2024
This is wild. I did not know these study guides were available online.
UNITED KINGDOM
upvote

Mike commented on November 05, 2024
can anyone explain to me for question 77?
MALAYSIA
upvote

Non-sus user commented on November 05, 2024
good luck y'all
MALAYSIA
upvote

Jondré commented on November 05, 2024
I am writing soon hope this will help me pass first time.
Anonymous
upvote

Farid commented on November 05, 2024
This exam is hard but not as bad as others have stated here. With these question you can pass on first try.
Canada
upvote

Mohammed commented on November 05, 2024
I got a 87.4% in my exam with these questions. Just keep in mind that the full version they sell in PDF format has way way more questions that covers most of the topics in this exam.
UNITED ARAB EMIRATES
upvote

Giordano commented on November 05, 2024
Sono uguali all'esame?
Anonymous
upvote

Luntz commented on November 05, 2024
If you want to just prepare for your exam and then clear it then this is a good source. But not for deep learning.
GERMANY
upvote

Gutsy commented on November 05, 2024
Pretty clear and close to content of real exam.
UNITED STATES
upvote

Nansi commented on November 05, 2024
hope for the best
Anonymous
upvote

Amelio commented on November 04, 2024
Big win for me this week. I passed my exam and now getting ready for my second exam.
UNITED STATES
upvote

Jeeva commented on November 04, 2024
Still preparing to attend
Anonymous
upvote

Nikki Cruz commented on November 04, 2024
This was a life saver for me. I knew the material but these questions really helped me . Passed on my first attempt !
Anonymous
upvote

Emmanuel commented on November 04, 2024
Can a person pass AZ900 just by using this site only ?
SOUTH AFRICA
upvote

Tech Savvy commented on November 04, 2024
Great work team!, would be good if you list 10 questions at each page,
Anonymous
upvote

Jay commented on November 04, 2024
I tried to clear this exam for 3 times but failed. So I finally resorted to using these exam dumps which I really did not want to. But I was left with no choice.
New Zealand
upvote

Fernando commented on November 04, 2024
Very cool and very helpful. Bought 2 exams with 50% discount.
Brazil
upvote

Jai commented on November 03, 2024
I liked the questions
Anonymous
upvote

Sumitra commented on November 03, 2024
I am eager to write CAD exam
Anonymous
upvote

Veitnam commented on November 03, 2024
Thank you the website owner for making these exam questions available for free. It helped me clear my paper.
Anonymous
upvote

Anonymous commented on November 03, 2024
Can I pass the exams only with these dumps ?
Anonymous
upvote

Bin Mahamood commented on November 03, 2024
terraform { required_providers { aws = { version = ">= 2.7.0" source = "hashicorp/aws" } } }
Anonymous
upvote

Yizzy commented on November 02, 2024
@Patak when did you take the exam?
Anonymous
upvote

Tadele commented on November 02, 2024
Help full to next exam
Anonymous
upvote

Jaqulin commented on November 02, 2024
I appreciate the service and the questions being free. Finally something free in this world.
FRANCE
upvote

numan commented on November 02, 2024
really helping
GERMANY
upvote

Patak commented on November 01, 2024
I got about 70 to 74 questions are from here. So its worth it.
INDIA
upvote

xxx commented on November 01, 2024
I've used this material for exam preps. Many questions comes from this dump.
ESTONIA
upvote

Timens commented on November 01, 2024
Well done and nicely put together. All valid questions in PDF version.
Netherlands
upvote

Debendra commented on November 01, 2024
Passed the exam. The best Diwalli present!!! Thank you team for this braindumps.
INDIA
upvote

Tdk commented on November 01, 2024
Great staff
SOUTH AFRICA
upvote

Tdk commented on November 01, 2024
Good material
SOUTH AFRICA
upvote