Final Study Guide CIS22A

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which one of the following function calls matches the function prototype given below?

All answers are correct

Reasons for creating functions:

All answers are correct.

In a function header, you must furnish: A.data type(s) of the parameters B.names of parameter variables C. All D.data type of the return value E.the name of function

C. All

This is a collection of statements that performs a specific task.

Function

The purpose of calcRectangle function is to calculate the area and perimeter of a given rectangle. It is called as shown below: double length = 22.4; double width = 10.5; double area; double perim; calcRectangle(length, width, area, perim);

area, perim

A file ________ is a small holding section of memory that file-bound information is first written to.

buffer

Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can ________ the appropriate function.

call

A function is executed when it is:

called

Assuming dataFile is a file stream object, the statement: dataFile.close();

closes a file

A function can have a ____________ parameter for the last parameter(s), meaning a call can optionally omit a corresponding argument.

default

A function ________ contains the statements that make up the function

definition

o allow file access in a program, you must #include this header file.

fstream

A variable declared outside any function is called a ___________ variable.

global

To read data from a file, you define an object of this data type.

ifstream

Which one of the following function definitions matches the function call given below? int a = 5; cout << a << endl; // a is 5! a = tripleIt(a); cout << a << endl; // now a is 15! The purpose of the function is to triple the value of its argument.

int tripleIt(int number) { return 3 * number; }

To write data to a file, you define an object of this data type.

ofstream

A function can have zero to many parameters, and it can return this many values. Correct!

only one

Assuming outFile is a file stream object and number is a variable, which statement writes the contents of number to the file associated with outFile?

outFile << number;

Sometimes a program has two or more functions with the same name but differing in the number or types of parameters, known as function __________________ .

overloading

When used as parameters, these types of variables allow a function to access the parameter's original argument.

reference

This statement causes a function to end.

return

This may be used to write information to a file.

stream insertion operator

The purpose of calcRectangle function is to calculate the area and perimeter of a given rectangle. It is called as shown below: double length = 22.4; double width = 10.5; double area; double perim; calcRectangle(length, width, area, perim); Select the prototype definition that matches this function call.

void calcRectangle(double length, double width, double &area, double &perim)

Which one of the following function definitions matches the function call given below? int a = 10; cout << a << endl; // a is 10! doubleIt(a); cout << a << endl; // now a is 20! The purpose of the function is to double the value of its argument.

void doubleIt(int &number) { number = 2 * number; }


Set pelajaran terkait

EDAPT Nursing Care: Newborn Assessment

View Set

AP Literature - (Literary Vocabulary) - Jaden Brescia

View Set