• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/138

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

138 Cards in this Set

  • Front
  • Back


In a binary search, what is the maximum number of comparisons that need to be performed if the array contains 1000 elements?



a.)500


b.)1000


c.)250


d.)100


e.)None of the above

e.)None of the above

True/False: In a sequential search, each element is compared to the searchValue and the search stops when the value is found or the end of the array is encountered

True


Which sorting algorithm sorts the first two elements of an array before inserting the remaining elements into that sorted part of the array?

Insertion


In the swap module, the third variable is declared as a ________ variable.

Local


In an insertion sort, what order are the elements in an array placed using the following Boolean expression?
// variable p is used to scan the array
While p > 0 AND array[p-1] > array[p]

Descending


Which search algorithm uses three variables to mark positions within the array as it searches for the searchValue?

Binary


To order an array of strings in alphabetic order, the sorting algorithm should be structured for ________ order.

Ascending

As the ________ sorting algorithm makes passes through and compares the elements of the array, certain values move toward the end of the array with each pass.

bubble


True/False: The bubble sort is limited to arranging data only in acceding order.

False


Which sorting algorithm moves elements to their final sorted position in the array?

Selection


True/False: All sorting algorithms contain a group of statements that swap values in array elements.

True


Which statement is true after the execution of the following statements?
Set x = y
Set y = x



a.)x and y contain their original values


b.)x and y swapped their values


c.)y contains the value in x and x stayed the same


d.)x contains the value in y and y stayed the same


e.None of the above

d.)x contains the value in y and y stayed the same


Which of the following sorting algorithms is the least efficient?



a.)Bubble sort


b.)Selection sort


c.)Insertion sort


d.)All of the above


e.)None of the above

a.)Bubble sort

Which searching algorithm requires the array to be ordered?

Binary

True/False: The data in an array can be sorted in either ascending or descending order.

True

In a selection sort, which variable holds the subscript of the element with the smallest value found in the scanned area of the array?

minIndex

Which of the following search algorithms should be used on large arrays if speed is important?



a.)Insertion


b.)Bubble


c.)Selection


d.)Binary


e.)Sequential

d.)Binary

True/False: The sequential search algorithm is simple and most efficient to use with a large data array.

False

When the elements in an array are stored from lowest to highest, the array is sorted in ________ order.

ascending


True/False: Swapping the contents of two variables requires a third variable that can serve as a temporary storage location.

True

True/False: When values in an array need to be swapped, the array and the size of the array have to be sent to the swap module.

False

True/False: Computer programming languages are only able to perform sort algorithms on numeric arrays.

False


In the bubble sort algorithm, the two arguments sent into the swap module are ________.



a.)array[index+1] and array[index-1]


b.)array[index-1] and array[index]


c.)array[index] and array[index-1]


d.)array[index-1] and array[index+1]


e.)None of the above

e.)None of the above


Which statement is true after the execution of the following statements?
Set t = x
Set x = y
Set y = t



a.)y contains the value in x and x stayed the same


b.)x contains the value in y and y stayed the same


c.)x and y swapped their values


d.)x and y contain their original values


e.)None of the above

c.)x and y swapped their values


True/False: The swap module is executed with three arguments to correctly swap the elements in an array.

False


Which of the following is a sorting algorithm?



a.)Insertion sort


b.)Bubble sort


c.)Selection sort


d.)All of the above


e.)None of the above

d.)All of the above

True/False: In a binary search, if the search fails to find the item on the first attempt, then there are 999 elements left to search in an array of 1000 elements.

False


True/False: In a selection sort algorithm, the variable minValue holds the smallest value found in the scanned area of the array.

True


What does the variable middle represent in a binary search algorithm?

Subscript of the midpoint

True/False: The biggest advantage of the bubble sort algorithm is that values move only by one element at a time toward their final destination in the array.

False

When a web page is visited, the browser stores a small file on the user's computer, known as a ________.

