Exam Details

  • Exam Code
    :CPA-21-02
  • Exam Name
    :CPA - C++ Certified Associate Programmer
  • Certification
    :C++ Institute Certifications
  • Vendor
    :C++ Institute
  • Total Questions
    :257 Q&As
  • Last Updated
    :Jul 18, 2025

C++ Institute C++ Institute Certifications CPA-21-02 Questions & Answers

  • Question 241:

    Which definitions are correct?

    A. int age;

    B. int double;

    C. char c;

    D. int char;

  • Question 242:

    What is the expected result of the following program?

    A. It prints: ABCD

    B. It prints: ACBD

    C. It prints: ACDB

    D. It prints: CABD

  • Question 243:

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

    #include

    using namespace std;

    int min(int a, int b);

    int main()

    {

    int min(int,int);

    int b;

    b = min(10,20);

    cout << b;

    return 0;

    }

    int min(int a, int b)

    {

    return(b);

    }

    A. It prints: 20

    B. It prints: 10

    C. It prints: 1020

    D. It prints: 2010

  • Question 244:

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

    #include

    using namespace std;

    int main()

    {

    const char *s;

    char str[] = "Hello";

    s = str;

    while(*s) {

    cout << *s++;

    }

    return 0;

    }

    A. It prints: el

    B. It prints: Hello

    C. It prints: H

    D. It prints: o

  • Question 245:

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

    #include

    #include

    using namespace std;

    class A {

    protected:

    int y;

    public:

    int x;

    int z;

    A() { x=1; y=2; z=3; }

    A(int a, int b) : x(a), y(b) { z = x * y;}

    void Print() {

    cout << z;

    }

    };

    int main () {

    A a(2,5);

    a.Print(); return 0; }

    A. It prints: 10

    B. It prints: 2

    C. It prints: 6

    D. It prints: 5

  • Question 246:

    What is the output of the program?

    #include

    #include

    using namespace std;

    int main()

    {

    string s1="World";

    string s2;

    s2="Hello" + s1;

    cout << s2;

    return( 0 );

    }

    A. It prints: HelloWorld

    B. It prints: Hello

    C. It prints: World

    D. Compilation error

  • Question 247:

    What is the output of the program if character 3 is supplied as input? #include

    using namespace std;

    int main () {

    int c;

    cin >> c;

    try

    {

    switch (c)

    {

    case 1:

    throw 20;

    case 2:

    throw 5.2f;

    case 3:

    throw 'a';

    }

    }

    catch (int e)

    { cout << "int exception. Exception Nr. " << e; }

    catch (float e)

    { cout << "float exception. Exception Nr. " << e; }

    catch (...)

    { cout << "An exception occurred."; }

    return 0;

    }

    A. It prints: float exception. Exception Nr.

    B. It prints: int exception. Exception Nr.

    C. It prints: An exception occurred.

    D. It prints: float exception. Exception Nr.

  • Question 248:

    Which of the following structures are correct?

    1: struct s1{ int x; char c; };

    2: struct s2{ float f; struct s2 *s; };

    3: struct s3{

    float f;

    in i;

    }

    A. 1

    B. 2

    C. 3

    D. All of these

  • Question 249:

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

    A. It prints: BAD

    B. It prints: BACD

    C. It prints: ABCD

    D. It prints: BAC

  • Question 250:

    Which code, inserted at line 12, generates the output "5b"? #include using namespace std; namespace myNamespace1 { int var = 5; } namespace myNamespace2 { char var = 'b'; } int main () { //insert code here return 0; }

    A. cout << myNamespace1::var << var;

    B. cout << var << var;

    C. cout << myNamespace1::var << myNamespace2::var;

    D. None of these

Tips on How to Prepare for the Exams

Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only C++ Institute exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your CPA-21-02 exam preparations and C++ Institute certification application, do not hesitate to visit our Vcedump.com to find your solutions here.