Programming Logic and Design, Chapters 7-13 & 15

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Properties

By specifying characteristics such as color, size, and location, __________ determine how a GUI element appears on the screen.

Two-dimensional arrays

An array with both rows and columns of values; you must use two subscripts when you access an element in it.

Component

An item that appears in a program's graphical user interface is known as a(n) __________.

Internal name

Analyze the pseudocode. Declare OutputFile customerFile "customerFile" indicates the ________.

Mode

Analyze the pseudocode. Declare OutputFile customerFile The word "OutputFile" indicates the ________.

Runtime

Array bounds checking typically happens at ________.

Three-dimensional arrays

Arrays in which each element is accessed using three subscripts

Command line interface

Before GUIs became popular, the __________ was the most commonly used.

Opened

Before a file can be used by a program, it must be ________.

End the program

If a menu-driven program uses a loop to redisplay the menu after a selected operation has been performed, the menu should probably have an item that the user can select to __________.

Descending

If an array is sorted in this order, the values are stored from highest to lowest.

Ascending

If an array is sorted in this order, the values are stored from lowest to highest.

delete(str, 3, 6)

If the str variable contains the string "Redmond", which pseudocode statement changes its contents to "Red"?

insert(str, 0, "black")

If the str variable contains the string "berry", which pseudocode statement changes its contents to "blackberry"?

Input validation

In the process of ________, if the input is invalid, the program should discard it and prompt the user to enter the correct data.

Selection sort

In this algorithm, the smallest value in the array is located and moved to element 0. Then the next smallest value is located and moved to element 1. This process continues until all of the elements have been placed in their proper order.

Depth of recursion

The number of times that a module calls itself is known as the __________.

Base case

The part of a problem that can be solved without recursion is the __________.

Recursive case

The part of a problem that is solved with recursion is the __________.

Initialization list

The series of values inside the braces and separated with commas is the ________.

Insertion sort

This algorithm begins by sorting the first two elements of the array, which become a sorted subset. Then the third element is moved to its correct position relative to the first two elements. At that point, the first three elements become the sorted subset. This process continues with the fourth and subsequent elements until the entire array is sorted.

Bubble sort

This algorithm makes several passes through an array and causes the larger values to gradually move toward the end of the array with each pass.

Sequential search

This algorithm uses a loop to step through each element of an array, starting with the first element, searching for a value.

Size declarator

This appears in an array declaration and specifies the number of elements in the array.

Subscript

This is a number that identifies a storage location in an array.

True

True/False. A recursive algorithm must reduce the problem to a smaller version of the original problem in the recursive case.

False

True/False. A recursive algorithm must solve the problem with recursion in the base case.

True

True/False. Any algorithm that can be coded with recursion can also be coded with a loop.

True

True/False. If a menu-driven program does not use a loop to redisplay the menu after each operation, the user will have to rerun the program to select another operation from the menu.

True

True/False. In most cases, a menu-driven program should be modularized.

True

True/False. In most programming languages, when you use a subscript or other mechanism to access an individual character position within a string, that character position must already exist or an error will occur.

False

True/False. It is not usually necessary to validate the user's menu selection.

True

True/False. It's best to use a priming read instead of a posttest loop because a posttest loop does not display an error message when the user enters an invalid value.

True

True/False. The EOF marker's purpose is to indicate where the file's contents end.

False

True/False. The EOF marker's purpose is to separate the different items that are stored in a file.

False

True/False. The delimiter's purpose is to indicate where the file's contents end.

True

True/False. The delimiter's purpose is to separate the different items that are stored in a file.

False

True/False. The priming read appears inside the validation loop.

False

True/False. Writing data to a disk is faster than writing data to memory.

False

True/False. You can access an uninitialized variable.

False

True/False. You cannot use nested If-Then-Else statements to perform the action selected by the user from a menu.

True

True/False. You typically have to declare both the mode in which you will use the file and internal name before you can work with the file.

n/2

Typically, for an array of n items, the sequential search will locate an item in ________ attempts.

Error traps

Validation loops are also known as ________.

Open the file-process the file-close the file

What are the three steps that must be taken when a file is used by a program?

Garbage In, Garbage Out

What does GIGO stand for?

An error will occur.

What will the following pseudocode result in? Declare String name = "Sall" Set name[4] = "y"

Append

When a file is opened in ________ mode, data will be written at the end of the file's existing contents.

Direct recursion

When a module explicitly calls itself it is called __________.

Close the file

When a program is finished using a file, it should ________.

Indirect recursion

When module A calls module B, which calls module A, it is called __________.

Decision

When the user selects an item from a menu, the program must use a(n) __________ structure to perform an action based on that selection.

Submenu

When the user selects an item from a multiple-level menu, a(n) __________ might be displayed next.

Single-level menu

When the user selects an operation from a(n) __________, the program immediately performs that operation and then the program redisplays the menu (or the program ends if it does not use a loop to redisplay the menu).

Multiple-level menu

When the user selects an operation from a(n) __________, the program might display another menu.

Sequential access

When working with a(n) ________ file, you access its data from the beginning of the file to the end of the file.

Direct access

When working with a(n) ________ file, you can jump directly to any piece of data in the file without reading the data that come before it.

