Filters
Question type

It is illegal to call other functions from inside a function definition.

A) True
B) False

Correct Answer

verifed

verified

A stub is a function that is completely defined and well tested

A) True
B) False

Correct Answer

verifed

verified

Call-by-reference parameters are passed


A) nothing
B) the actual argument.
C) the value in the actual argument.
D) the address of the argument.

E) A) and D)
F) A) and B)

Correct Answer

verifed

verified

Which of the following is true for a void function?


A) There cannot be a return statement.
B) The value of void should be returned.
C) The value of 0 should be returned.
D) Nothing is returned.

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

Using functions in a program is called _____________.

Correct Answer

verifed

verified

procedural...

View Answer

The postcondition of a function


A) determines how the function will complete its job.
B) tells what must be true before the function executes.
C) declares the function for the compiler.
D) tells what will be true after the function executes.

E) None of the above
F) B) and D)

Correct Answer

verifed

verified

A ________ is a simplified version of a function used to test the main program.

Correct Answer

verifed

verified

stub

Given the following function declaration and local variable declarations,which of the following is not a correct function call? Int myInt; Float myFloat; Char ch; Void someFunctionint& first,float second,char third) ;


A) someFunction1,2.0,ch) ;
B) someFunctionmyInt,myFloat,ch) ;
C) someFunctionmyInt,2.0,'c') ;
D) someFunctionmyInt,myFloat,'1') ;

E) B) and D)
F) None of the above

Correct Answer

verifed

verified

A

A ___________ is a main program that only checks that functions execute correctly.

Correct Answer

verifed

verified

pre and post conditions for a function should be written before/after)the function definition is written.

Correct Answer

verifed

verified

Which of the following are true?


A) a function can call another function.
B) as long as the function is defined anywhere in your program,it can be used anywhere else.
C) a function definition can contain another function definition.
D) if you have function prototypes,the order in which you define your functions is important.

E) B) and D)
F) A) and B)

Correct Answer

verifed

verified

Testing a program with values that are close to values that will change the execution of a program is called _________________.

Correct Answer

verifed

verified

The preconditions) for a function describe:


A) What is true after the function is executed
B) What the function does
C) How to call the function
D) What must be true before the function executes

E) All of the above
F) None of the above

Correct Answer

verifed

verified

What is wrong with the following function body? Void calculateint count,float price,float& cost) { If count < 0) Cost=0.0; Else Cost=count*price; Return; }


A) void functions may not have a return statement.
B) void functions must return a value
C) nothing
D) can not mix reference and value parameters

E) None of the above
F) A) and D)

Correct Answer

verifed

verified

It is acceptable to have both call-by-value and call-by-reference parameters in the same function declaration.

A) True
B) False

Correct Answer

verifed

verified

In the following function,what is passed to the first parameter? Void f1 int& value1,int value2) ; Int x,y; F1x,y) ;


A) The value of x
B) nothing,it is a void function
C) the value of y
D) the variable x or its memory location)

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

If you were to write a function for displaying the cost of an item to the screen,which function prototype would be most appropriate?


A) void display) ;
B) void displayfloat myCost) ;
C) int display float myCost) ;
D) float display) ;

E) B) and C)
F) A) and C)

Correct Answer

verifed

verified

What is the output of the following function and function call? Void calculateCostint count,float& subTotal,float taxCost) ; Float tax = 0.0, Subtotal = 0.0; CalculateCost15,subtotal,tax) ; Cout << "The cost for 15 items is " << subtotal << ",and the tax for " << subtotal << " is " << tax << endl; //end of fragment Void calculateCostint count,float& subTotal,float taxCost) { If count < 10) { SubTotal = count * 0.50; } Else { SubTotal = count * 0.20; } TaxCost = 0.1 * subTotal; }


A) The cost for 15 items is 3.00,and the tax for 3.00 is 0.30;
B) The cost for 15 items is 0.00,and the tax for 3.00 is 0.00;
C) The cost for 15 items is 0.00,and the tax for 3.00 is 0.30;
D) The cost for 15 items is 3.00,and the tax for 3.00 is 0.00;

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

What is the correct way to call the following function? Assume that you have two variables named intArgument int)and floatArgumentfloat). void doThingsfloat x,int y);

Correct Answer

verifed

verified

doThingsfloatArgument,intArgument);

Which of the following is a legal call to the displayOutput function? Void displayOutputint total) ;


A) void displayOutputmyTotal) ;
B) displayOutputint mytotal) ;
C) displayOutputmyTotal) ;
D) cout << displayOutputmyTotal) ;

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

Showing 1 - 20 of 53

Related Exams

Show Answer