Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

rand()/static_cast (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

rand()/static_cast (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?

 #include  const double NUM = 2.9345358; double num = 3; double numTimes(int x); int main( ) { 
 using namespace std; int value; 

cout << Enter a value, Ill multiply it by << NUM << endl;

cin >> value;

10 points Save AnswerSave Answer

 cout << You entered  << value <<  NUM times this is  << numTimes(value) << endl; 

return 0; }

 double numTimes(int x) { 
 double d; d = NUM * x; return d; 

}

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?

 { for( int i = 0; i < 10; i++) { 

.. .

}

 cout << i << endl; } 

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?

 #include  const double NUM = 2.9345358; double num = 3; double numTimes(int x); int main( ) { 
 using namespace std; int value; 

cout << Enter a value, Ill 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; 

}

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?

 int func(int n, double d) { 
 int j = n; double sum = 0; while( j >= 0) { 

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions