| Exam Code/Number: | CPA-21-02Join the discussion |
| Exam Name: | CPA - C++ Certified Associate Programmer |
| Certification: | C++ Institute |
| Question Number: | 256 |
| Publish Date: | Jun 12, 2026 |
|
Rating
100%
|
|
What is the output of the program?
#include <iostream>
using namespace std;
#define SQR(x)(x*x)
int main(int argc, char *argv[]) {
int x, y=2;
x = SQR(y);
cout << x << ", " <<y;
return 0;
}
What is the output of the program if characters 'h', 'e', 'l', 'l' , 'o' and enter are supplied as input?
#include <iostream>
#include <string>
using namespace std;
void f();
int main()
{
f();
return 0;
}
void f()
{
char c;
c = cin.get();
cout << c;
if(c != '\n')
f();
}
Which code line inserted instead of the comment below will cause the program to produce the expected output?
What happens when you attempt to compile and run the following code?
#include <cstdlib>
#include <iostream>
using namespace std;
inline float sum(float a,float b)
{
return a+b;
}
int main()
{
float a,b;
a = 1.5; b = 3.4;
cout<<sum(a,b);
return 0;
}
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class First
{
string *s;
public:
First() { s = new string("Text");}
~First() { delete s;}
void Print(){ cout<<*s;}
};
int main()
{
First FirstObject;
FirstObject.Print();
FirstObject.~First();
}
Enter your email address to download c-plus-plus-institute.CPA-21-02.premium Dumps