Chapter 8

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is an array size declarator?

A nonnegative integer that specifies the size of an array.

What is a subscript?

A number that identifies a specific element in an array.

What is a search algorithm?

An algorithm developed for the purpose of locating a specific item in a larger collection of data, such as an array.

what is an array?

An array is a collection of data of the same type, stored in contiguous memory locations, and accessed using a single variable name and an index or subscript. The elements in an array are identified by their position in the array, starting with index 0.

What is an array element?

An individual storage location in an array.

How many elements does the sequential search algorithm look at in the case that the search value is not found in the array?

It looks at every element

What does "array bounds checking" mean?

Many languages do not allow a program to use an invalid array subscript.

Name an advantage of using arrays

One of the main advantages of using an array to store data is that it allows you to store and process large amounts of data in a structured and efficient way..

The expression score[5] is pronounced ________.

Score sub 5

What is the term used for the number inside the bracket that specifies the number of values that an array can hold?

Size declarator

Which array element does the sequential search algorithm first look at?

The loop sequentially steps through each element in the array, comparing the elements to the value being searched for.

This is typically the last subscript in an array.

The size of the array minus one

What happens when the value being searched for is found?

When the value is found, the loop stops.

How do you copy the contents of one array to another array?

You assign the individual elements of the array that you are copying to the elements of the other array. This is usually best done with a loop

How do you establish a relationship between the data stored in two parallel arrays?

You use the same subscript to access data items in the two arrays.

A partially filled array is normally used with ________.

an accompanying integer variable that holds the number of items that are actually stored in the array

Many programming languages perform this, which means they do not allow a program to use an invalid array subscript.

bounds checking

Can you store a mixture of data types in an array?

no

In most languages, can the size of an array be changed while the program is running?

no

What is an off-by-one error?

occurs when a loop iterates one time too many or one time too few.

This term describes two or more arrays that hold related data, and the related elements in each array are accessed with a common subscript.

parallel arrays

You typically think of a two-dimensional array as containing

rows and columns

This algorithm uses a loop to step through each element of an array, starting with the first element, searching for a value.

sequential search

This is a number that identifies a storage location in an array.

subscript

Array bounds checking typically occurs while a program is running.(T/F)

true

In most languages, an array's size cannot be changed while the program is running.(T/F)

true

To calculate the total of the values in an array, a loop is used with an accumulator variable. (T/F)

true

Variables work well in many situations, but they have limitations.(T/F)

true

How do you look for a partial string match when searching an array of strings for a value?

use a function similar to the contains function

This is typically the first subscript in an array.

0

This is an individual storage location in an array.

element

A declaration for a two-dimensional array requires only one size declarator.(T/F)

false

Arrays, like variables, can only hold one value at a time.(T/F)

false

One of the advantages of two- or more dimensional arrays is that the data values can be of two or more data types.(T/F)

false

You can do many things with arrays, but you cannot pass one as an argument to a module or a function.(T/F)

false

You can store a mixture of different data types in an array. (T/F)

false


Ensembles d'études connexes

PSYC 300 Exam 4 Studyguide - TAMU Dr. Edens

View Set

BACC 512 CHAPTER 12 Current Liabilities

View Set

Unit Test: Alcohol, Tobacco, and Other Drugs

View Set

Adam Smith and Free Market Economy

View Set

Structure, Function, and Regulation of the Heart

View Set

BUS 404 Final - Chapter 16 Stern

View Set