C++ Institute CPA-21-02 - CPA - C++ Certified Associate Programmer
Which definitions are correct?
What will be the output of the program?
#include
#include
using namespace std;
int fun(int);
int main()
{
float k=3;
k = fun(k);
cout< return 0; } int fun(int i) { i++; return i; }
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
int i = 4;
while(i >= 0) {
cout<
i??;
}
return 0;
}
What is the expected result of the following program?
Which code line instead of the comment below will cause the program to produce the expected output?
If there is one, point out an error in the program
#include
using namespace std;
int main()
{
int i=1;
for(;;)
{
cout<
if(i>5)
break;
}
return 0;
}
What is the output of the program?
#include
using namespace std;
#define PRINT(i) cout<
int main()
{
int y=2, z=3;
PRINT(y);
PRINT(z);
return 0;
}
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;
}
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
int f(int i);
int main()
{
int i=0;
i++;
for (i=0; i<=2; i++)
{
cout< } return 0; } int f(int a) { return a+a; }
What is the expected output of the following program?