quiz 2 - Chapter 5 Functions for All Sub Tasks TRUE/FALSE...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 5 Functions for All Sub Tasks TRUE/FALSE 1. A void function can return any value ANSWER: FALSE 2. A void function can be used in an assignment. ANSWER: FALSE 3. A void function may not be used in an output statement. ANSWER: TRUE 4. Functions can return at most one value. ANSWER: TRUE 5. The following is legal in a void function return; ANSWER: TRUE 6. In a function with call-by-reference parameters, the values of the actual arguments are passed to the function. ANSWER: FALSE, The actual variables (or more precisely their memory addresses) are passed. 7. In a function with call-by-reference parameters, any changes to the formal parameters will change the actual arguments passed to the function. ANSWER: TRUE 8. It is acceptable to have both call-by-value and call-by-reference parameters in the same function declaration. ANSWER: True 9. It is illegal to call other functions from inside a function definition. ANSWER: FALSE 10. A stub is a function that is completely defined and well tested ANSWER: FALSE SHORT ANSWER 1. A ___________ is a main program that only checks that functions execute correctly. ANSWER: driver 2. The values or variables listed in the function declaration are called _________ to the function. ANSWER: (formal) parameters 3. Given the following function definition fragment, for which values of myInt should the function be tested? int doSomething(int myInt) { if(myInt < 0) { //do some stuff here } } ANSWER: -1, 0,1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4. When the address of the actual argument is passed to the formal parameter, this is called __________________________ ANSWER: call-by-reference –or- pass-by-reference 5. If we want to test if a given function works correctly, we would write a _________ to test it. ANSWER: driver 6. The variables passed a function are called _________. ANSWER: arguments 7. What is the correct way to call the following function? _________________________ void setDisplay(); ANSWER: setDisplay(); 8. A function that does not return a value is known as a ________ function. ANSWER: void 9. What type of value does a void function return? ____________ ANSWER: nothing 10. What symbol is used to signify that a parameter is a reference parameter? ______ 11. What is the correct way to call the following function? Assume that you have two variables named intArgument (int) and floatArgument(float). void doThings(float x, int y); ANSWER: doThings(floatArgument, intArgument); 12. Using functions in a program is called _____________. ANSWER: procedural abstraction 13. pre and post conditions for a function should be written (before/after ) the function definition is written. ANSWER: before
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/02/2012 for the course CSC CSC 175 taught by Professor Kraft during the Winter '12 term at Michigan Flint.

Page1 / 10

quiz 2 - Chapter 5 Functions for All Sub Tasks TRUE/FALSE...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online