Download Certified Protection Professional.CPP.BrainDumps.2019-03-15.136q.vcex

Vendor: ASIS
Exam Code: CPP
Exam Name: Certified Protection Professional
Date: Mar 15, 2019
File Size: 153 KB
Downloads: 1

How to open VCEX files?

Files with VCEX extension can be opened by ProfExam Simulator.

Demo Questions

Question 1
What happens when you attempt to compile and run the following code? 
    #include <vector> 
    #include <iostream> 
    #include <algorithm> 
    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<v.val;} }; 
    ostream & operator <<(ostream & out, const B & v) { out<<v.getV(); return out;} 
     
    template<class T>struct Out { 
        ostream  & out; 
        Out(ostream & o): out(o)
        void operator() (const T & val ) { out<<val<<" "; } }; 
     
    int main() { 
        B t1[]={3,2,4,1,5}; 
        B t2[]={6,10,8,7,9}; 
        vector<B> v1(10); 
        sort(t1, t1+5); 
        sort(t2, t2+5); 
        merge(t1,t1+5,t2,t2+5,v1.begin()); 
        for_each(v1.begin(), v1.end(), Out<B>(cout));cout<<endl; 
        return 0; 
    } 
Program outputs:
  1. 1 2 3 4 5 6 10 8 7 9
  2. 3 2 4 1 5 6 7 8 9 10
  3. 3 2 4 1 5 6 10 8 7 9
  4. 1 2 3 4 5 6 7 8 9 10
  5. compilation error
Correct answer: E
Question 2
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); 
        cout<<*max_element(v1.begin(), v1.end()); 
        return 0; 
    } 
Program outputs:
  1. 3
  2. 1
  3. 6
  4. 10
  5. compilation error
Correct answer: D
Question 3
What happens when you attempt to compile and run the following code? 
    #include <iostream> 
    #include <algorithm> 
    #include <vector> 
    #include <deque> 
    #include <set> 
    using namespace std; 
     
    void myfunction(int i) { 
        cout << " " << i; 
    } 
     
    int main() { 
        int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 }; 
        vector<int> v1(t, t + 10); 
        deque<int> d1(t, t + 10); 
        set<int> s1(t, t + 10); 
     
        for_each(v1.begin(), v1.end(), myfunction); // Line I 
     
        for_each(d1.begin(), d1.end(), myfunction);  // Line II 
     
        for_each(s1.begin(), s1.end(), myfunction);  // Line III 
        return 0; 
    }
  1. program outputs: 10 5 9 6 2 4 7 8 3 1 10 5 9 6 2 4 7 8 3 1 1 2 3 4 5 6 7 8 9 10
  2. program outputs: 10 5 9 6 2 4 7 8 3 1 10 5 9 6 2 4 7 8 3 1 10 5 9 6 2 4 7 8 3 1
  3. program outputs: 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
  4. compilation error in line I
  5. compilation error in line III
Correct answer: A
Question 4
What happens when you attempt to compile and run the following code? 
    #include <iostream> 
    #include <algorithm> 
    #include <vector> 
    #include <set> 
    using namespace std; 
     
    void myfunction(int i) { 
        cout << " " << i; 
    } 
     
    int main() { 
        int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 }; 
        set<int> s1(t, t+10); 
        vector<int> v1(s1.rbegin(), s1.rend()); 
        swap_ranges(s1.begin(), s1.end(), v1.begin()); 
        for_each(v1.begin(), v1.end(), myfunction); 
        for_each(s1.begin(), s1.end(), myfunction); 
        return 0; 
    } 
Program outputs:
  1. 10 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10
  2. compilation error
  3. 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
  4. 1 2 3 4 5 6 7 8 9 10 10 9 8 7 6 5 4 3 2 1
  5. 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1
Correct answer: B
Question 5
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; 
    }
  1. program outputs: 1 2 3 4 5
  2. program outputs: 1 2 4 5
  3. program outputs: 1 1 2 2 3 4 4 5 5
  4. program outputs: 1 1 2 3 3 4 4 5 5
  5. compilation error
