Here is a small program. Which of the statements about the variables is correct?

```
#include
const double NUM = 2.9345358;
double num = 3;
double numTimes(int x);
int main( )
{
using namespace std;
int value;
cout << “Enter a value, I’ll multiply it by “
<< NUM << endl;
cin >> value;
cout << “You entered “ << value
<< “ NUM times this is “ << numTimes(value)
<< endl;
return 0;
}
double numTimes(int x)
{
double d;
d = NUM * x;
return d;
```
a) NUM is a global variable.
b) num is a global constant.
c) value is local variable in the main function
d) d is a local variable in the numTimes function.

c) value is local variable in the main function
d) d is a local variable in the numTimes function.

Computer Science & Information Technology

You might also like to view...

The ________ function category performs calculations such as averages and standard deviations

Fill in the blank(s) with correct word

Computer Science & Information Technology

Which of the following statements is false?

a. The principle of least privilege states that code should be granted only the amount of privilege and access that it needs to accomplish its designated task, but no more. b. An example of the principle of least privilege is the scope of a local variable, which should not be visible when it’s not needed. This is why a function’s local variables are placed in stack frames on the function-call stack, so they can be used by that function while it executes and go away when it returns. c. Once a stack frame is popped, the memory that was occupied by it can be re-used for new stack frames. d. Functions can see each other’s local variables by accessing each other’s stack frames.

Computer Science & Information Technology