Question

Which is a legal call to the function? "myTotal" is an integer variable. void report(int total);...

Which is a legal call to the function? "myTotal" is an integer variable.

void report(int total);

a)report( );

b)report(myTotal);

c)int report(myTotal);

d)report(int myTotal);

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

Correct Answer

b) report(myTotal);

Reason

The function call must match the syntax of the programming language.

That is - function_name(arguments);

Explanation

The function call must include the name of a function and an argument according to its prototype.

In this case, the prototype is -

void report(int total);

Hence the function should be in a format, without any data types included.

The correct answer is - report(myTotal);

Rest of them are wrong (as explained below) -

a)report( ); - no argument passed

c)int report(myTotal); - int keyword is not required

d)report(int myTotal); - int keyword is not required

Add a comment
Know the answer?
Add Answer to:
Which is a legal call to the function? "myTotal" is an integer variable. void report(int total);...
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
  • Which of the following is a variable declaration statement? a. int total; b.public static void main(...

    Which of the following is a variable declaration statement? a. int total; b.public static void main( String args[] ) c. import java.util.Scanner; d. // first string entered by user

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

  • 1. A(n) ____________________ is a variable or expression listed in a call to a function. 2....

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

  • QUESTION 62 Consider the following code: void Pancake(int x, int& y, int z); void Waffle(int& x,...

    QUESTION 62 Consider the following code: void Pancake(int x, int& y, int z); void Waffle(int& x, int& y); int Doughnut(int y, int z); int main( ) {             int a = 1;             int b = 2;             int c = 3;             int d = 4;             Pancake(a, b, c);             Waffle(b, c);             Pancake(d, c, b);             d = Doughnut(b, a);             return 0; } void Pancake(int x, int& y, int z) {             y += 3;            ...

  • Use only C++ for all function Introduce a call-by-value function that computes the volume of a...

    Use only C++ for all function Introduce a call-by-value function that computes the volume of a box. Hint: Length, width, and height of a box is needed. Introduce a call-by-reference function with void output. that computes the square of an integer. Please double check the value of the function input before and after function call. Introduce a call-by-pointer function with void output. that computes the square of an integer. Please double check the value of the function input before and...

  • Which of the following is a valid function call to the function declared in the following...

    Which of the following is a valid function call to the function declared in the following prototype? vold calcResult (int A. calcResult ( 10 ) B. calcResult (10) C. void calcResult ( 10 ) D. vold calcResult(int x) Reset Selection

  • Consider the following function definition and variable declarations: void square(int &n){n= n*n;} int arr[] = {1,...

    Consider the following function definition and variable declarations: void square(int &n){n= n*n;} int arr[] = {1, 2, 3}; int number = 4; Which of the following function calls are acceptable? (can have multiple answer) a.square(1); b.square(2); c.square(arr[number]); d.square(number); What is the output of the following code segment? int arr[] = {1, 4, 1, 0}; for (int i=0; i < 4; ++i)     cout<<arr[i]*2; a.1014 b.1 4 1 0 (space in between each number) c.1410 d.0140 e.None of the above Given...

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

  • Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int...

    Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int *a2) Write a program addition.c that reads in an array (a1) of numbers, and creates a new array (a2) of numbers such that the first and last numbers of a1 are added and stored as the first number, the second and second-to-last numbers are added and stored as the second number, and so on. You need to check for even and odd length of...

  • a) You will write a void function to get a positive integer between 1 and 12...

    a) You will write a void function to get a positive integer between 1 and 12 inclusive. The twelve numbers represent the months of the year. The user will be asked to enter an integer between 1 and 12 inclusive. If the number entered by the user is not within range, an appropriate error message will be displayed, and the user will be asked to try again until a valid number is entered. b) You will write a void function...

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