Output

When you open a(n) ________ file you are creating the file on the disk.

Cookie

When you visit a Web page, the browser stores a ________ on your computer.

Display str[0]

Which pseudocode statement displays the first character in the String variable str?

Display str[length(str) - 1]

Which pseudocode statement displays the last character in the String variable str?

Rows and columns

You typically think of a two-dimensional array as containing ________.

Filename extensions

________ are short sequences of characters that appear at the end of a filename preceded by a period.

Control break logic

________ interrupts a program's regular processing to perform a different action when a control variable's value changes or the variable acquires a specific value. After the action is complete, the program's regular processing resumes.

Defensive programming

________ is the practice of anticipating errors that can happen while a program is running, and designing the program to avoid those errors.

Empty input

________ is the reading when an input operation attempts to read data, but there is no data to read.

Control-break programming

________ means that the program performs some ongoing task, but temporarily interrupts the task when a control variable changes its value. When this happens, some other action is performed and then the program resumes its ongoing task.

Off-by-one error

________ occurs when a loop iterates one time too many or one time too few.

Garbage In, Garbage Out

________ refers to the fact that computers cannot tell the difference between good data and bad data.

The Towers of Hanoi

__________ is a mathematical game that is often used in computer science textbooks to illustrate the power of recursion.

Binary

A ________ file contains data that has not been converted to text.

Input

A file that data is read from is known as a(n) ________ file.

Output

A file that data is written to is known as a(n) ________ file.

4

A module is called once from a program's main module, and then it calls itself four times. The depth of recursion is __________.

Recursive module

A module that calls itself is known as a(n) __________.

Array

A named storage location in memory that can hold a group of values and is specifically designed for storing and processing lists of data.

Main menu

A program that uses a multiple-level menu displays the __________ when it starts.

Sequential sort

A sorting algorithm that typically uses nested loops and requires approximately n^2 comparisons to sort n elements.

GUI

A type of program that is typically event-driven is the __________ program.

File specification document

A(n) ________ describes the fields that are stored in a particular file, including their data types.

EOF marker

A(n) ________ is a character or set of characters that marks the end of a file.

Delimiter

A(n) ________ is a character or set of characters that marks the end of a piece of data.

Record

A(n) ________ is a complete set of data that describes one item.

Print spacing chart

A(n) ________ is a sheet of paper that has a grid, similar to graph paper.

Field

A(n) ________ is a single piece of data within a record.

Buffer

A(n) ________ is a small "holding section" in memory that many systems write data to before writing the data to a file.

Menu

A(n) __________ is a list of operations displayed on the screen that the user may choose from.

Event handler

A(n) __________ is a module that automatically executes when a specific event occurs.

Dialog box

A(n) __________ is a small window that displays information and allows the user to perform actions.

Event

A(n) __________ is an action that takes place within a program, such as the clicking of a button.

Case

A(n) __________ structure is often the easiest and most straightforward decision structure to use in a menu-driven program. Note: Other approaches can be taken as an alternative.

Overhead

Actions taken by the computer when a module is called, such as allocating memory for parameters and local variables, are referred to as __________.

Bounds checking

Many programming languages perform this, which means they do not allow a program to use an invalid array subscript.

Sequential search algorithm

Search algorithm to find a value in a list that consists of checking every one of its elements, one at a time and in sequence, until the desired one is found.

Priming read

The ________ is the first input operation that appears before the validation loop.

Read position

The ________ marks the location of the next item that will be read from a file.

GUI

The __________ allows the user to interact with the operating system through graphical elements on the screen.

User interface

The __________ is the part of a computer with which the user interacts.

n/2

The average number of comparisons performed by the sequential search algorithm on an array of n elements is ________.

Text

The contents of a(n) ________ file can be viewed in an editor such as Notepad.

Numbers sub zero

The expression "numbers[0]" is pronounced ________.

eof(myFile) == False

The expression NOT eof(myFile) is equivalent to ________.

Input

The integrity of a program's output is only as good as the integrity of the program's ________.

n

The maximum number of comparisons performed by the sequential search algorithm on an array of n elements is ________.

Element

This is an individual storage location in an array.

0

This is typically the first subscript in an array.

The size of the array minus one

This is typically the last subscript in an array.

Sequential search

This search algorithm is adequate for small arrays but not large arrays.

Binary search

This search algorithm repeatedly divides the portion of an array being searched in half.

Binary search

This search algorithm requires that the array's contents be sorted.

Sequential search

This search algorithm steps sequentially through an array, comparing each item with the search value.

Parallel arrays

This term describes two or more arrays that hold related data, and the related elements in each array are accessed with a common subscript.

Sorting algorithm

This type of algorithm rearranges the values stored in an array in some particular order.

Accumulator variable

To calculate the total of the values in an array, you use a loop with an ________.

Named constants

To make programs easier to maintain, many programmers use these to specify the size of an array.


Set pelajaran terkait

chapter 4 state of consciousness

View Set

Social Work Study Session 6 Quiz

View Set

Chapter 6 Study Guide: Enlightenment and Revolution

View Set

13- THE CIVIL SERVICE COMMISSION

View Set

Section 7, Unit 4: Mortgage Lending Tax Impacts

View Set