Prepare for the C++ Institute CPA - C++ Certified Associate Programmer Exam exam with our extensive collection of questions and answers. These practice Q&A are updated according to the latest syllabus, providing you with the tools needed to review and test your knowledge.
QA4Exam focus on the latest syllabus and exam objectives, our practice Q&A are designed to help you identify key topics and solidify your understanding. By focusing on the core curriculum, These Questions & Answers helps you cover all the essential topics, ensuring you're well-prepared for every section of the exam. Each question comes with a detailed explanation, offering valuable insights and helping you to learn from your mistakes. Whether you're looking to assess your progress or dive deeper into complex topics, our updated Q&A will provide the support you need to confidently approach the C++ Institute CPA-21-02 exam and achieve success.
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int f(int a, int b);
int main()
{
float b;
b = f(20,10);
cout << b;
return 0;
}
int f(int a, int b)
{
return a/b;
}
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;
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
namespace myNamespace1
{
int x = 5;
int y = 10;
}
namespace myNamespace2
{
float x = 3.14;
float y = 1.5;
}
int main () {
{
using namespace myNamespace1;
cout << x << " ";
}{
using namespace myNamespace2;
cout << y;
}
return 0;
}
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
class B;
class A {
int age;
public:
A () { age=5; };
friend class B;
};
class B {
string name;
public:
B () { name="Bob"; };
void Print(A ob) {
cout << name << ob.age;
}
};
int main () {
A a;
B b;
b.Print(a);
return 0;
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
class A
{
public:
void Print(){ cout<<"A";}
};
class B:public A
{
public:
virtual void Print(){ cout<< "B";}
};
int main()
{
A *obj;
A ob1;
obj = &ob1;
obj?>Print();
B ob2;
obj = &ob2;
obj?>Print();
}
Full Exam Access, Actual Exam Questions, Validated Answers, Anytime Anywhere, No Download Limits, No Practice Limits
Get All 257 Questions & Answers