Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

rand()/static_cast <double> (RAND_MAX)*2 +3 3.0*(RAND_MAX-rand())/RAND_MAX + 2 Q

ID: 3712549 • Letter: R

Question

rand()/static_cast <double> (RAND_MAX)*2 +3 3.0*(RAND_MAX-rand())/RAND_MAX + 2

QUESTION 4

A call to a C++ function is

The name of the function followed by a number of arguments not greater than the number of parameters in the definition

The name of the function followed by exactly the number of arguments as there are parameters in the definition

The name of the function followed by empty parentheses

The name of the function followed by any number of arguments, regardless of the number of parameters in the definition

10 points Save AnswerSave Answer

QUESTION 5

Which is incorrect?
C++ predefined functions

are usually provided with the C++ compiler make C++ harder than necessary
must use #include for the proper header file are usually provided in libraries

10 points Save AnswerSave Answer

QUESTION 6

Which of the following statements about the definition and declaration of functions is incorrect? (Note. Function definition includes the body of the function also called function block)

A function header is exactly the same as function prototype except for the semicolon A function definition is a function header followed by the function block
Function declaration is exactly the same as function prototype
Function definition is exactly the same as function prototype

10 points Save AnswerSave Answer

QUESTION 7

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

cout << “Enter a value, I’ll multiply it by “ << NUM << endl;

cin >> value;

10 points Save AnswerSave Answer

return 0; }

}

the line
doublenumTimes(int x); is a function definition

The variable x is a parameter in function numTimes
the variable value is an argument in a call to numTimes The line return d; in the function numTimes is necessary

QUESTION 8

Assume this code fragment is embedded in an otherwise correct and complete program. What should be the output from this code segment?

.. .

}

0
10
9
The variable i is undefined in this scope, so this should not compile

10 points Save AnswerSave Answer

QUESTION 9

A void function can have
as many arguments as the programmer wishes

no arguments
exactly one argument
no more than 3 arguments

10 points Save AnswerSave Answer

QUESTION 10

A semicolon does not (usually) go after these with the exception of

10 points Save AnswerSave Answer

if (condition)
int main()
while (condition)
a function header to make it a function declaration

QUESTION 11

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

cout << “Enter a value, I’ll multiply it by “ << NUM << endl;

}

NUM is a global variable
value is a local variable in the main function d is a local variable in the main function num is a global constant

10 points Save AnswerSave Answer

QUESTION 12

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

sum += d; -j;

10 points Save AnswerSave Answer

QUESTION 13

1. Write a function that calculates the area, a, of a circle when its circumference c is given. The formula is:

2. Write a function that returns the radius, r, of the circle, given the circumference c. The formula is:

3. Write a C++ program that accepts the value of the circumference from the user, calculates the radius and area and displays the calculated values. Use the functions written in 1 and 2.

Hint. Do 2 first, then 1.
Selected Answer: quiz 5.zip Remove

Attach File

Click Save and Submit to save and submit. Click Save All Answers to save all answers.

Remove
BrowseMyComputerBrowseContentCollectionBrowseDropbox

SaveAllAnswers

SaveandSubmit

Explanation / Answer

If you post more than 1 question, as er chegg guidelines I have to solve only first question.

Ques 4. Answer : (b) The name of the function followed by exactly the number of arguments as there are parameters in the definition

We pass the same number of arguments as in the function definition. Otherwise a compile time error will be generated.

Ques 6. Answer : (c) Function definition is exactly the same as function prototype

A function prototype is just the heading of the function, but a function definiiton also includes the code of the function.