Want to pass your CPA - C++ Certified Associate Programmer CPA-21-02 exam in the very first attempt? Try Pass2lead! It is equally effective for both starters and IT professionals.
VCE
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main (int argc, const char * argv[])
{
int a = 30, b = 1, c = 5, i=10;
i = b < a < c;
cout << i;
return 0;
}
A. compilation fails
B. It prints: 10
C. It prints: 0
D. It prints: 1
What happens when you attempt to compile and run the following code?
#include
using namespace std;
class BaseC
{
public:
int *ptr;
BaseC() { ptr = new int(10);}
BaseC(int i) { ptr = new int(i); }
~BaseC() { delete ptr; }
};
void fun(BaseC x);
int main()
{
BaseC *o = new BaseC(5);
fun(*o);
}
void fun(BaseC x) { cout << "Hello:"<<*x.ptr; }
A. It prints: Hello:50
B. It prints: Hello:10
C. It prints: Hello:5
D. Compilation error
Which of the following is a correct way to define the function fun() in the program below?
#include
#include
#include
using namespace std;
int main()
{
int a[2][2];
fun(a);
return 0;
}
A. void fun(int *p[2]) {}
B. void fun(int *p[2][2]) {}
C. void fun(int *p[][2]) {}
D. void fun(int p[][2]) {}