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 7 Assessment Answers 100%

Last Updated on May 20, 2021 by Admin

CPA Chapter 7 Assessment Answers 100%

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

    #include <iostream>
    #include <exception>

    using namespace std;

    int main() {
    try {
    throw 2/4;
    }
    catch(int i) {
    cout << i;
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>

    using namespace std;

    int main() {
    try {
    throw 2./4;
    }
    catch(int i) {
    cout << i;
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>

    using namespace std;

    int main() {
    throw 2/4;
    catch(int i) {
    cout << i;
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>

    using namespace std;

    int main() {
    try {
    throw exception();
    }
    catch(exception &x) {
    cout << x.what();
    }
    return 0;
    }

    • Execution fails
    • It prints a non-empty string
    • Compilation fails
    • It prints an empty string
  5. What happens when you attempt to compile and run the following code?

    #include <iostream>
    #include <exception>

    using namespace std;

    int main() {
    try {
    throw 3.14;
    }
    catch(double x) {
    x *= 2;
    }
    cout << x;
    return 0;
    }

    • Execution fails
    • Compilation fails
    • It prints an empty string
    • It prints a non-empty string
  6. What happens when you attempt to compile and run the following code?

    #include <iostream>
    #include <string>
    using namespace std;
    class X {
    public:
    X(void) { cout << 1; }
    ~X(void) { cout << 2; }
    };
    void exec() {
    {
    X x;
    }
    throw string(“0”);
    }

    int main(void) {
    try {
    exec();
    } catch(string &s) {
    cout << s;
    }
    return 0;
    }

    • It prints 120
    • Compilation fails
    • It prints 102
    • Execution fails
  7. What happens when you attempt to compile and run the following code?

    #include <string>
    #include <iostream>
    using namespace std;
    class X {
    public:
    X(void) { cout << 1; }
    ~X(void) { cout << 2; }
    };
    X *exec() {
    X *x = new X();
    throw string(“0”);
    return x;
    }

    int main(void) {
    X *x;
    try {
    delete exec();
    } catch(string &s) {
    cout << s;
    }
    return 0;
    }

    • It prints 10
    • Compilation fails
    • It prints 12
    • Execution fails
  8. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;
    class X {
    public:
    X(void) { cout << 0; }
    ~X(void) { cout << 2; }
    };

    int main(void) {
    try {
    X *x = new X();
    throw true;
    delete x;
    } catch(bool s) {
    cout << s;
    }
    return 0;
    }

    • Execution fails
    • It prints 01
    • Compilation fails
    • It prints 021
  9. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;
    class X {
    public:
    X(void) throw(int) { cout << 1; }
    ~X(void) throw(int) { cout << 2; }
    void exec() { throw 0; }
    };

    void exec(X &x) {
    x.exec() ;
    }

    int main(void) {
    X x;
    try {
    exec(x);
    } catch(int &i) {
    cout << i;
    }
    return 0;
    }

    • It prints 102
    • Execution fails
    • It prints 120
    • Compilation fails
  10. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;
    class X {
    public:
    X(void) throw(int) { cout << 1; }
    ~X(void) throw(int) { cout << 2; }
    void exec() { throw string(“0”); }
    };

    void exec(X x) {
    x.exec() ;
    }

    int main(void) {
    X x;
    try {
    exec(x);
    } catch(int &i) {
    cout << i;
    }
    return 0;
    }

    • Execution fails
    • It prints 120
    • It prints 102
    • Compilation fails
  11. What happens when you attempt to compile and run the following code?

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class X : public logic_error {
    public:
    X() : logic_error(“0”) {};
    };

    void z() throw(X) {
    throw new logic_error(“0”);
    }

    int main(void) {
    X x;
    try {
    z();
    } catch(X &i) {
    cout << i.what();
    }
    return 0;
    }

    • It prints 120
    • Execution fails
    • Compilation fails
    • It prints 102
  12. What happens when you attempt to compile and run the following code?

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class X : public logic_error {
    public:
    X() : logic_error(“0”) {};
    };

    void z() throw(logic_error) {
    X x;
    throw x;
    cout << 1;
    }

    int main(void) {
    X x;
    try {
    z();
    } catch(logic_error &i) {
    cout << i.what();
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class X : public domain_error {
    public:
    X() : domain_error(“0”) {};
    };

    void z() throw(X) {
    X x;
    throw x;
    cout << 1;
    }

    int main(void) {
    X x;
    try {
    z();
    } catch(X &i) {
    cout << 1;
    }
    catch(domain_error &i) {
    cout << 0;
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class X : public runtime_error {
    public:
    X() : domain_error(“0”) {};
    };

    void z() throw(X) {
    X x;
    throw x;
    cout << 1;
    }

    int main(void) {
    X x;
    try {
    z();
    } catch(X &i) {
    cout << 1;
    }
    catch(domain_error &i) {
    cout << 0;
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class E {};

    class X {
    static int c;
    public:
    X() { if(c++ > 2) throw new E; }
    ~X() { if(c++ > 2) throw new E; }
    };

    int X::c = 0;

    void f(int i) {
    X a,b;
    cout << i;
    }

    int main(void) {
    try {
    f(0);
    f(1);
    } catch(…) {
    cout << 1;
    }
    return 0;
    }

    • It prints 01
    • Compilation fails
    • Execution fails
    • It prints 0
  16. What happens when you attempt to compile and run the following code?

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class E {};

    class X {
    public:
    static int c;
    X(int a) { c = a; }
    ~X() { if(c++ > 2) throw new E; }
    };

    int X::c = 0;

    void f(int i) {
    X* t[2];
    for(int j = 0; j < i; j++)
    t[j] = new X(i+1);
    for(int j = 0; j < i; j++)
    delete t[j];
    }

    int main(void) {
    try {
    f(2);
    } catch(…) {
    cout << X::c;
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class E {};

    void f(int i) {
    E e;
    switch(i) {
    case 0 : throw e;
    case 1 : throw &e;
    }
    cout << 0;
    }

    int main(void) {
    try {
    f(2);
    } catch(E*) {
    cout << 1;
    } catch(E) {
    cout << 2;
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class E {};

    void f(int i) {
    E e;
    switch(i) {
    case 0 : throw e;
    case 1 : throw &e;
    }
    cout << 0;
    }

    int main(void) {
    try {
    f(1);
    } catch(void *) {
    cout << 2;
    } catch(E*) {
    cout << 1;
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class Int {
    public:
    int v;
    Int(int a) : v(a) {}
    };

    void a() {
    throw Int(1);
    }

    void b() {
    try {
    a();
    } catch(Int &i) {
    throw Int(i.v + 1);
    }
    }

    void c() {
    try {
    b();
    } catch(…) {
    throw;
    }
    }

    int main(void) {
    try {
    c();
    } catch(Int &i) {
    cout << i.v;
    }
    return 0;
    }

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

    #include <iostream>
    #include <exception>
    #include <stdexcept>
    using namespace std;

    class Int {
    public:
    int v;
    Int(int a) : v(a) {}
    };

    void a() {
    throw 0;
    }

    void b() {
    try {
    a();
    } catch(int i) {
    throw Int(i + 1);
    }
    }

    void c() {
    try {
    b();
    } catch(…) {
    throw;
    }
    }

    int main(void) {
    try {
    c();
    } catch(Int &i) {
    cout << i.v;
    }
    return 0;
    }

    • It prints 0
    • It prints 2
    • Compilation fails
    • It prints 1
  • 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.