cookie

in general, how many types of files are there?

two


True/False: The sequential access file is similar to the way a cassette player works.

True


True/False: The data saved in a file will remain there even after the program stops running but will be wiped out when the computer is turned off.

False


True/False: Data files are less and less needed in current gaming software.

False


Which of the following software packages store data in files?



a.)Web browsers


b.)Image editors


c.)Games


d.)Word processors


e.)All of the above

e.)All of the above

True/False: The direct access file is similar to the way an MP3 player works: the player starts from the beginning.

False


What is the terminology used when a task is temporarily interrupted as a control variable reaches a specific value?

Control Break Logic

True/False: A file with the extension .doc usually indicates that the file contains a note written by a doctor.

False


True/False: The term "output file" is used to describe a file that data is read from.

False


How many steps must be taken when a file is used by a program?

Three


What is a short sequence of characters that appears at the end of a filename and is preceded by a period called?

Filename Extension


In an input file, what maintains the location of the next item that will be read from the file?

Read position


In the ________ step the data is either written to the file or read from the file

processing


Programmers usually refer to the process of saving data to a file as ________ a file.

writing data to


What type of data file can be opened and viewed in an editor such as Notepad?

Text File


Which type of data file access starts from the beginning of the file and proceeds to the end of the file?

Sequential Access

Which type of data file access allows access to any piece of data in the file without reading the data that comes before it?

Direct Access


When a piece of data is written to a file, it is copied from a variable in ________ to the file.

RAM


True/False: The use of a buffer increases the system's performance because writing data to memory is faster than writing to a disk.

True

True/False: All types of data files are viewable in a text editor.

False


True/False: When an input file is opened, the read position is initially set to the first item in the file.

True


Opening a(n) ________ file creates a file on disk and allows the program to write data to it.

Output

True/False: The programmer has the option to append data anywhere in an output file.

False


What is the term used to describe a file that data is read from?

Input file


True/False: The term "input file" is used to describe a file that data is written to.

False

True/False: In a text file, all data is stored as a series of characters

True


What type of data file cannot be opened and viewed in an editor such as Notepad?

Binary File

What type of file does the AppendMode work with?

Output file


True/False: It is ideal to have one long menu in the program for users to see and make their selection.

False


What is the term used for a menu that has a main menu and several submenus?

Multi-level menu

A(n) ________ program always starts off by displaying a list of operations the user can select from.

Menu-Driven


What is the structure that is needed to process a menu selection?

Decision


When the user makes a selection from the main menu in a multiple-level menu, a ________ might be displayed next

Submenu

What is the method used to make sure that valid selections are processed?



a.)Input validation loop


b.)Use of an Else clause


c.)Including the Default clause in the case structure


d.)All of the above


e.)None of the above

d.All of the above

True/False: In a menu-driven program, the user would have to usually type the word "end" to stop the program.

False


True/False: In most cases, menu-driven programs should be broken down into modules that perform individual tasks.

True


True/False: When there is an input validation loop, the case structure does not need the Default clause.

True

Which loop is a posttest loop such that the menu is displayed at least once?

Do-while

A list of operations that is displayed on the screen is called a(n) ________.


Menu

When the user is ready to stop the program, the user selects an operation such as "________" from the menu.

End of program


Which of the following decision structures could be used in a menu-driven program?



a.)If-Then-Else statements


b.)Case structures


c.)If-Then-Else If statements


d.)All of the above


e.)None of the above

d.)All of the above


True/False: The If-Then-Else If statement can be used as an alternative for performing the user's menu selection.

True

True/False: The user's menu selection can be validated using an input validation loop immediately after the Input statements.

True


The acronym GUI stands for ________.

Graphical User Interface


What is capable of performing several tasks and allows the user to select the task?

Menu-driven programs

Menu-driven programs should be broken down into ________ that perform individual tasks

Modules

True/False: When using a While loop to repeatedly process a user's menu selections, the menuSelection variables need to be initialized.

