CIS-165 Test 2 Study guide

Ace your homework & exams now with Quizwiz!

When writing functions that accept multi-dimensional arrays as arguments, ________ must be explicitly stated in the parameter list.

All but the first dimension.

A 2d array of characters can contain _______.

All of the above.

A ________ is information that has been passed to a function and a _______ is informartion received by a function.

Argument; parameter

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

Call.

These types of arguments are passed to parameters automatically if no argument is provided in the function call.

Default.

A function ________ contains the statements that make up a function.

Definition.

It is a good programming practice to ________ your functions by writing comments that describe what they do.

Document.

The individual values contained in array are known as

Elements.

This function causes a program to terminate, regardless of which function or control mechanism is executing.

Exit.

A local variable and a global variable may not have the same name within the same program.

False.

An array initialization list must be placed on one single line.

False.

Assume array1 and array2 are the names of arrays. To assign the contents of array2 to array1, you would use the following statement: array1 = array2;

False.

C++ limits the number of array dimensions to two.

False.

If you attempt to store data past an arrays boundaries, it is guaranteed that the compiler will issue and error.

False.

Local variables are initialized to zero by default.

False.

When a function is called, flow of control moves to the functions prototypes.

False.

You must furnish an argument with a function call.

False.

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

Function.

A ________ variable is declared outside all functions.

Global.

A ______ can be used to specify the starting values of an array.

Initialization list.

Arrays may be ________ at the time they are _________.

Initialized; declared.

(Going to give us an assignment statement which incorporates a logical comparison. We have to say what the final variable that is assigned to the statement is). (Remember: 1 means it's true, 0 if false).

N/A

(Going to give us an if-then-else chain and tell us what the person has input as a value. We have to say what it will print out).

N/A

(Will give us an array element definition and we need to say what will be the last legal subscript). (remember: starts at zero and doesn't go past the size declarator.)

N/A

Given the following declaration, which element has a particular value

N/A

How many elements does the following array have: _____________

N/A

Is this array illegal or not?

N/A

Which of the following is a valid C++ array example.

N/A

To pass an array as an argument to a function, pass the ________ of the array.

Name.

(Going to give us an array definition and we have to say if it is valid in C++)

Need to know the rules governing array definitions (size declarator, brackets, names and datatype)

The _______ is automatically appended to a character array when it is initialized with a string constant.

Null terminator.

A two dimensional array can have elements of _______ datatype.

One.

A function can have zero to many parameters and return this many values.

Only one.

The due while loop is a ______ loop that is ideal in situations where you always want the loop to iterate at least once.

Post-test loop

A function _______ eliminates the need to put a function definition before all calls to the function.

Prototype.

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.

A 2D array can be viewed as _____ and _____.

Rows; columns.

To access an array element, use the array name and the element's _______.

Subscript.

Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression.

The break expression.

An array can store a group of values, but the values must be:

The same datatype.

A static variable that is defined within a function is initialized only once, the first time the function is called.

True.

An individual array element can be processed like any other type of C++ variable.

True.

Global variables are initialized to zero by default.

True.

IT is possible for a function to have some parameters with the fault arguments and some without

True.

It is not considered good programming practice to declare all of your variables globally.

True.

One reason for using functions is to break programs into manageable units or modules.

True.

The amount of memory used by an array depends upon the arrays datatype and the number of elements in the array.

True.

The parameter is a special purpose variable that is declared inside the parenthesis of a function definition.

True.

When you pass an array as an argument to a function, the function can modify the contents of the array.

True.

You may use the exit() function to terminate a program, regardless of which control mechanism is executing

True.

_______ functions may have the same name as long as their parameter lists are different.

Two or more.

If you leave out the size declarator in an array definition:

You must furnish an initialization list.

To assign the contents of one array to another use ___________________.

a loop to assign the contents of an array

A 2d array is like a ___ put together.

several identical arrays.

An array of string objects that can hold 5 names could be declared using which statement

string names[5];

An element of a 2D array is referred to as ___ followed by ___

the row subscript of the element; column subscript of the element

In a function header you must furnish ________.

(All of these).

This operator is used in C++ to represent equality.

==

Which of the following statements about global variables is true.

A global variable can have the same name as a variable that is declared local within a function.

Unlike regular variables these can hold multiple values.

Arrays.

A function is executed when it is _______.

Called.

A function's return datatype must be the same as the functions parameters

False.

This is a statement that causes a function to execute.

Function call.

The while loop contains an expression that is tested for a true or false value and the statement or block that is repeated as long as the expression ____.

Is true.

It is ____ to pass an argument to a function that contains an individual array element (such as #3)

Legal.

This type of variable is defined inside a function and is not accessible outside the function.

Local.

The name of the array stores the ______ as a first array element.

Memory address.

Which of the following is a valid c++ array example

N/A (internet suggests either int array[10]; or int scores [10];)

The value in this type of local variable persists between function calls.

Static.

By using the same ________ you can build relationships between data stored in two or more arrays.

Subscript.

Subscript numbering in C++

begins with zero

An array size declarator must be __ ___with a value greater than _____.

constant integer expression; 0

An array can be easily stepped through by using a _____.

for loop.

An array with no elements is

illegal in C++


Related study sets

Live Virtual Machine Lab 7.4: Module 07 Load Balancing and NIC Teaming

View Set

Portfolio Risk and Return Part II

View Set

Davis Edge PHARM 3 Opioid practice test questions

View Set

5.3.11 Troubleshoot Physical Connectivity

View Set

Personal Nutrition: The Fat Soluble Vitamins

View Set

ART 1113- Art Appreciation Midterm

View Set

Arquitectura Propietaria Examen Final

View Set