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

Page 17 of 65

How could you pass arguments to functions?

  1. by value
  2. by reference
  3. by pointer
  4. by void

Answer(s): A,B,C



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

#include <iostream>
using namespace std;

int main(){
int i, j;
for(i = 0, j = 1; j < 2, i < 4; i++, j++);
cout << i << " " << j;

return 0;
}

  1. It prints: 4 5
  2. It prints: 2 3
  3. It prints: 3 2
  4. It prints: 4 3

Answer(s): A



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

#include <iostream>
#include <cstdarg>

using namespace std;

int mult(int f, int s, int t);

int main()
{
cout << mult(1,2,3);
return 0;
}

int mult(int f, int s, int t)
{
int mult_res;
mult_res = f*s*t;
return mult_res;
}

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

Answer(s): B



Which code, inserted at line 5, generates the output "ABC"?

#include <iostream>
using namespace std;
class A {
public:
//insert code here
};
class B:public A {
public:
void Print(){ cout<< "B"; }
};

class C:public B {
public:
void Print(){ cout<< "C"; }
};
int main()
{
A ob1;
B ob2;
C ob3;
A *obj;
obj = &ob1;
obj?>Print();
obj = &ob2;
obj?>Print();
obj = &ob3;
obj?>Print();
}

  1. void Print(){ cout<<"A";}
  2. virtual void Print(){ cout<<"A";}
  3. virtual void Print(string s){ cout<<s;}
  4. None of these

Answer(s): B



Page 17 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