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...

  • 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...

  • 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

  • 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...

  • double sinLoops (double x) { int i = 7; //this didn't exist. double result = 1/(m+1)...

    double sinLoops (double x) { int i = 7; //this didn't exist. double result = 1/(m+1) // line 3 double pi=3.14; //You need the individual taylor series element. do { double num = x; //these need to be reset each time. double fac = 1; //if not they overflow and infinity/infinity is NaN and it exits. for (int counter = 1; counter < (2 * i + 1); counter++) { } (2 * i + 1); counter2 >= 1; counter2--)...

  • 1. Answer the questions considering the following functions headers: int func1(int x, double w) double func2(string...

    1. Answer the questions considering the following functions headers: int func1(int x, double w) double func2(string I, int y, double r) char func3(int z, int s, double t, char a) a. How many parameters does function func1 have? What is the type of function func1? b. How many parameters does function func2 have? What is the type of function func22 c. How many parameters does function func3 have? What is the type of function func3? d. Write a C++ statement...

  • ​​​​​​ 11.   A _____________ error does not cause the compiler to generate an error, but does...

    ​​​​​​ 11.   A _____________ error does not cause the compiler to generate an error, but does cause the program to produce incorrect results. Syntax, logic, variable name, function name 12.   A syntax error occurs when the programmer violates one or more grammar rules of the C language. True or False 13.   Given this line of code: y = sqrt(x); x would be known as the argument. True or False 14.   A void function does not return a value to the...

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
ADVERTISEMENT