Chapter 6 Test

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

If a function is overloaded, then in a call to that function, the ________ determines which function to execute. a. signature b. scope c. declaration d. definition

Answer: a. signature

A formal parameter is a ________. a. variable declared in the function header b. variable that is declared within a block of code c. variable or expression listed in a call to a function d. value that cannot be changed in a function

Answer: a. variable declared in the function header

Which of the following statements is TRUE? a. Void functions can be used (called) in an expression. b. A call to a void function is a standalone statement. c. A void function must have a data type. d. A void function must have at least one formal parameter.

Answer: b. A call to a void function is a standalone statement.

Which of the following statements is true of a value-returning function? a. A value returning function can only contain one return statement. b. A return statement can only return one value. c. A return statement cannot contain more than one expression. d. A value-returning function is not required to return a value.

Answer: b. A return statement can only return one value.

The C++ function ______ calculates the largest whole number that is less than or equal to x. a. eqwhole(x) b. floor(x) c. abs(x) d. ceil(x)

Answer: b. floor(x)

A call to a value-returning function with an empty formal parameter list has the form ________. a. functionName b. functionName() c. functionName(void) d. void functionName

Answer: b. functionName()

The tolower function takes one parameter of type _____. a. bool b. int c. string d. char

Answer: b. int

Stream variables should be passed by ________ to a function. a. value b. reference c. result d. none of the above

Answer: b. reference

The ______ of an identifier refers to where in the program an identifier is accessible. a. definition b. scope c. parameter d. behavior

Answer: b. scope

The C++ function pow has _____ parameters. a. zero b. two c. one d. three

Answer: b. two

A variable for which memory is allocated at block entry and deallocated at block exit is called a(n) ____ variable. a. unique b. static c. automatic d. identification

Answer: c. automatic

The heading of a function includes all of the following EXCEPT the ______. a. number of parameters b. data type of the return value c. code required to accomplish the task d. data type of the parameters

Answer: c. code required to accomplish the task

A _______ parameter is a formal parameter that receives the location (memory address) of the corresponding actual parameter. a. static b. memory c. reference d. value

Answer: c. reference

In C++, :: is called the scope ______ operator. a. equivalent b. identity c. resolution d. comparison

Answer: c. resolution

An actual parameter is a ______. a. variable that is declared within a block of code b. value that cannot be changed in a function c. variable or expression listed in a call to a function d. variable declared in the function header

Answer: c. variable or expression listed in a call to a function

Which of the following statements is TRUE? a. A global named constant must be defined in the main function. b. The value of a global named constant cannot be accessed from anywhere in the program. c. Unlike using global variables, using global named constants can introduce detrimental side effects to your program. d. The value of a global named constant be changed during program execution.

Answer: d. The value of a global named constant be changed during program execution.

______ parameters provide a one-way link between actual parameters and formal parameters. a. Global b. Reference c. Static d. Value

Answer: d. Value

Which of the following statements is FALSE? a. Default values can be constants, global variables, or function calls. b. The calling function has the option of specifying a value other than the default for any default parameter. c. If you do not specify the value of a default parameter, the default value is used for that parameter. d. You can assign a constant value as a default value to a reference parameter.

Answer: d. You can assign a constant value as a default value to a reference parameter.

A program that tests a function is called a _________ program. a. passenger b. testing c. sample d. driver

Answer: d. driver

When using a reference parameter, a constant value or an expression cannot be passed to a ______ parameter. a. constant reference b. nonconstant value c. nonconstant or constant value d. nonconstant reference

Answer: d. nonconstant reference


Ensembles d'études connexes

Chapter 17- Externalities & Public Goods

View Set

chapter 16; scientific rev/enlightenment

View Set

SCM 6216 Final Exam (CH 6, 8, 9, 10, 12, 13, 14)

View Set

Get Ready For Biology Chapter 2: Basic Math Review

View Set

The Natural Environment - Chapter 20

View Set