COSC 1437 Midterm

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

The number of comparisons made by a binary search is expressed in powers of two.

TRUE

When you work with a dereferenced pointer, you are actually working with

the actual value of the variable whose address is stored in the pointer variable

A linear search can only be implemented with integer values.

FALSE

Before you can perform a bubble sort, the data must be stored in descending order.

FALSE

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

FALSE

With pointer variables you can access but not modify data in other variables.

FALSE

A(n) ________ search uses a loop to sequentially step through an array.

LINEAR

The ________ is adequate for searching through small arrays.

LINEAR SEARCH

The ________ sort usually performs fewer exchanges than the ________ sort.

SELECTION/BUBBLE

The advantage of a linear search is its

SIMPLICITY

Algorithms used to arrange random data in some order are ________ algorithms.

SORTING

A selection sort and a binary search can be applied to STL vectors as well as arrays.

TRUE

An array name is a pointer constant because the address stored in it cannot be changed at runtime.

TRUE

C++ does not perform array bounds checking, making it possible for you to assign a pointer the address of an element out of the boundaries of an array.

TRUE

If you are using the bubble sort algorithm to sort an array in descending order, the smaller values move toward the end.

TRUE

In C++11 you can use smart pointers to dynamically allocate memory and not worry about deleting the memory when you are finished using it.

TRUE

On average, an item is just as likely to be found near the beginning of an array as near the end.

TRUE

A binary search begins with the ________ element of an array.

MIDDLE

A ________ algorithm is a method of locating a specific item of information in a larger collection of data.

SEARCH

With binary search algorithm, a maximum of ________ comparisons will be made on an array of 25,000 elements.

15

The following is the pseudocode for which type of algorithm?

BINARY SEARCH

A ________ search is more efficient than a ________ search.

BINARY/LINEAR

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

DESCENDING ORDER

What does the following statement do? double *num2;

Declares a pointer variable named num2

Which of the following is TRUE about this statement? sum += *array++;

This statement assigns the dereferenced pointer's value, then increments the pointer's address.

Assume you have two integer variables, num1 and num2. Which of the following is the correct way to swap the values in these two variables?

int temp = num2; num2 = num1; num1 = temp;

In the following statement, what does int mean?int *ptr = nullptr;

ptr is a pointer variable and will store the address of an integer variable.

Using a linear search to find a value that is stored in the last element of an array that contains 20,000 elements, ________ elements must be compared.

20,000


संबंधित स्टडी सेट्स

Section 5 Unit 5 lessons (1-4) Quizzes

View Set

Regression/Multiple Regression Theory Objectives

View Set

DRH Chapter 1: Characteristics of Dogs

View Set

Microeconomics Chapter 2 Homework

View Set

Kapittel 6, landskap og arealbruk

View Set