CSC Test 3

The number inside of brackets of an array definition is the size declarator.

The number inside of the brackets of an assignment statement that works with the contents of an array is a subscript

What is the difference between a size declarator and a subscript
In order to process array in function, passing array alone cannot determine the number of elements in array, therefore we need array size argument also.
Why should a function that accepts an array as an argument, and processes that array, also accept an argument specifying the array’s size?
We will write a custom essay sample on
CSC Test 3
or any similar topic only for you
Order now
by providing an initialization list
How do you define an array without providing a size declarator?
Is an array passed to a function by value or by reference?
using the same subscript value for each array
How do you establish a parallel relationship between two or more arrays?
When you pass an array name as an argument to a function, what is actually being passed
the column size declarator must be provided
When writing a function that accepts a two-dimensional array as an argument, which size declarator must you provide in the parameter for the array?
you do not have to declare the number of elements that a vector will have

if you add a value to a vector that is already full, the vector will automatically increase its size to accommodate the new value

a vector can report the number of elements it contains

What advantages does a vector offer over an array?
size declarator
The _____ indicates the number of elements, or values, an array can hold
integer, zero
The size declarator must be an _____ with a value greater than ______
Each element of an array is accessed and indexed by a number known as ______
subscript number in C++ always starts at _____
size declarator, subscript
The number inside the brackets of an array definition is the _____, but the number inside an arrays brackets in an assignment statement, or any other statement that works with the contents of the array is the _____
starting values for an array may be specified with an _____ list
if an array is partially initialized, the uninitialized elements will be set to
initialization list
if the size declarator of an array definition is omitted, C++ counts the number of items in the _____ to determine how large the array should be
by using the same _____ for multiple arrays, you can build relationships between the data stored in the arrays
array’s beginning memory address
any time the name of an array is used without brackets and a subscript, it is seen as ______
to pass an array to a function, pass the ____ of the array
two dimensional
a _____ array is like several arrays of the same type put together
when a two dimensional array is passed to a function the ____ size must be specified
Standard Template Library
the ______ is a collection of programmer-defined data types and algorithms that you may use in your programs
sequence, associative
the two types of containers defined by the STL are ___ and ___
the vector data type is a ____ container
to store a value in a vector that does not have a starting size, or that is already full, use the _____ member function
set size
to determine the number of elements in a vector, use the ___ member function
pop back
use the ____ member function to remove the last element from a vector
to completely clear the contents of a vector, use the ___ function
an arrays size declarator can be either a literal, a named constant, or a variable
subscript numbers may be stored in variables
you can write programs that use invalid subscripts for an array
false, will be set to zero
if an array is partially initialized, the uninitialized elements will contain garbage
false, seen as array’s beginning memory
when an array name is used without brackets and a subscript, it is seen as the value of the first element in the array
to pass an array to a function, pass the name of the array
when defining a parameter variable to hold a single-dimensional array argument, you do not have to include the size declarator
a 2D array is like several identical arrays put together
false, columns
two dimensional arrays may be passed to functions, but the row size must be specified in the definition of the parameter value
false, only push_back does this
you can use the [] operator to insert a value into a vector that has no elements
because it is called as it uses a loop to sequentially step through an array
why is the linear search also called “sequential serach”
bc it moves the elements in an array only one element at a time
why is the bubble sort inefficient for large arrays?
it usually performs fewer exchanges because it moves items immediately to their final position in the array
why is the selection sort more efficient than the bubble sort on large arrays?
the ___ search algorithm is adequate for small arrays but not large arrays
the ___ search algorithm requires that the arrays contents be sorted
false, it is always N
the maximum number of comparisons performed by the linear search on an array of N elements is N/2
it dereferences a point, allowing code to work with the value that the pointer points to
what does the indirection operator do?
multiplication operator, pointer definition, indirection operator
so far you have learned three different uses for the * operator. what are they?
addition and subtration
what math operations are allowed on pointers?
increments the address stored in the variable prt by 4 times the size of the type int
assuming that ptr is a pointer to an int, what happens when you add 4 to ptr?
dynamically allocates memory
what is the purpose of the new operator?
used to free memory that has been dynamically allocated with the new operator
what is the purpose of the delete operator?
a pointer to an item that was passed in to functions as argument

a pointer to a dynamically allocated chunk of memory

under what circumstances can you successfully return a pointer from a function?
a pointer to a constant points to a constant item, the state that the pointer points to cannot change but the pointer can change

with a constant pointer, it is the pointer itself that is constant, once it is initialized it cannot point to anything

what is the difference between a pointer to a constant and a constant pointer?
it specify’s the function and cannot change what it points to

we cant use the change contents of argument

what are two advantages of declaring a pointer parameter as a constant pointer
each byte in memory is assigned a unique _____
the ____ operator can be used to determine a variable’s address
_____ variables are designed to hold addresses
the ___ operator can be used to work with the variable a pointer points to
array names can be used as ____, and vice versa
memory allocation
creating variables while a program is running is called ______
a pointer that contains the address 0 is called a _____ pointer
when a program is finished with a chunk of dynamically allocated memory, it should free it with the ____ operator
you should only use pointers with delete that were previously used with ______
address 0 or NULL
under old compliers, if the new operator cannot allocate the amount of memory requested, it returns ____
false, used to get the value at that address if specified to a pointer variable
the * operator is used to get the address of a variable
pointer variables are designed to hold addresses
false , it is the *
the & symbol is called the indirection operator
false, address operator
the & operator dereferences a pointer
when the indirection operator is used with a pointer variable, you are actually working with the value the pointer is pointing to
array names cannot be dereferenced with the indirection operator
when you add a value to a pointer, you are actually adding that number times the size of the data type referenced by the pointer
false, names will automatically assign its base address to pointer
the address operator is not needed to assign an array’s address to a pointer
you can change the address that an array name points to
false, not * & /
any math operation, including * & /, may be performed on a pointer
pointers may be compared using the relational operators
when used as a function parameters, reference variables are much easier to work with than pointers
false, pointer that contains address 0 is called a null pointer
a pointer variable that has not been initialized is called a null pointer
the address 0 is generally considered unusable
false, it must have used new
in using a pointer with delete operator, it is not necessary for the pointer to have been previously used with the new operator

Hi there, would you like to get such a paper? How about receiving a customized one? Check it out