Exam 6: User-Defined Functions

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Assume that all variables are properly declared.The following statement in a value-returning function is legal. if (x % 2 == 0) \quad return x; else \quad return x + 1;

(True/False)
5.0/5
(44)

____________________ identifiers are not accessible outside of the function (block).

(Short Answer)
4.9/5
(34)

The following return statement returns the value 10. return 10,16;

(True/False)
4.8/5
(28)

The data type of a variable in a return statement must match the function type.

(True/False)
4.8/5
(34)

The execution of a return statement in a user-defined function terminates the program.

(True/False)
4.8/5
(41)

The statement: return 37,y,2 * 3; returns the value ____.

(Multiple Choice)
4.8/5
(37)

Given the following function prototype: int test(float,char);,which of the following statements is valid?

(Multiple Choice)
5.0/5
(33)

Once you write and properly debug a function,you can use it in the program (or different programs)again and again without having to rewrite the same code repeatedly.

(True/False)
4.9/5
(41)

A variable listed in a header is known as a(n)____ parameter.

(Multiple Choice)
4.9/5
(25)

Assume the following. static_cast<int>('a')= 97 Static_cast<int>('A')= 65 The output of the statement: Cout << static_cast<int>(tolower('B'))<< endl; is ____.

(Multiple Choice)
4.8/5
(30)

Which of the following function prototypes is valid?

(Multiple Choice)
4.9/5
(28)

When you attach & after the dataType in the formal parameter list of a function,the variable following that dataType becomes a(n)____________________ parameter.

(Short Answer)
4.8/5
(41)

Given the function prototype: double testAlpha(int u,char v,double t); which of the following statements is legal?

(Multiple Choice)
4.8/5
(41)

Given the function prototype: float test(int,int,int); Which of the following statements is legal?

(Multiple Choice)
4.9/5
(27)

A variable for which memory is allocated at block entry and deallocated at block exit is called a(n)____________________ variable.

(Short Answer)
4.8/5
(37)

____________________ parameters are useful in three situations: • When the value of the actual parameter needs to be changed • When you want to return more than one value from a function • When passing the address would save memory space and time relative to copying a large amount of data

(Short Answer)
4.8/5
(38)

What value is returned by the following return statement? int x = 5; Return x + 1;

(Multiple Choice)
5.0/5
(44)

The following function heading in a C++ program is valid: int funcExp(int u,char v,float g)

(True/False)
4.8/5
(39)

In C++,a function prototype is the function heading without the body of the function.

(True/False)
4.8/5
(33)

If a function needs to return more than one value,as a rule of good programming style,you should change it to a(n)____________________ function and use the appropriate reference parameters to return the values.

(Short Answer)
4.8/5
(36)
Showing 21 - 40 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)