Free CPA-21-02 Exam Braindumps (page: 2)

Page 2 of 65

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

#include <iostream>
using namespace std;

int s(int n);

int main()
{
int a;
a = 3;
cout << s(a);
return 0;
}

int s(int n)
{
if(n == 0) return 1;
return s(n?1)*n;
}

  1. It prints: 4
  2. It prints: 6
  3. It prints: 3
  4. It prints: 0

Answer(s): B



What will be the output of the program?

#include <iostream>

using namespace std;

int fun(int);

int main()

{
cout << fun(5);
return 0;
}

int fun(int i)
{
return i*i;
}

  1. 25
  2. 5
  3. 0
  4. 1

Answer(s): A



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

#include <iostream>

using namespace std;

#define FUN(arg) if(arg) cout<<"Test";

int main()
{
int i=1;
FUN(i<3);
return 0;
}

  1. It prints: 0
  2. It prints: T
  3. It prints: T0
  4. It prints: Test

Answer(s): D



What will the variable "y" be in class B?

class A {
int x;
protected:
int y;
public:
int age;
};

class B : private A {
string name;
public:
void Print() {
cout << name << age;
}
};

  1. public
  2. private
  3. protected
  4. None of these

Answer(s): B



Page 2 of 65



Post your Comments and Discuss C++ Institute CPA-21-02 exam with other Community members:

Subash commented on October 21, 2024
I am planning to take this exam. Are these 257 questions enough to clear it? Also, does each section have a passing percentage, or is it based on the overall ?
INDIA
upvote