Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

Question What is a Roth 403 (b) plan?

Answered: 1 week ago