Correct answer: A
Question 6
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:
  1. 3 2 4 1 5 6 8 2 1 0
  2. 1 2 3 4 5 6 8 2 1 0
  3. 1 1 2 2 3 4 5 5 6 8
  4. 1 2 3 4 5 6 8 0 0 0
  5. compilation error
Correct answer: D
Question 7
What will happen when you attempt to compile and run the code below, assuming that you  enter the following sequence: 1 2 3 end<enter>?
    #include <iostream> 
    #include <string> 
    #include <list> 
    #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 () 
    { 
        list<int> l; 
        for( ; !cin.bad() ; ) 
        { 
        int i; 
        cin>>i; 
        l.push_back(i); 
        } 
        for_each(l.begin(), l.end(), Out<int>(cout)); 
        return 0; 
    } 
Program will output:
  1. 1 2 3
  2. 1 2 3 end
  3. 1
  4. compilation error
  5. program runs forever without output
Correct answer: E
Question 8
What happens when you attempt to compile and run the following code? 
    #include <iostream> 
    #include <map> 
    using namespace std; 
    int main() { 
        int t[] = { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 }; 
        string s[] = { "one", "one", "two", "two", "three","three", "four", "four", "five", "five"}; 
        map<int, string> m; 
        for (int i = 0; i < 10; i++) { 
        m.push_back(pair<int, string>(t[i], s[i])); 
        } 
     
        for (map<int, string>::iterator i = m.begin(); i != m.end(); i++) {
        cout << i?>first << " "; 
        } 
        return 0; 
    }
  1. program outputs: 1 2 3 4 5
  2. compilation error
  3. program outputs: 1 1 2 2 3 3 4 4 5 5
  4. program outputs: one two three four five
  5. program outputs: one one two two three three four four five five
Correct answer: B
Question 9
What happens when you attempt to compile and run the following code? 
    #include <deque> 
    #include <iostream> 
    #include <algorithm> 
    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<v.val;} }; 
    ostream & operator <<(ostream & out, const B & v) { out<<v.getV(); return out;} 
    template<class T>struct Out { 
        ostream  & out; 
        Out(ostream & o): out(o)
        void operator() (const T & val ) { out<<val<<" "; } }; 
    int main() { 
        int t[]={8, 10, 5, 1, 4, 6, 2, 7, 9, 3}; 
        deque<B> d1(t, t+10); 
        sort(d1.begin(), d1.end()); 
        deque<B>::iterator it = upper_bound(d1.begin(), d1.end(), B(4));
        for_each(it, d1.end(), Out<B>(cout)); cout<<endl; 
        return 0; 
    } 
Program outputs:
  1. 5 6 7 8 9 10
  2. 4 5 6 7 8 9 10
  3. 6 7 8 9 10
  4. 1 2 3 4 5
  5. 1 2 3 4
Correct answer: A
Question 10
What happens when you attempt to compile and run the following code? 
    #include <vector> 
    #include <iostream> 
    #include <algorithm> 
    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<v.val;} }; 
    ostream & operator <<(ostream & out, const B & v) { out<<v.getV(); return out;} 
    template<class T>struct Out { 
        ostream  & out; 
        Out(ostream & o): out(o)
        void operator() (const T & val ) { out<<val<<" "; } }; 
     
    int main() { 
        B t1[]={3,2,4,1,5}; 
        B t2[]={5,6,8,2,1}; 
        vector<B> 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<B>(cout));cout<<endl; 
        return 0; 
    } 
Program outputs:
  1. 6 8 3 4 0 0 0 0 0 0
  2. 3 4 0 0 0 0 0 0 0 0
  3. 6 8 0 0 0 0 0 0 0 0
  4. compilation error
  5. 3 4 6 8 0 0 0 0 0 0
Correct answer: E
HOW TO OPEN VCE FILES

Use VCE Exam Simulator to open VCE files
Avanaset

HOW TO OPEN VCEX AND EXAM FILES

Use ProfExam Simulator to open VCEX and EXAM files
ProfExam Screen

ProfExam
ProfExam at a 20% markdown

You have the opportunity to purchase ProfExam at a 20% reduced price

Get Now!