Skip to content
  • Home
  • CCNA Labs
    • CCNA 1 LAB Activities (v6 & v7)
    • CCNA 2 LAB Activities (v6 & v7)
    • CCNA 3 LAB Activities (v6 & v7)
    • CCNA 4 Lab Activities
  • Linux
    • Linux Unhatched
    • Linux Essentials 2.0
    • Linux Essentials
    • Introduction to Linux I
    • Introduction to Linux II
  • Programming
    • PCAP – Programming Essentials in Python
    • CLA – Programming Essentials in C
    • CPA Programming Essentials in C++
  • About
    • Contact Us
    • Privacy Policy

CCNA 7 Exam Answers 2023

Go with our CCIE, Passed 100%

  • ITE
    • ITE - IT Essentials v7.0
    • ITE - IT Essentials v6.0
      • IT Essentials Lab 2019
    • ITE v5.0 Exam
    • Virtual Activity Laptop
    • Virtual Activity Desktop
  • NE
    • MF
  • CCNA
    • CCNA1
      • CCNA1 v7.0 – ITN
      • CCNA1 v6.0
    • CCNA2
      • CCNA2 v7.0 – SRWE
      • CCNA2 v6.0
    • CCNA3
      • CCNA3 v7.0 – ENSA
      • CCNA3 v6.0
    • CCNA4
      • CCNA4 v6.0
  • Cyber-Security
    • ITC – Introduction to Cybersecurity 2.1 (Level 1)
    • CE – Cybersecurity Essentials 1.1 (Level 2)
    • CCNA CyberOps 1.1 (Level 3)
  • Security
    • CCNA Security v2
  • DevNet
  • CCNA PT Lab 2023

CPA Chapter 5 Assessment Answers 100%

Last Updated on May 20, 2021 by Admin

