Exam 6: Using C++ Functions

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

Describe two benefits of using structures with functions (either as arguments or a return type)?

Free
(Essay)
4.9/5
(32)
Correct Answer:
Verified

When you use structures with functions, you get at least two benefits. First, when you group individual fields into a structure, it is easier to pass them all into a function as a unit. Without structures, you would have to pass in each of the individual fields separately. Second, when you return a structure from a function, you can pass back a group of values; because only one value can be returned from a function, there would be no way to return all the field values separately.,

Write an example of code that illustrates how to use the scope resolution operator.

Free
(Essay)
4.8/5
(41)
Correct Answer:
Verified

#include
using namespace std;
int age = 30;
int main()
{
int age = 45;
cout ,

Match each term with the correct statement below.
Premises:
statement that notifies the calling function that the definition (details) of the named function will come later
Responses:
overhead
subfunction
ambiguity
Correct Answer:
Verified
Premises:
Responses:
statement that notifies the calling function that the definition (details) of the named function will come later
overhead
Free
(Matching)
4.9/5
(42)
Correct Answer:
Verified

____ is also called data hiding.

(Multiple Choice)
4.9/5
(33)

The statement that executes a function is the function ____.

(Multiple Choice)
4.9/5
(28)
Match each term with the correct statement below.
Premises:
device that you cannot look into to discover how it works but that works nonetheless
Responses:
black box
inline function
encapsulation
Correct Answer:
Verified
Premises:
Responses:
device that you cannot look into to discover how it works but that works nonetheless
black box
(Matching)
4.8/5
(31)

____ a function name involves creating multiple functions with the same name but different parameter lists.

(Multiple Choice)
4.7/5
(40)

The principle of ____ is a programming principle that says you should give a process only the authority it needs to accomplish its job.

(Multiple Choice)
4.8/5
(38)

When should you use an inline function?

(Essay)
4.9/5
(36)

A(n) ____ value is a value sent from a subfunction to the function that called it.

(Multiple Choice)
4.9/5
(34)

When you use a(n) ____ function, a copy of the function statements is placed directly into the compiled calling program.

(Multiple Choice)
4.8/5
(33)

The ____ of a variable is the time during which it is defined-from declaration to destruction.

(Multiple Choice)
4.7/5
(38)

____ variables are those that are known to all functions in a program.

(Multiple Choice)
4.8/5
(39)
Match each term with the correct statement below.
Premises:
principle of containing variables locally in their functions
Responses:
abstraction
ambiguity
encapsulation
Correct Answer:
Verified
Premises:
Responses:
principle of containing variables locally in their functions
abstraction
(Matching)
4.9/5
(38)

A variable that acts as an alias for another variable is called a ____ variable.

(Multiple Choice)
4.9/5
(28)

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

(Multiple Choice)
4.8/5
(36)

The statement return letter; can be alternatively written as ____. Both statements work identically.

(Multiple Choice)
4.9/5
(34)

When you declare a pointer, you insert a(n) ____ in front of the variable name.

(Multiple Choice)
4.8/5
(43)

List some advantages and disadvantages of passing an address of a variable to a function.

(Essay)
4.9/5
(39)

To "____________________" means to take precedence over.

(Short Answer)
4.9/5
(38)
Showing 1 - 20 of 51
close modal

Filters

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