USER-DEFINED FUNCTIONS Flashcards

1
Q

To use a predefined function in a program, you need to know only the name of the function and how to use it.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A value-returning function returns only one value.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Parameters allow you to use different values each time the function is called.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When a return statement executes in a user-defined function, the function immediately exits.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A value-returning function returns only integer values.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When a return statement executes in a user-defined function, the function immediately exits.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A value-returning function returns only integer values.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A variable name cannot be passed to a value parameter

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If a C++ function does not use parameters, parentheses around the empty parameter list are still required.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In C++, the names of the corresponding formal and actual parameters must be the same.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A function that changes the value of a reference parameter also changes the value of the actual parameter

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Whenever the value of a reference parameter changes, the value of the actual parameter changes.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In C++, function definitions can be nested; that is, the definition of one function can be enclosed in the body of another function.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Using global variables in a program is a better programming style than using local variables, because extra variables can be avoided.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In a program, global constants are as dangerous as global variables.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The memory for a static variable remains allocated between function calls.

A

True

17
Q

The following is a valid C++ enumeration type:

enum romanNumerals {I, V, X, L, C, D, M}

A

True

18
Q

Given the declaration: enum cars {FORD, GM, TOYOTA, HONDA}; cars domesticCars = FORD;
the statement: domesticCars = domesticCars + 1; sets the value of domesticCars to GM

A

False

19
Q

The values in the domain of an enumeration type are called enumerators.

A

True

20
Q

The only arithmetic operations allowed on the enumeration type are increment and decrement.

A

False

21
Q

You can input the value of an enumeration type directly from a standard input device

A

False

22
Q

A function can return a value of an enumeration type.

A

True

23
Q

The following are legal C++ statements in the same block of a C++ program:
enum mathStudent {BILL, JOHN, LISA, RON, CINDY, SHELLY};
enum historyStudent {AMANDA, BOB, JACK, TOM, SUSAN};

A

True

24
Q

The following statement creates an anonymous type: enum {A, B, C, D, F} studentGrade;

A

True

25
Q

A double type is an example of a simple data type.

A

True

26
Q

A one-dimensional array is an example of a structured data type

A

True

27
Q

Arrays can be passed as parameters to a function either by value or by
reference

A

False

28
Q

A function can return a value of type array

A

True

29
Q

A function can return a value of type array

A

True

30
Q

If an array index goes out of bounds, the program always terminates in an
error

A

False

31
Q

In C++, some aggregate operations are allowed for strings.

A

True

32
Q

As parameters, two-dimensional arrays are passed either by value or by reference.

A

False

33
Q

The declaration:
char str = “Sunny Day”;
declares str to be a string of an unspecified length.

A

False