Download ASIS.CPP.BrainDumps.2019-03-15.136q.tqb

Vendor: ASIS
Exam Code: CPP
Exam Name: C++ Certified Professional Programmer
Date: Mar 15, 2019
File Size: 1 MB

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
EXAM SIMULATOR

How to Open TQB Files?

Use Taurus Exam Simulator to open TQB files

Taurus Exam Simulator


Taurus Exam Simulator for Windows/macOS/Linus

Download

Taurus Exam Studio
Enjoy a 20% discount on Taurus Exam Studio!

You now have the chance to acquire Exam Studio at a discounted rate of 20%.

Get Now!