Given the function definition, which of the following are correct?

```
int func(int n, double d)
{
int j = n;
double sum = 0;
while( j >= 0)
{
sum += d;
-j;
}
return sum;
}
With arguments 7and 2.0
```

a) returns 7*2
b) returns 7+2
c) returns 7!
d) There is a syntax error in the program so it won’t run.
e) It compiles but computes none of these.


e) It compiles but computes none of these.

The loop will not terminate, since the operator on j is a unary -, not the decrement operator --. (It appears to be unsuccessfully trying to compute n*d.)

Computer Science & Information Technology

You might also like to view...

What would be the result of executing the following code?

int[] x = {0, 1, 2, 3, 4, 5}; a. An array of 6 values, all initialized to 0 and referenced by the variable x will be created. b. An array of 6 values, ranging from 0 through 5 and referenced by the variable x will be created. c. The variable x will contain the values 0 through 5. d. A compiler error will occur.

Computer Science & Information Technology

Which PPP LCP feature(s) disable(s) an interface that exceeds an error percentage threshold, enabling rerouting over better routes?

A) PAP B) CHAP C) Multilink PPP D) LQM E) Magic Number F) Isolation bit G) High water mark

Computer Science & Information Technology

Match each digital media to its use.

A. Use to create synthesized sounds B. Use to dictate a text message hands-free C. Use to watch a basketball game in real time D. Use to play the game Fragments E. Use to watch a favorite TV show at your convenience

Computer Science & Information Technology

In directory access commands and URLs, what does “..” represent?

A. It means stay in the current directory. B. It means move to the parent of the current directory. C. It means move to the child of the current directory. D. It means move to the root of the current directory.

Computer Science & Information Technology