Question

Question 1 Answer the questions below about this function prototype: double coinTotal (double coinValue, int nCoins);...

Question 1

Answer the questions below about this function prototype:

double coinTotal (double coinValue, int nCoins);

What is the type of the return value?  

How many parameters does the function take?

What is the name of the function?

Question 2

These are defined in the function heading and tell a user what data needs to be sent to a function.

Question 3

What is the term used for a variable sent as data in a function call, such as n1 in the example below?

int n1;

int convertedValue = convert(n1);

Group of answer choices

formal parameter

argument

return type

Flag this Question

Question 4

Which statement is correct about a function prototype?

Group of answer choices

A function prototype is always optional.

A function prototype is only used in a header file.

A function prototype lets the compiler know what the return type and parameter types are for a function.

A function prototype is always placed after a call to the function.

Question 5

What is the term for using a function?

Group of answer choices

call

function

use

access

Question 6

Which statement is not true about using functions?

Group of answer choices

It allows code reuse.

It provides easier testing and debugging.

It breaks a large problem into smaller ones.

It doesn't let you break up your program into different files.

Question 7

For the function and function call shown below, which statement is true about the relationship between n1 and valueToConvert?

int n1;

int convertedValue = convert(n1);

int convert (int valueToConvert)

{

// function body is here

}

Group of answer choices

n1 and valueToConvert point to the exact same location in memory

n1 is a copy of valueToConvert

valueToConvert will have the same value as n1

valueToConvert has no relationship to n1

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q1.

Given prototype is
double coinTotal(double coinValue, int nCoins)

Return type is 'double'
Function takes 2 parameters, 'coinValue' and 'nCoins'
Name of the function is 'coinTotal'


Q2.

Arguments let the user know what data needs to be sent

Q3.

int convertedValue = convert(n1);

n1 is an 'argument' to the function

Q4.

A function prototype lets the compiler know what the return type and parameter types are for a function.

Q5.

Using is function is known as making a function 'call'
'call'

Q6.

It doesn't let you break up your program into different files.

We can spread multiple functions across different files

Q7.

int n1;

int convertedValue = convert(n1);

int convert (int valueToConvert)

{

// function body is here

}

When we make a function call, valueToConvert will have same value as n1

(c) valueToConvert will have the same value as n1

Add a comment
Know the answer?
Add Answer to:
Question 1 Answer the questions below about this function prototype: double coinTotal (double coinValue, int nCoins);...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • answer in c++ Using the table below, complete the C++ code to write the function prototype...

    answer in c++ Using the table below, complete the C++ code to write the function prototype statement, and the void function header. The void function should receive three double variables: the first two by value and the last one by reference. Name the formal parameters num1, num2 and answer. The function should divide the num1 variable by the num2 variable and then store the result in the answer variable. Name the function calcQuotient. Also write an appropriate function prototype for...

  • What is the selection that best describes the following statement: int function( int, double [ ] ...

    What is the selection that best describes the following statement: int function( int, double [ ] ); A) function prototype B) function call C) function definition D) none of the above

  • 1. Write a statement that calls a function named showSquare, passing the value 10 as an...

    1. Write a statement that calls a function named showSquare, passing the value 10 as an argument. 2. Write the function prototype for a function called showSquare. The function should have a single parameter variable of the int data type and areturn type of void. 3. Write the function prototype for a function called showScoreswith a parameter list containing four integer variables and a return type of void. 4. Look at the following function definition: double getGrossPay(int hoursWorked, double payRate)...

  • A(n) is a piece of data that is sent to a function when the function is...

    A(n) is a piece of data that is sent to a function when the function is called. argument parameter packet code All of these are true A variable is declared outside all functions. local global floating-point counter None of these Look at the following function prototype, int myFunecion(double); What is the data type of the function's return value? inc double void Can't tell from the prototype Look at the following function prototype. int myFunction(double, double, double); How many parameter variables...

  • Consider the function prototype below. Write the missing function call. float Rent(float , int &); int...

    Consider the function prototype below. Write the missing function call. float Rent(float , int &); int main() { int d; // Days in hotel. float r=149.55; // Daily Rate (r). float cost; // Total cost of stay of d days. cout << "Daily room rate = $" << r << endl; cout << "#Days you will be staying: "; cin >> d; ______________________________________________ // MISSING statement. cout << "The cost of your stay of " << d << " days...

  • c++ • return type function name (parameter); • Ex: int Joe(int, int); • Ex: void gg(int,...

    c++ • return type function name (parameter); • Ex: int Joe(int, int); • Ex: void gg(int, float); • Ex: double Two_sol(double, double, double): 2. fC → function call • Ex: cout << Joe(); • Ex: Joe(5, 0); 3. fD → function definition return type function name of STATEMENT(S) return function name: **program84 Void functions to print "Welcome to the world of functions!" programs. To print the sum and product of 2 numbers using functions w/out parameters. program86: to print the...

  • 1. What does the below C++ statement do? vector<double> myVec(20); Group of answer choices A.It creates...

    1. What does the below C++ statement do? vector<double> myVec(20); Group of answer choices A.It creates a vector object that can only store values of 10 or less. B.It creates a vector object with a starting size of 10. C.It creates a vector object and initializes the first element with the value 20. D.It creates a vector object with a starting size of 20. 2. A recursive function contains a call to itself, but is limited to 10 recursive calls...

  • This is C++ Question 1 (12 points) (2 points each) Matching (match each answer only once)...

    This is C++ Question 1 (12 points) (2 points each) Matching (match each answer only once) match function type to function. Function header with a reference parameter 1. myFun(x); Function prototype with an array parameter 2. int myFun(int x) Function header that returns a value 3. void myFun(int &x) Function call 4. void myFun(int, int =0); 5. void myFun(int x) Function prototype with a default value 6. void myFun(int[], int); Function header with no return value

  • C++ Questions. Question 1 What would the function prototype in the class declaration for the following...

    C++ Questions. Question 1 What would the function prototype in the class declaration for the following member function look like? void Fractions::showData() { if((num < 0 && denom < 0) || denom < 0) { num = -num; denom = -denom; } cout << num << "/" << denom << endl; } Question 2 What would the function header of the following member function prototype in class Fractions be? Fractions operator+(const Fractions &f2); Question 3 What would the function prototype...

  • Consider the following program: # include <iostream> using namesapce std; void Func(int a, int bl double...

    Consider the following program: # include <iostream> using namesapce std; void Func(int a, int bl double number-25.0: int main) f int x-18, y-20; cout<c"Before: x- kex<" and y-eyecendl; Fundxy 1// end of main void Funcfint a, int b) int sum a+b; a-200; b-300; numberanumber+1.0 Which of the statements below are correct? (Select only the correct answers. There may be more than one) D A The statement double number-25.0; declares a global variable number B. The variables x and y are...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT