Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please explain questiom #27 19. Which is a valid usage of bar given the followin

ID: 663035 • Letter: P

Question

Please explain questiom #27

19. Which is a valid usage of bar given the following function prototype (assume all

variables are of type int and have been declared and initialized):

int bar(int a, int &b);

a.bar(c, 4); c. bar(d, bar(2,3));

b.bar(a, b + 2); d. bar(bar(2,e), d);

21. Complete the following code so that n powers of 2 will be output:

for( [CODE HERE] )

cout << i;

a.int i = 0; i < pow(2, n); i *= 2

b.int i = 0; i <= pow(2, n); i *= 2

c.int i = 1; i <= pow(2, n); i *= 2

d.int i = 0; i < pow(2, n

Explanation / Answer

actually there are mistakes in the question syntactically

if suppose the code is like below then

int x = 3, y = 7;
if (x > y);

if (x == y);

else
cout << x- y << " ";
cout << x + y << " ";
cout << x * y << " ";

u missed an semicolon in if(x==y);

here x=3 and y=7

so x>y is false and first if loop will not be executed(though there is nothing to execute)

and same in the case of x==y

so else will be executed in first cout no operator is assigned between them this is second error

assign any operator and the code will be executed

if the operator is '-' then the answer would be -4 10 21