True

True/False: It is not possible to give the user an opportunity to make additional selections from the menu without having to run the program.

False


True/False: It is a cumbersome process for a user to make a selection from a menu because the user has to type the selection out.

False


Usually a submenu is executed by the selection made by the user from the ________.

Main Menu


Which statement provides a Default section to validate the user's menu selection?



a.)If-Then


b.)Case


c.)If-Then-Else


d.)If-Then-Else If


e.)None of the above

b.)Case


Which symbol in flowcharting is appropriate to use to represent the display of each of the selections of the menu?



a.)Parallelogram


b.)Rectangle


c.)Terminal


d.)Diamond


e.)None of the above

a.)Parallelogram


Any program that allows the user to select an item from a menu should ________ the user's selection.

Validate


True/False: An iteration structure is needed to process the menu selection made by the user.

False


True/False: Modules cannot be executed from a case statement, so loops have to be used.

False


The items displayed in a menu are often preceded by ________.



a.)a letter


b.)a number


c.)other characters


d.)Any of the above


e.)None of the above

d.)Any of the above


True/False: A case structure is the only decision structure that can be used in a menu-driven program.

False


Assuming the following variable declaration,
Declare String str = "ABC"
which of the following pseudocode statements displays the last character in the string?



a.)Display str[3]


b.)Display str[0]


c.)Display str[length(str) - 1]


d.)Display str[length(str)]


e.)None of the above

c.)Display str[length(str)-1]

Which of the following programs work extensively with text?



a.)Test messaging programs


b.)Email applications


c.)Word processors


d.)All of the above


e.)None of the above

d.)All of the above


True/False: The isWhiteSpace library function returns True if its argument is displayed on the screen using a white background color.

False


Assuming the following variable declaration,
Declare String str = "Miami"
which of the following pseudocode statements changes the variable's contents to "Mia"?



a.)delete(str, 3, length(str))


b.)delete(str, 3, 4)


c.)Set str[0] = "Mia"


d.)Set str = str - "mi"


e.)None of the above

b.)delete(str, 3,4)


Assuming the following variable declaration,
Declare String str = "1234AB C"
which of the following pseudocode expressions will return True?



a.)isDigit(str[4])


b.)isLetter(str[3])


c.)isDigit(str[3])


d.)isWhiteSpace(str[7])


e.)None of the above

c.)isDigit(str[3])


What is the output of the following pseudocode?
Declare String str = "ABC"
Display str[1]

B


If the following pseudocode were an actual program, what would it display?
Declare String str = "morning"
insert(str, 0, "Good")
Display str

Goodmorning


True/False: The insert library module automatically expands the size of the string to accommodate the inserted characters.

True

If the following pseudocode were an actual program, what would it display?
Declare String str = "a1b2c3d4"
Declare Integer index
For index = 0 To length(str) - 1
If isLetter(str[index]) Then
Set str[index] = "+"
End If
End For
Display str

+1+2+3+4

Assuming that a variable named ocean has been initialized with the string "Atlantic", which of the following library functions would return the first character in the string?

substring(ocean,0,0)


True/False: The isUpper library function converts a character to uppercase.

False

True/False: The expression isDigit("9") returns True.

True


If the following pseudocode were an actual program, what would it display?
Declare String str = "uvwxyz"
delete(str, 0, 0)
delete(str, 0,0)
delete(str, 0, 0)
Display str

xyz


True/False: Most programming languages do not allow access to the individual characters in a string.

False


If the following pseudocode were an actual program, what would it display?
Declare String str = "royal"
delete(str, 0, length(str) - 3)
Display str

al


True/False: Some programming tasks require that you access and/or manipulate the individual characters in a string

True

Which of the following pseudocode statements uses substring notation to display the first character in a String variable named city?



a.)Display city[1]


b.)Display city[0]


c.)Display city[length - 1]


