Question: i need these solved Look at the following program and answer the question that follows it. They are multiple choice i need the correct one

i need these solved

Look at the following program and answer the question that follows it. They are multiple choice i need the correct one and explanation

1.

18) What is the output of the following program?

#include

using namespace std;

void showDub(int);

int main()

{

int x = 2;

showDub(x);

cout << x << endl;

return 0;

}

void showDub(int num)

{

cout << (num * 2) << endl;

}

A) 2

2

B) 4

2

C) 2

4

D) 4

4

2.

What is the output of the following program?

#include

using namespace std;

int getValue(int);

int main()

{

int x = 2;

cout << getValue(x) << endl;

return 0;

}

int getValue(int num)

{

return num + 5;

}

A) 5

B) 2

C) 7

D) "getValue(x)"

3.

Look at the following function prototype.

int myFunction(double);

What is the data type of the function's parameter variable?

A) int

B) double

C) void

D) Can't tell from the prototype

4.

Find the five errors in the following program, there are syntax as well as logic errors in the program, the output should be:

This program tells you how long it takes

to accumulate a debt of $100, starting with

an initial balance of $50 owed.

The interest rate is 2% per month.

After 36 months,

your balance due will be $101.99

#include

int main()

{

double balance = 50.00;

int count = 0;

cout << "This program tells you how long it takes "

<< "to accumulate a debt of $100, starting with "

<< "an initial balance of $50 owed. "

<< "The interest rate is 2% per month. ";

while (balance > 100.00)

{

balance = balance + 0.02 * balance;

cont++;

}

cout << "After " << count << " months, ";

cout.setf(ios::fixed);

cout.setf(ios::showpoint);

cout.precision(2);

cout << "your balance due will be $" << balance << ;

}

Program errors

1.

2.

3.

4.

5.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!