1. A(n) ____________________ is a variable or expression listed in a call to a function.
2. The pass by ____________________ mechanism must be used if the calling code is to receive information back from the function.
3. True or False? If there are several items in a parameter list, the compiler matches the parameters and arguments by their relative positions in the parameter and argument lists.
4. True or False? In C++, a function definition may have another function definition nested within it.
5. If an ampersand (&) is not attached to the data type of a parameter, then the corresponding argument can be:
a. a constant
b. a variable name
c. an arbitrary expression
d. a and b above
e. a, b, and c above
6. Given the function prototype void Fix( int&, float ); which of the following is an appropriate function call? (someInt is of type int, and someFloat is of type float.)
a. Fix(24, 6.85);
b. someFloat = 0.3 * Fix(someInt, 6.85);
c. Fix(someInt + 5, someFloat);
d. a and c above
e. none of the above
7. For the function definition
void Func( int gamma )
{
cout << 3 * gamma;
}
which of the following comments describes the direction of data
flow for gamma?
a. /* in */
b. /* out */
c. /* inout */
8. When arguments are passed between the calling code and the called function, parameters and their corresponding arguments are matched by:
a. their data types
b. their relative positions in the parameter and argument lists
c. their names
d. whether they are inputs to or outputs from the function
9. True or False? The use of reference parameters helps to avoid unintentional changes to arguments.
10. Given the function heading
void GetNums( int howMany,
float& alpha,
float& beta )
which of the following is a valid function prototype for
GetNums?
a. void GetNums( int howMany, float& alpha, float& beta );
b. void GetNums( int, float&, float& );
c. int GetNums( int, float&, float& );
d. a and b above
e. a, b, and c above
Answer 1: argument
Answer 2: pass by value
Answer 3: true
Answer 4: false, we can't have
Answer 5: a and b and c
Answer 6:None of the above, we can't pass constant to reference
parameter
Answer 7: b
as we are printing
Answer 8: b. their relative positions in the parameter and argument lists
Answer 9: false, const will help
Answer 10:a and b
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
1. A(n) ____________________ is a variable or expression listed in a call to a function. 2....
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)...
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...
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...
I need the real code for this program: (convert pseudocode to C++) ——————————————————— Start Program Type Vector is Structure Defined x is double variable y is double variable End Vector Type Function Prototype Get Choice(parameters: int &) Function Prototype vAddition (parameters: vector v1, vector v2, vector &v3) Function Prototype vSubstract(parameters: vector v1, vector v2, vector &v3) Function Prototype sMult(parameters: int k, vector v, vector &v3) Function Prototype sProduct (parameters: vector v1, vector v2) Function Prototype getMag (parameter: vector v) Function...
ANY ANSWER IS MUCH APPRECIATED. THANK YOU!! QUESTION 1 ________ are useful for returning more than one value from a method. Default arguments Parameter lists Reference parameters Named arguments 1 points QUESTION 2 When you call a ________ method, it executes its code and returns without passing any value back to the program statement that called it. void private terminal value-returning 1 points QUESTION 3 You can pass string literals as arguments to methods containing string parameters. True False...
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...
c++ 1) Write a header file that contains the prototype for a function that takes two value parameters (both floats) and returns a single character output. The function name is “charIn”. We do not care what the function does at this point. (8) 2) Fix the Errors of the C++ program: a. #include <cmath> b. Void main(){cout<< “Math test”<<endl;//start math test c. Int i=10 int j=3 k=i%3 cout << “test of mod<<k<<endl d. Float d=0 float f=e/d cout << “div...
Need help problem 9-13
C++ Homework please help
WRITE FUNCTION PROTOTYPES for the following functions. The functions are described below on page 2. (Just write the prototypes) When necessary, use the variables declared below in maino. mm 1.) showMenu m2.) getChoice 3.) calcResult m.) showResult 5.) getInfo mm.) showName 7.) calcSquare 8.) ispositive int main { USE THESE VARIABLES, when needed, to write function prototypes (#1 - #8) double num1 = 1.5; double num2 = 2.5; char choice; double result;...
COSC 112 Test #3 Spring 2019 20. It is not necessary to specify the parameter name in the parameter list of a function prototype even 21. Which of following is not a situation when reference parameters are useful? though there is a default parameter. (True/False) a. When you don't want to have side effects b. When you need to change the actual parameter c. When you need to return more than one value d. When you want to save memory...
81. The following function call doesn’t agree with its prototype: cout << BoxVolume( 10, 5 ); int BoxVolume(int length = {1}, int width = {1}, int height = {1}); T__ F__ 82. The following function is implemented to swap in memory the argument-values passed to it: void swap(int a, int b) { int temp; temp = a; a = b; b = temp; ...