Computer Programming exam Part 1

¡Supera tus tareas y exámenes ahora con Quizwiz!

search

A ____________ algorithm is a method of locating a specific item of information in a collection of data?

middle

A binary search begins with the ___________ element of an array?

false

A one-dimensional array can be initialized at the time it is defined, but a two-dimensional array cannot be initialized at the time it is defined?

binary, linear

A(n) ___________ search is more efficient than a(n) __________ search?

two-dimensional

A(n) _________________ array is like several arrays of the same type put together?

++, --

The _________ and _________ operators can respectively be used to increment and decrement a pointer variable?

selection,bubble

The __________ sort, in general, usually performs fewer swaps than the __________ sort?

it is simple and it can be used on unordered data

The advantage of a linear search is that _____?

false

The bubble sort is an easy way to arrange data into ascending order, but it cannot arrange data into descending order.

delete

The command to free up the memory that a pointer points to is the _________________ command?

the memory address of the variable called num1

The statement cout << &num1; will output?

the value stored in the variable whose address is contained in ptr

The statement cout << *ptr; will output?

sets ptr to point to the allocated memory

The statement int *ptr = new int; acquires memory to hold an integer and then?

It shifts the numbers to the right until the place where the value started with is inserted or belongs

What is the purpose of the do..while loop in insertion sort?

It holds the index where the minimum values is that we find

What is the purpose of the following line of code in the selection function? minIndex = startScan;

To swap the smallest value with the starting position for each loop

What is the specific purpose of the following lines in selection sort? myarray[minIndex]= myarray[startScan]; myarray[startScan] = minValue;

column

When a two-dimensional array is passed to a function the ___________ size must be specified?

descending

When an array is sorted from highest to lowest, it is said to be in _________ order?

false

When searching for an item in an unordered set of data, binary search can find the item more quickly than linear search?

the address of the first variable comes before the address of the second variable in the computer's memory

When the less than ( < ) operator is used between two pointer variables, the expression is testing whether?

selection

Which of the sorts discussed so far is the least efficient to use when numbers may already be in order?

bubble

Which of the sorts discussed so far is the most efficient to use when numbers may already be in order?

selection

Which of the sorts discussed so far made the same amount of passes and swaps no matter what order the numbers were in to start with?

bubbles

Which of the sorts discussed so far took the most time (in seconds), in general, to sort 50,000 random numbers?

using a selection sort algorithm; from highest to lowest value; from lowest to highest value; using a bubble sort algorithm

Sorted data could be ordered?

true

Arithmetic operations can be performed on pointers?

adds the value stored in arr[0]to sum

Assuming that arr is an array identifier, the statement sum += *arr;?

subscript

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

nested loops

To add up all the values in a two-dimensional array it would be best to use

name

To pass an array to a function, in the actual call you pass the ______________________ of the array?

It has to make n-1 passes even if the data is already in order.

What is a possible inefficiency with selection sort?

the larger numbers

What is actually being "bubbled" towards the right of the array in bubble sort?

This shows that a swap has been made in the pass

What is the identifier swap (or madeAswap in your textbook code) used for in the bubble sort?

one

What is the minimum amount of passes that bubble sort will ever make?

The Selection sort and Insertion was the best for random values because they take the least time to go through it. The Selection and Insertion both make fewer swap and comparisons.

Which sort do you think is best for random values? Give 2 reasons why.

Bubble sort is the best because of its simple and easier to understand. Also, bubble sort is the most stable than any of other sorts. Bubble sort might take longer, but it does perform well.

Which sort do you think is the best sort overall? You must back up your answer with correct and pertinent statements.

Selection Sort and Insertion Sort

Which sort(s) always did 49,999 passes for 50,000 numbers?

Bubble and Selection

Which sort(s), if any, works from left to right?

false

With pointer variables you can access, but you cannot modify, data in other variables?

array names

________________ can be used as pointers?

To hold the value we are starting with in comparing and the position where that value was located

temp1 and temp2 are used for what in insertion sort?


Conjuntos de estudio relacionados

AP Psychology Personality Unit 10

View Set

LSU POLI 2051: Connect Ch. 7 Quiz

View Set

Chapter 10 - Advanced Accounting

View Set

Blood Transfusions med surg questions

View Set

Physical Development in Early Childhood

View Set

B4 Shock, Burns, Emergency/Disaster

View Set