[CPP] Chapter 6 Assessment

 Question 1

/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<int> v1(7);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    merge(mynumbers1, mynumbers1+4, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 2
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<int> v1(7);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    merge(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 3
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<double> v1(7);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    merge(mynumbers1, mynumbers1+3, mynumbers2, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 4
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={ 3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<int> v1(14);
    vector<int> v2(34);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);
    copy(mynumbers1, mynumbers1+4, v1.begin());
    copy(mynumbers2, mynumbers2+4, v1.begin()+5);//LINE I
    sort(v1.begin(), v1.end());
    merge(v1.begin(), v1.end(), v1.begin(), v1.end(), v2.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 5
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={ 3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 7};
    vector<int> v1(10);
    vector<int> v2(20);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);
    copy(mynumbers1, mynumbers1+4, v1.begin());
    copy(mynumbers2, mynumbers2+4, v1.begin()+5);//LINE I
    sort(v1.begin(), v1.end());
    merge(v1.begin(), v1.end(), v1.begin(), v1.end(), v2.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 6
/ 1 pts

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

#include <deque>
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    sort(mynumbers1, mynumbers1 + 4);
    sort(mynumbers2, mynumbers2 + 4);
    deque<int> d1(mynumbers1, mynumbers1+3);//LINE I
    set<int> s1(mynumbers2, mynumbers2+3);//LINE II
    sort(d1.begin(), d1.end());
    cout<<includes(s1.begin(), s1.end(), mynumbers1, mynumbers1+4) <<", "
        <<includes(d1.begin(), d1.end(), mynumbers1, mynumbers1+4)
        <<endl;
    return 0;
}
  
  
  
  
  
  
  
 
Question 7
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<int> v1(7);
    sort(mynumbers2, mynumbers2 + 4);//LINE I
    sort(mynumbers1, mynumbers1 + 4);
    set_union(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 8
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<int> v1(7);
    sort(mynumbers2, mynumbers2 + 4);//LINE I
    sort(mynumbers1, mynumbers1 + 4);
    set_union(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 9
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 2};
    vector<int> v1(7);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    set_intersection(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 10
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<int> v1(7);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    set_intersection(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 11
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<int> v1(7);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    set_difference(mynumbers1, mynumbers1+4, mynumbers2, mynumbers2+4, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 12
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<int> v1(7);
    sort(mynumbers2, mynumbers2 + 3);
    sort(mynumbers1, mynumbers1 + 3);
    set_difference(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 13
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i) {
    cout << i << ", ";
}
int main() {
    int mynumbers1[]={3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<int> v1(5);
    sort(mynumbers2, mynumbers2 + 3);
    sort(mynumbers1, mynumbers1 + 3);//LINE I
    set_symmetric_difference(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+2, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 14
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
    int mynumbers[] = { 3, 9, 0, 2, 1, 4, 5 };
    vector<int> v1(mynumbers, mynumbers + 7);
    sort(v1.begin(), v1.end(), greater<int>());//LINE I
    cout<< *min_element(v1.begin(), v1.end()) << ", ";//LINE II
    return 0;
}
  
  
  
  
  
  
  
 
Question 15
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
    int mynumbers[] = { 3, 9, 0, 2, 1, 4, 5 };
    vector<int> v1(mynumbers, mynumbers + 7);//LINE I
    cout<< *min_element(v1.begin(), v1.end()) << ", ";//LINE II
    return 0;
}
  
  
  
  
  
  
  
  
 
Question 16
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
    int mynumbers[] = { 3, 9, 0, 2, 1, 4, 5 };
    vector<int> v1(mynumbers, mynumbers + 7);//LINE I
    cout<< *max_element(v1.begin(), v1.end()) << ", ";//LINE II
    return 0;
}
  
  
  
  
  
  
  
  
 
Question 17
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
void printer(Pocket i) {
    cout << i << ", ";
}
int main() {
    Pocket mynumbers1[]={3, 9, 0, 2};
    Pocket mynumbers2[]={6, 1, 4, 5};
    vector<Pocket> v1(mynumbers1, mynumbers1+4);//LINE I
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);
    merge(mynumbers1, mynumbers1+2, mynumbers2, mynumbers2+2, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
  
 
PartialPartialQuestion 18
0.67 / 1 pts

What will happen when you attempt to compile and run the following code? Choose all that apply.

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
void printer(Pocket i) {
    cout << i << ", ";
}
int main() {
    Pocket mynumbers1[]={ 3, 9, 0, 2};
    Pocket mynumbers2[]={6, 1, 4, 5};
    vector<Pocket> v1(7, 0);
    sort(mynumbers2, mynumbers2 + 4);
    copy(mynumbers1, mynumbers1+4, v1.begin());
    copy(mynumbers2, mynumbers2+4, v1.begin()+3);
    sort(v1.begin(), v1.begin() + 5);//LINE I
    inplace_merge(v1.begin(), v1.begin()+5, v1.end());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
  
 
Question 19
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
void printer(Pocket i) {
    cout << i << ", ";
}
int main() {
    Pocket mynumbers1[]={ 3, 9, 0, 2};
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    vector<Pocket> v1(mynumbers1, mynumbers1+3);
    inplace_merge(v1.begin(), v1.begin()+3, v1.end());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 20
/ 1 pts

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

#include <deque>
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
int main() {
    Pocket mynumbers1[] = { 3, 9, 0, 2, 1, 4, 5 };
    Pocket mynumbers2[]={Pocket(3),Pocket(2),Pocket(4),Pocket(1)};
    deque<Pocket> d1(mynumbers1, mynumbers1+7);
    set<Pocket> s1(mynumbers1, mynumbers1+7);
    sort(d1.begin(), d1.end());
    sort(mynumbers1, mynumbers1+5);
    sort(mynumbers2, mynumbers2+4);
    cout<<includes(d1.begin(),d1.end(), mynumbers1, mynumbers1+4)<<", "//LINE I
        <<includes(s1.begin(),s1.end(), mynumbers2, mynumbers2+4)//LINE II
        <<endl;
    return 0;
}
  
  
  
  
  
  
  
 
Question 21
/ 1 pts

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

#include <deque>
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
int main() {
    Pocket mynumbers1[] = { 3, 9, 0, 2, 1, 4, 5 };
    Pocket mynumbers2[]={Pocket(3),Pocket(2),Pocket(4),Pocket(1)};
    deque<Pocket> d1(mynumbers1, mynumbers1+7);
    set<Pocket> s1(mynumbers1, mynumbers1+7);
    sort(d1.begin(), d1.end());
    sort(mynumbers1, mynumbers1+5);
    sort(mynumbers2, mynumbers2+4);
    cout<<includes(d1.begin(),d1.end(), mynumbers1, mynumbers1+4)<<", "//LINE I
        <<includes(s1.begin(),s1.end(), mynumbers2, mynumbers2+3)//LINE II
        <<endl;
    return 0;
}
  
  
  
  
  
  
  
 
Question 22
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
    bool operator < (const int & _Right) const
    { return value < _Right; }
    operator int() const
    { return value;    }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
void printer(Pocket i) {
    cout << i << ", ";
}
int main() {
    Pocket mynumbers1[]={ 3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 5};
    vector<Pocket> v1(7,0);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    set_union(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 23
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
    bool operator < (const int & _Right) const
    { return value < _Right; }
    operator int() const
    { return value;    }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
void printer(Pocket i) {
    cout << i << ", ";
}
int main() {
    Pocket mynumbers1[]={ 3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 2};
    vector<Pocket> v1(7,0);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    set_intersection(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
  
 
Question 24
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
    bool operator < (const int & _Right) const
    { return value < _Right; }
    operator int() const
    { return value;    }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
void printer(Pocket i) {
    cout << i << ", ";
}
int main() {
    Pocket mynumbers1[]={ 3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 2};
    vector<Pocket> v1(7,0);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    set_difference(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
 
Question 25
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
    bool operator < (const int & _Right) const
    { return value < _Right; }
    operator int() const
    { return value;    }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
void printer(Pocket i) {
    cout << i << ", ";
}
int main() {
    Pocket mynumbers1[]={ 3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 2};
    vector<Pocket> v1(7,0);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);//LINE I
    set_symmetric_difference(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
 
PartialPartialQuestion 26
0.5 / 1 pts

What will happen when you attempt to compile and run the following code? Choose all that apply.

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
    bool operator < (const int & _Right) const
    { return value < _Right; }
    operator int() const
    { return value;    }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
int main() {
    Pocket mynumbers1[]={ 3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 2};
    vector<Pocket> v1(7,0);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);
    set_symmetric_difference(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE I
    cout<< *min_element(v1.begin(), v1.end()) << ", " ;//LINE II
    return 0;
}
  
  
  
  
  
  
  
 
Question 27
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Pocket {
    int value;
public:
    Pocket(int value):value(value){}
    int getValue() const
    { return value; }  
    bool operator < (const Pocket & _Right) const
    { return value < _Right.value; }
    bool operator < (const int & _Right) const
    { return value < _Right; }
    operator int() const
    { return value;    }
};
ostream & operator <<(ostream & stream, const Pocket & pocket)
{
    stream << pocket.getValue();
    return stream;
}
int main() {
    Pocket mynumbers1[]={ 3, 9, 0, 2};
    int mynumbers2[]={6, 1, 4, 2};
    vector<Pocket> v1(7,0);
    sort(mynumbers2, mynumbers2 + 4);
    sort(mynumbers1, mynumbers1 + 4);
    set_symmetric_difference(mynumbers1, mynumbers1+3, mynumbers2, mynumbers2+3, v1.begin());//LINE I
    cout<< max_element(v1.begin(), v1.end()) << ", " ;//LINE II
    return 0;
}
  
  
  
  
  
  
  
 
Question 28
/ 1 pts

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

#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
void printer(string i) {
    cout << i << ", ";
}
int main() {
    string myvalues[]={"yyy","Yyy", "yYy","yyY","ZZZ","zZZ", "ZzZ", "ZZz"};
    vector<string> v1(myvalues, myvalues+8);
    sort(v1.begin(), v1.end()); //LINE I
    remove(v1.begin(), v1.end(), "yyy"); //LINE II
    for_each(v1.begin(), v1.end(), printer);
    return 0;
}
  
  
  
  
  
  
 
Question 29
/ 1 pts

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

#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main() {
    char s[]={"lazybrownfox"};
    char pattern1[]={"ybr"};
    char pattern2[]={"nfo"};
    sort(s, s+8); //LINE I
    sort(pattern1, pattern1+3); //LINE II
    sort(pattern2, pattern2+3);
    cout<<includes(s, s+7, pattern1, pattern1+3) <<", "
        <<includes(s, s+6, pattern2, pattern2+3);
    return 0;
}
  
  
  
  
  
  
  
 
Question 30
/ 1 pts

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

#include <deque>
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
bool Compare(char _Left, char _Right) { return tolower(_Left) < tolower(_Right);}
int main() {
    char s[]={"lazybrownfox"};
    char pattern1[]={"ybr"};
    char pattern2[]={"nfo"};
    sort(s, s+8, Compare);
    sort(pattern1, pattern1+3);
    sort(pattern2, pattern2+3);
    cout<<includes(s, s+7, pattern1, pattern1+3) <<", "
        <<pattern2;
    return 0;
}
  
  
  
  
  
Quiz Score: 29.17 out of 30