C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 1 Topic 1 Discussion

C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 1 Topic 1 Discussion

CPA-21-02 Exam Topic 1 Question 1 Discussion:
Question #: 1
Topic #: 1

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

#include

using namespace std;

void fun(int*);

int main()

{

int *x;

int i=2;

x=&i;

fun(x);

cout<

return 0;

}

void fun(int *i)

{

*i = *i * *i;

}


A.

It prints: 2


B.

It prints: 4


C.

It prints: 0


D.

It prints: 1


Get Premium CPA-21-02 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.