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

Last Updated on May 20, 2021 by Admin

CPA Chapter 4 Assessment Answers 100%

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

    #include <iostream>

    using namespace std;

    int main() {

    char   t[3][3], *p = (char *)t;

    for(int i = 0; i < 9; i++)

    *p++ = ‘a’ + i;

    cout << t[1][1];

    return 0;
    }

    • It prints g
    • It prints c
    • Compilation fails
    • It prints e
  2. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    int main() {
    float *ft[3] = { new float[3], new float[3], new float[3] }, *p;

    for(int i = 0; i < 3; i++) {
    p = ft[i];
    *p = p[1] = *(p + 2) = 10 * i;
    }
    cout << ft[1][1];
    delete [] ft[0];
    delete [] ft[1];
    delete [] ft[2];
    return 0;
    }

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

    #include <iostream>
    using namespace std;

    int main() {
    int *it[3];

    for(int i = 0; i < 3; i++) {
    it[i] = new int [i + 1];
    for(int j = 0; j < i + 1; j++)
    it[i][j] = 10 * i + j;
    }
    cout << it[2][2];
    for(int i = 0; i < 3; i++)
    delete [] it[i];
    return 0;
    }

    • It prints 33
    • It prints 22
    • It prints 11
    • Compilation fails
  4. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    int main() {
    short s = 1;
    int i = 2;
    long l = 3;
    float f = 4.4;
    double d = 6.6;

    cout << s/i + f/i + d/s;
    return 0;
    }

    • It prints 4.4
    • Compilation fails
    • It prints 6.6
    • It prints 8.8
  5. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    int main() {
    short s = 1;
    int i = 2;
    long l = 3;
    float f = 4.4;
    double d = 6.6;

    cout << s/float(i) + int(f)/i + long(d)/s;
    return 0;
    }

    • It prints 8.5
    • It prints 8.0
    • Compilation fails
    • It prints 8.8
  6. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    int main() {
    int i = 2;
    float f = 5.8;

    f = (int)f;
    i = (float) i;
    cout << f/i;
    return 0;
    }

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

    #include <iostream>
    using namespace std;

    int main() {
    int i = 2;
    float f = 4.4;

    cout << f % float(i);
    return 0;
    }

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

    #include <iostream>
    #include <string>
    using namespace std;

    int main() {
    int i = 2;
    string s = “2”;

    cout << s + i;
    return 0;
    }

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

    #include <iostream>
    #include <string>
    using namespace std;

    int main() {
    string s = “a”;

    cout << s  << “b” + “c”;
    return 0;
    }

    • Compilation fails
    • It prints ab
    • It prints a
    • It prints abc
  10. What happens when you attempt to compile and run the following code?

    #include <iostream>
    #include <string>
    using namespace std;

    int main() {
    string s = “a”;

    cout << s + “b” + “c”;
    return 0;
    }

    • It prints ab
    • It prints abc
    • Compilation fails
    • It prints a
  11. What happens when you attempt to compile and run the following code?

    #include <iostream>
    #include <string>
    using namespace std;

    int main() {
    string s1 = “ab”;
    string s2 = “Abc”;

    if(s1 > s2)
    cout << “yes”;
    else
    cout << “NO”;
    return 0;
    }

    • It prints NO
    • It prints nothing
    • Compilation fails
    • It prints yes
  12. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    int main() {
    string s1 = “Ab”;
    string s2 = “Abc”;

    cout << s1.compare(s1);
    return 0;
    }

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

    #include <iostream>
    using namespace std;

    int main() {
    string s1 = “1”;
    string s2 = “12”;

    cout << s1.compare(s2);
    return 0;
    }

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

    #include <iostream>
    #include <string>
    using namespace std;

    int main() {
    string s = “0123456789”;
    cout << s.substr(3,7).substr(2).substr();
    return 0;
    }

    • Compilation fails
    • It prints an empty string
    • It prints 56789
    • It prints 34567
  15. What happens when you attempt to compile and run the following code?

     

    #include <iostream>
    #include <string>
    using namespace std;

    int main() {
    string s = “ABCDEF”;
    for(int i = 1; i < s.length(); i += 2)
    s[i – 1] = s[i] + ‘a’ – ‘A’;
    cout << s;
    return 0;
    }

    • Compilation fails
    • It prints bBdDfF
    • It prints BBDDFF
    • It prints aAcCeE
  16. What happens when you attempt to compile and run the following code?

    #include <iostream>
    #include <string>
    using namespace std;

    int main() {
    string s = “AB”;
    s.append(s).push_back(s[s.length() – 1]);
    cout << s;
    return 0;
    }

    • Compilation fails
    • It prints ABABA
    • It prints ABABB
    • It prints ABAB
  17. What happens when you attempt to compile and run the following code?

    #include <iostream>
    #include <string>
    using namespace std;

    int main() {
    string s1 = “aleph”;
    string s2 = “alpha”;
    string s;
    s1.swap(s2);
    s2.swap(s);
    s.swap(s2);
    cout << s2;
    return 0;
    }

    • Compilation fails
    • It prints aleph
    • It prints alpha
    • It prints an empty string
  18. What happens when you attempt to compile and run the following code?

    #include <iostream>

    namespace SpaceA {
    int A;
    }

    namespace SpaceB {
    int A;
    }

    using namespace SpaceA, SpaceB;

    int main() {
    SpaceA::A = SpaceB::A = 1;
    std::cout << A + 1;
    return 0;
    }

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

    #include <iostream>
    using namespace std;

    namespace S1 {
    int A = 1;
    }

    namespace S2  {
    int A = 2 ;
    }

    int main(void) {
    { using namespace S1;
    S2::A = A + 1;
    }
    { using namespace S2;
    S1::A = A + 1;
    }
    cout << S1::A << S2::A;
    return 0;
    }

    • It prints 23
    • Compilation fails
    • It prints 33
    • It prints 32
  20. What happens when you attempt to compile and run the following code?

    #include <iostream>
    using namespace std;

    namespace S {
    int A = 1;
    }

    namespace S {
    int B = A + 2 ;
    }

    int main(void) {
    S::A = S::A + 1;
    { using namespace S;
    ++B;
    }
    cout << S::B << S::A;
    return 0;
    }

    • It prints 32
    • It prints 42
    • Compilation fails
    • It prints 22
  • 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.