d.)All of the above


e.)None of the above

b.)Display city[0]


If the following pseudocode were an actual program, what would it display?
Declare String str = "a1b2c3d4"
Declare Integer index
Declare Integer num = 0
For index = 0 To length(str) - 1
If isDigit(str[index]) Then
Set num = num + 1
End If
End For
Display num



a.)0


b.)4


c.)3


d.)5


e.)None of the above

b.)4

True/False: The stringToReal library function accepts a Real value as an argument and returns the String equivalent of the value.

False


Assuming the following variable declaration,
Declare String str = "bot"
which of the following pseudocode statements changes the variable's contents to "robot"?



a.)Set str[0] = "ro"


b.)insert(str, length(str), "ro")


c.)insert(str, 0, "ro")


d.)Set str = str + "ro"


e.)None of the above

b.)insert(str,0,"ro")

A ________ module is a type of module that calls itself.

recursive

If a recursive module has no code to stop it from repeating then it is like a ________ loop.

Infinite

True/False: One of the advantages of a recursive algorithm is that it does not matter how many recursive calls are made to a module; only one instance of the parameters are needed.

False

The choice between using recursion or a loop is primarily a ________ decision.

design

A recursive module is similar to a(n) ________ in that it must have some way to control the number of times it repeats.

Loop Structure

True/False: In a recursive algorithm, the computer completes the base case first and then works on the recursive cases.

False

Which of the following is a mathematical game that is often used in computer science textbooks to demonstrate the power of recursion?



a.)Rubik's Cube


b.)The Towers of Hanoi


c.)Blackjack


d.)Chess


e.)Hangman

b.)The Towers of Hanoi

True/False: There can be several modules involved in a recursive algorithm.

True

If a recursive module calls itself ten times, after the tenth call it returns to the ________.

ninth call

The process of calling a module requires several actions to be performed by the computer and is referred to as ________.

Overhead

True/False: The Fibonacci Series is a well-known mathematical problem that is solved recursively.

True


True/False: The depth of recursion refers to the length and complexity of the recursive algorithm.

False

Which of the following can be solved with recursion?



a.)Binary search


b.)Finding the greatest common divisor


c.)The Fibonacci Series


d.)None of the above


e.)All of the above

e.)All of the above

True/False: The term "callback potential" refers to number of times a module calls itself.

False

The first step in setting up a recursive module is to ________.

Identify at least one case in which the problem can be solved without recursion

A problem can be solved with recursion if it can be broken down into ________ that are identical to the overall problem.

successive smaller problems

The total number of times a module calls itself recursively is known as the ________ of recursion.

Depth

Each time a recursive module calls itself, it creates a new ________ of the parameters of the modules.

instance

In the ________ case the problem is reduced to a smaller version of the original problem.

recursive

The majority of repetitive programming tasks are best done with which of the following?



a.)Sequence structures


b.)Loops


c.)Decision structures


d.)Recursion


e.)All of the above

b.)Loops

Recursion can be a powerful tool for solving ________ problems.

Repetitive

True/False: It is not necessary to have a conditional expression to terminate the recursive calls.

False

True/False: When creating a recursive algorithm it is optional to identify the base case and the recursive case of the algorithm.

False

True/False: It is possible for a module to call itself.

True

When the recursive module makes the last call to itself, the If-Then statements condition expression is ________.

false

True/False: A recursive algorithm is never required to solve a problem.

True

When module A is calling module B and module B calls module A, it is called ________ recursion.

indirect

In the following example, how many times does the module calls itself?
Module main ( )
Call Welcome (5)
End Module

Module Welcome (Integer number)
If number > 0 Then
Display "Welcome to our store."
Call Welcome (number - 1)
End If
End Module

6

True/False: Comparing the recursive algorithm of a binary search with its counterpart, without recursion, it is much more elegant and easier to understand.

True

True/False: Recursive algorithms are more efficient that iterative algorithms.

False