Chapter 8: Arrays and Strings

Ace your homework & exams now with Quizwiz!

In C++, an array index starts with

0

For a list of length n, selection sort makes exactly

n(n-1) / 2 key comparisons and 3(n-1) item assignments.

In a two dimensional array, the elements are arranged in a

table form

There are no aggregate operations on arrays, except for

the input/output of character arrays (C-strings)

Arrays can be initialized during their declaration. If there are fewer initial values than the array size,

the remaining elements are initialized to 0.

In C++, the enull characters is represented as

'\0'

In the ASCII character set, the coating sequence of the null character is

0

In a two-dimensional array, the rows are numbered _______________ and the columns are numbered ______________ .

0 to ROW_SIZE -1 ; 0 to COLUMN_SIZE-1

Parellel arrays are used to

hold related information

Elements of a one dimension array are arranged

in the form of a list

In C++, C strings are

null terminated

In column processing, a two dimensional array is processed

one column at a time

In row processing, a two dimensional array is processed

one row at a time

There is no check on whether an array index is

out of bounds

Individual array components can be passed as

parameters to functions

C++ stores, in computer memory, two dimensional arrays in a ________________ order form

row

Commonly used C-string manipulation functions include

strcpy (string copy) strcmp (string comparison) and strlen (string length)

Character arrays can be initialized during declaration using

string notation

If a matrix is a two dimensional array, then the base address of matrix is

the address of the array component matrix [0] [0].

The base address of an array is

the address of the first array component. For example: if list is a one dimension array, the base address of list is the address of list[0].

When declaring a one dimensional array as formal parameter, you usually omit

the array size. If you specify the size of a one-dimensional array in the formal parameter declaration, the compiler will ignore the size.

When a two-dimensional array is passed is passed as an actual parameter,

the number of columns of the actual and formal arrays must match.

The sequential search algorithm searches a list for a given item, starting with the first element in the list. It continues to compare the search item with

the other elements in the list until either the item is found or the list has no more elements left to be compared with the search item.

When declaring a two-dimensional array as a formal parameter, you can omit

the size of the first dimension, but not the second

The heading file cstring contains

the specifications of the functions that can be used for C-string manipulation

A function cannot return a value of

type array

Because C-Strings are stored in arrays, individual characters in the C-String can be accessed

using the array component access notation

A data type is simple if

variables of that type can hold only one value at a time

In a structured data type, each data item is

a collection of other data items

An array is a structured data type with

a fixed number of components. Every component is of the same type, and components are accessed using their relative positions in the array

To access an element of a two dimensional array, you need

a pair of indices; one for the row position, and one for the column position

Input and output of C-strings is the only place where C++ allows

aggregate operations

In C++, a string is

any sequence of characters enclosed between double quotation marks

As parameters to functions,

arrays are passed by reference only

C-strings are stored in

character arrays

C-strings are compared

character by character

Although as parameters, arrays are passed by reference only, when declaring an array as a formal parameter, using the reserve word

const before the data type prevents the function from modifying the array

An array index can be any expression that

evaluates to a nonnegative integer. The value of the index must always be less than the size of the array.

Selection sort sorts the list by

finding the smallest (or equivalently largest) element in the list and moving it to the beginning (or end) of the list

Because as parameters, arrays are passed by reference only

when declaring an array as a formal parameter, you do not use the & symbol after the data type.

In a function call statement, when passing an array as an actual parameter,

you use only its name


Related study sets

Chapter 37 Musculoskeletal Trauma Prep U

View Set

How to boost your brain power (Use of English part 3 - word formation)

View Set

Chapter 6 RESOURCE PLANNING SYSTEMS

View Set

Health Assessment / Patho Final (yeet)

View Set