Weekend Sale - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sntaclus

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

#include

#include

#include

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"};

multimap m;/* Replace Code Here 3 */

for(int i=0; i<10; i++) {

m.insert(pair(A(t[i]),s[i]));

}

m.erase(m.lower_bound(2),m.upper_bound(7));

multimap::iterator i=m.begin();/* Replace Code Here 4 */

for( ; i!= m.end(); i++) {

cout<second<<" ";

}

cout<

return 0;

}

A.

operator int() const { return a;} inserted at Place 1

B.

bool operator < (const A & b) const { return a

C.

bool operator < (const A & b) const { return b.a

D.

struct R { bool operator ()(const A & a, const A & b) { return a.getA()

replacing line marked 3 with multimap m;

replacong line marked 4 with multimap::iterator i=m.begin();

What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: 64 100?

#include

#include

#include

#include

using namespace std;

int main ()

{

string s;

getline(cin, s);

stringstream input(s);

stringstream output;

for( ; !input.fail() ; )

{

int i;

input>>hex>>i;

output<

}

cout<

return 0;

}

What will be the result assuming that user will enter following sequence: 64 100:

A.

64 100

B.

100 256

C.

100 256 256

D.

0x64 0x100

E.

0x100 0x256 0x256

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

#include

using namespace std;

int main()

{

cout<

return 0;

}

Program outputs:

A.

true false

B.

1 0

C.

1 false

D.

true 0

E.

compilation error

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

#include

#include

#include

using namespace std;

class B { int val;

public:

B(int v):val(v){}

int getV() const {return val;} bool operator < (const B & v) const { return val

ostream & operator <<(ostream & out, const B & v) { out<

templatestruct Out {

ostream & out;

Out(ostream & o): out(o){}

void operator() (const T & val ) { out<

int main() {

int t[]={8, 10, 5, 1, 4, 6, 2, 7, 9, 3};

deque d1(t, t+10);

sort(d1.begin(), d1.end());

deque::iterator it = upper_bound(d1.begin(), d1.end(), B(4));

for_each(it, d1.end(), Out(cout)); cout<

return 0;

}

Program outputs:

A.

5 6 7 8 9 10

B.

4 5 6 7 8 9 10

C.

6 7 8 9 10

D.

1 2 3 4 5

E.

1 2 3 4

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

#include

#include

#include

using namespace std;

templatestruct Out {

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++; } };

int main() {

vector v1(10);

vector v2(10);

generate(v1.begin(), v1.end(), Sequence(1));

reverse_copy(v1.begin(),v1.end(), v2.rbegin());

sort(v2.begin(), v2.end(), less_equal());

for_each(v2.begin(), v2.end(), Out(cout) );cout<

return 0;

}

Program outputs:

A.

1 2 3 4 5 6 7 8 9 10

B.

10 9 8 7 6 5 4 3 2 1

C.

no output

D.

compilation error

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

#include

using namespace std;

void g(int a)

{

cout<

}

template

void g(A a)

{

cout<

}

int main()

{

int a = 1;

g(a);

return 0;

}

A.

program displays: 0

B.

program displays: 2

C.

compilation error

D.

runtime exception

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

#include

#include

#include

#include

using namespace std;

bool identical(int a, int b) {

return b == 2*a?true:false;

}

int main() {

int t[] = {1,2,3,2,3,5,1,2,7,3,2,1,10, 4,4,5};

int u[] = {2,4,6,4,6,10,2,4,14,6,4,2,20,8,8,5};

vector v1(t, t + 15);

deque d1(u, u + 15);

pair::iterator, vector::iterator > result;

result = mismatch(d1.begin(), d1.end(), v1.begin(), identical); //Line I

if (result.first == d1.end() && result.second == v1.end()) {//Line II

cout<<"Identical\n";

} else {

cout<<"Not identical\n";

}

return 0;

}

Program outputs:

A.

Identical

B.

Not identical

C.

compilation error at line marked I

D.

compilation error at line marked II

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

#include

#include

#include

using namespace std;

class B { int val;

public:

B(int v):val(v){}

int getV() const {return val;} bool operator < (const B & v) const { return val

ostream & operator <<(ostream & out, const B & v) { out<

templatestruct Out {

ostream & out;

Out(ostream & o): out(o){}

void operator() (const T & val ) { out<

int main() {

B t1[]={3,2,4,1,5};

B t2[]={5,6,8,2,1};

vector v1(10,0);

sort(t1, t1+5);

sort(t2, t2+5);

set_symmetric_difference(t2,t2+5,t1,t1+5,v1.begin());

for_each(v1.begin(), v1.end(), Out(cout));cout<

return 0;

}

Program outputs:

A.

6 8 3 4 0 0 0 0 0 0

B.

3 4 0 0 0 0 0 0 0 0

C.

6 8 0 0 0 0 0 0 0 0

D.

compilation error

E.

3 4 6 8 0 0 0 0 0 0

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;

cout<

return 0;

}

Program will output:

A.

truefalse

B.

true0;

C.

1false

D.

10

E.

none of these