CPA Chapter 5 Assessment Answers 100%

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

    #include <iostream>

    #include <string>

    using namespace std;

    class A {
    public: string a(string b) {
    return b.substr(0,2);
    }};

    class B {
    public: string a(string b) {
    return b.substr(2,2);
    }};

    int main() {
    A a;
    B b;
    cout << a.a(b.a(“ABCD”));
    return 0;
    }

    • It prints ABCD
    • It prints CD
    • It prints AB
    • Compilation fails
  2. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    int data[3];
    public:
    int cnt;
    void put(int v) { data[cnt++] = v; }
    };

    int main() {
    A a;
    a.cnt = 0;
    a.put(1);
    a.put(1);
    cout << a.cnt;
    return 0;
    }

    • It prints 0
    • It prints 2
    • Compilation fails
    • It prints 1
  3. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    int data[3];
    private:
    int cnt;
    public:
    void put(int v) { data[cnt++] = v; }
    int take() { int c = cnt; cnt = 0; return c; }
    };

    int main() {
    A a;
    a.take();
    a.put(a.take());
    a.put(1);
    cout << a.data[0];
    return 0;
    }

    • It prints 2
    • Compilation fails
    • It prints 1
    • It prints 0
  4. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    int cnt;
    void put(int v) { cout << cnt++; }
    };

    int main() {
    A a;
    a.cnt = 0;
    a.put(1);
    a.put(1);
    return 0;
    }

    • It prints 1
    • Compilation fails
    • It prints 2
    • It prints 0
  5. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    int cnt;
    void put(int v);
    };

    void A::put(int v)  { cout << ++cnt; }

    int main() {
    A a[2];
    a[0].cnt = 0;
    a[1].cnt = 1;
    a[a[0].cnt].put(a[1].cnt);
    return 0;
    }

    • It prints 1
    • Compilation fails
    • It prints 2
    • It prints 0
  6. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    float v;
    float set(float v) {
    v += 1.0;
    this -> v = v;
    return v;
    }
    float get(float d) {
    v += 1.0;
    return v;
    }
    };

    int main() {
    A a;
    cout << a.get(a.set(a.set(0.5)));
    return 0;
    }

    • It prints 1.5
    • It prints 2.5
    • It prints 3.5
    • Compilation fails
  7. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    float v;
    float set(float v) {
    A::v += 1.0;
    A::v = v + 1.0;
    return v;
    }
    float get(float v) {
    v += A::v;
    return v;
    }
    };

    int main() {
    A a;
    cout << a.get(a.set(a.set(0.5)));
    return 0;
    }

     

    • Compilation fails
    • It prints 2.5
    • It prints 2
    • It prints 1.5
  8. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    float v;
    float set(float v) {
    A::v += 1.0;
    return v;
    }
    float set(void) {
    A::v = v + 1.0;
    return 0.0;
    }
    float get(float v) {
    v += A::v;
    return v;
    }
    };

    int main() {
    A a;
    cout << a.get(a.set(a.set(a.set())));
    return 0;
    }

    • It prints 2
    • It prints 1
    • Compilation fails
    • It prints 3
  9. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    A() { v = 2.5; }
    float v;
    float set(float v) {
    A::v += 1.0;
    return v;
    }
    float get(float v) {
    v += A::v;
    return v;
    }
    };

    int main() {
    A a;
    a.A();
    cout << a.get(a.set(1.5));
    return 0;
    }

    • It prints 3
    • It prints 5
    • Compilation fails
    • It prints 1
  10. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    A() { v = 2.5; }
    float v;
    float set(float v) {
    A::v += 1.0;
    return v;
    }
    float get(float v) {
    v += A::v;
    return v;
    }
    };

    int main() {
    A a;
    cout << a.get(a.set(1.5));
    return 0;
    }

    • 1
    • 5
    • 3
    • Compilation fails
  11. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    A() { v = 2.5; }
    A(float v) { A::v = v + 1.0; }
    float v;
    float set(float v) {
    A::v += 1.0;
    return v;
    }
    float get(float v) {
    v += A::v;
    return v;
    }
    };

    int main() {
    A a,b(1.0);
    cout << a.get(b.set(1.5));
    return 0;
    }

    • It prints 2
    • Compilation fails
    • It prints 1
    • It prints 4
  12. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    A(float v) { A::v = v; }
    float v;
    float set(float v) {
    A::v += v;
    return v;
    }
    float get(float v) {
    return A::v + v;
    }
    };

    int main() {
    A a,b(1.0);
    cout << a.get(b.set(1.5));
    return 0;
    }

    • Compilation fails
    • It prints 4
    • It prints 1
    • It prints 2
  13. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    A(A &a) { v = a.get(0.0); }
    A(float v) { A::v = v; }
    float v;
    float set(float v) {
    A::v += v;
    return v;
    }
    float get(float v) {
    return A::v + v;
    }
    };

    int main() {
    A a(0.), b = a;
    cout << a.get(b.set(1.5));
    return 0;
    }

    • It prints 4.5
    • It prints 1.5
    • Compilation fails
    • It prints 2.5
  14. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    A(A &a) { v = a.get(0.0); }
    A(float v) { A::v = v; }
    float v;
    float set(float v) {
    A::v += v;
    return v;
    }
    float get(float v) {
    return A::v + v;
    }
    };

    int main() {
    A *a = new A(1.0), *b = new A(*a);
    cout << a->get(b->set(a->v));
    return 0;
    }

    • Compilation fails
    • It prints 1
    • It prints 2
    • It prints 4
  15. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    A(float v) { A::v = v; }
    float v;
    float set(float v) {
    A::v = v;
    return v;
    }
    float get(float v) {
    return A::v;
    }
    };

    int main() {
    A *a = new A(1.0), *b = new A(*a);
    cout << a->get(b->set(a->v));
    return 0;
    }

    • Compilation fails
    • It prints 4
    • It prints 2
    • It prints 1
  16. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    A(A *v) { A::v = v; }
    A() { A::v = 1.0; }
    float v;
    float set(float v) {
    A::v = v;
    return v;
    }
    float get(float v) {
    return A::v;
    }
    };

    int main() {
    A a,*b = new A(a);
    cout << a->get(b->set(a->v));
    return 0;
    }

    • It prints 4
    • It prints 1
    • Compilation fails
    • It prints 2
  17. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    float v;
    A() { v = 1.0; }
    A(A &a) { A::v = a.v; cout << “1”; }
    ~A() { cout << “0”; }
    float set(float v) {
    A::v = v;
    return v;
    }
    float get(float v) {
    return A::v;
    }
    };

    int main() {
    A a,*b = new A(a),*c = new A(*b);
    c->get(b->get(a.set(1.0)));
    delete b;
    delete c;
    return 0;
    }

    • It prints 110
    • It prints 11000
    • Compilation fails
    • It prints 1100
  18. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    float v;
    A() { v = 1.0; }
    A(A &a) { A::v = a.v; cout << “1”; }
    ~A() { cout << “0”; }
    float set(float v) {
    A::v = v;
    return v;
    }
    float get(float v) {
    return A::v;
    }
    };

    int main() {
    A a, b = a;
    return 0;
    }

    • It prints 1100
    • Compilation fails
    • It prints 100
    • It prints 11100
  19. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    float v;
    A() : v(1.0) {}
    A(A &a) : v(2.0) {}
    A(float f) : v(3.0) {}
    float get() {
    return A::v;
    }
    };

    int main() {
    A a, b(a.get()), c(b);
    cout << a.v + b.v + c.v;
    return 0;
    }

    • It prints 9
    • It prints 6
    • Compilation fails
    • It prints 3
  20. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    class A {
    public:
    float v;
    A(float x) : v(x) {}
    };

    class B {
    public:
    A a;
    float b;
    B(float x) : a(x + 1) { b = a.v; }
    };

    int main() {
    B b(2.0);
    cout << b.b;
    return 0;
    }

    • 3
    • Compilation fails
    • 1
    • 2
  • CCNA1 v7
  • CCNA2 v7
  • CCNA3 v7
System Test Exam Answers
Modules 1 – 3 Exam Answers
Modules 4 – 7 Exam Answers
Modules 8 – 10 Exam Answers
Modules 11 – 13 Exam Answers
Modules 14 – 15 Exam Answers
Modules 16 – 17 Exam Answers
Practice Final – ITN Answers
Course Feedback
ITN Practice PT Skills Assessment (PTSA)
Final Exam Answers
Modules 1 – 4 Exam Answers
Modules 5 – 6 Exam Answers
Modules 7 – 9 Exam Answers
Modules 10 – 13 Exam Answers
Modules 14 – 16 Exam Answers
ITN Practice Skills Assessment – PT Answers
SRWE Practice Skills Assessment – PT Part 1 Answers
SRWE Practice Skills Assessment – PT Part 2 Answers
SRWE Hands On Skills Exam Answers
SRWE Practice Final Exam Answers
SRWE Final Exam Answers 
Modules 1 – 2 Exam Answers
Modules 3 – 5 Exam Answers
Modules 6 – 8 Exam Answers
Modules 9 – 12 Exam Answers
Modules 13 – 14 Exam Answers
ITN Practice PT Skills Assessment (PTSA) Answers
SRWE Practice PT Skills Assessment (PTSA) – Part 1 Answers
SRWE Practice PT Skills Assessment (PTSA) – Part 2 Answers
ENSA Practice PT Skills Assessment (PTSA) Answers
ENSA Hands On Skills Exam Answers
Practice Final – ENSA Answers
ENSA Final Exam Answers
CCNA Certification Practice Exam Answers

Copyright © 2023 PressExam.