Programming Logic and Design (ITSE-1329-271)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/78

flashcard set

Earn XP

Description and Tags

Final Exam Review

79 Terms

1
New cards

A _______________ expression has one of two values: true or false.

Boolean

2
New cards

A trivial Boolean expression is one that _______________.

always has the same value


3
New cards

In a selection, the statements in an else clause execute _______________.

when the tested condition is false

4
New cards

An expression that uses a greater-than operator evaluates as true when _______________.

the left operand is greater than the right operand

5
New cards

When you use a range check, you always compare a variable to _______________ value in the range.

either the lowest or highest

6
New cards

The structure that allows you to write one set of instructions that operates on multiple, separate sets of data is the _______________.

loop

7
New cards

The loop that frequently appears in a program's mainline logic _______________.

works correctly based on the same logic as other loops

8
New cards

Which of the following is not a step that must occur with every correctly working loop?

Set the loop control value equal to a sentinel during each iteration.

9
New cards

The statements executed within a loop are known collectively as the _______________.

loop body

10
New cards

A counter keeps track of _______________.

the number of times an event has occurred

11
New cards

Adding 1 to a variable is also called _______________ it.

incrementing

12
New cards

Which of the following is a definite loop?

a loop that executes 1,000 times

13
New cards

Which of the following is an indefinite loop?

a loop that asks the user whether to continue during each iteration

14
New cards

When two loops are nested, the loop that is contained by the other is the _______________ loop

inner

15
New cards

When loops are nested, _______________.

the inner loop ends before the outer loop

16
New cards

Most programmers use a for loop _______________.

when they know the exact number of times a loop will repeat

17
New cards

A report that lists only totals, with no details about individual records, is a(n) _______________ report.

summary

18
New cards

Typically, the value added to a counter variable is

1

19
New cards

Typically, the value added to an accumulator variable is

different in each iteration

20
New cards

After an accumulator or counter variable is displayed at the end of a program, it is best to

do nothing to the variable's value

21
New cards

When you _______________, you make sure data items are the correct type and fall within the correct range.

validate data

22
New cards

Overriding a user's entered value by setting it to a predetermined value is known as

forcing

23
New cards

To ensure that a user's entry is the correct data type, frequently you

use a module built into the programming language

24
New cards

A variable cannot hold an incorrect value when it is

A variable might always hold an incorrect value.

25
New cards

A do-while loop _______________.

can be replaced by a sequence and a while loop

26
New cards

A subscript is a(n)

number that indicates the position of an array element

27
New cards

Each element in an array must have the same _______________as the others.

data type

28
New cards

Suppose that you have declared a numeric array named values that has 13 elements. Which of the following must be true?

values[13] is out of bounds

29
New cards

The subscripts of any array are always

integers

30
New cards

Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[4]. You know that _______________.

there are exactly two elements between those two elements

31
New cards

Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[4]. You know that _______________.

the array has at least five elements

32
New cards

A program contains a seven-element array that holds the names of the days of the week. At the start of the program, you display the day names using a subscript named dayNum. You display the same array values again at the end of the program, where you _______________ as a subscript to the array.

can use dayNum, but can also use another numeric value

33
New cards

Filling an array with values during a program's execution is known as _______________ the array.

populating

34
New cards

A _______________ is a variable that can be set to indicate whether some event has occurred.

flag

35
New cards

Two arrays in which each element in one array is associated with the element in the same relative position are _______________.

parallel

36
New cards

In most modern programming languages, the highest subscript you should use with a 12-element array is

11

37
New cards

The values stored in parallel arrays

frequently have an indirect relationship

38
New cards

Each element in a seven-element array can hold _______________ value(s).

one

39
New cards

When you use a subscript value that is negative or higher than the number of elements in an array, _______________.

the resulting action depends on the programming language used

40
New cards

In every array, a subscript is out of bounds when it is

negative

41
New cards

You can access every element of an array using

either a while loop or a for loop

42
New cards

Random access memory is _

volatile

43
New cards

Text files usually contain __

data that can be read in a text editor

44
New cards

Every file on a storage device

has a size

45
New cards

Which of the following is true regarding the data hierarchy?

Files contain records

46
New cards

The process of _______________ a file locates it on a storage device and associates a variable name within your program with the file.

opening

47
New cards

When you write to a file, you

copy data from memory to a storage device

48
New cards

Unlike when you print a report or display information on a screen, when a program's output is a data file, you do not

include explanations or formatting such as dollar signs

49
New cards

When you close a file, it _

is no longer available to the program

50
New cards

A file in which records are stored one after another in order based on the contents of a field is a(n) _______________ file.

sequential

51
New cards

When you combine two or more sorted files while maintaining their sequential order based on a field, you are _______________ the files.

merging

52
New cards

A control break occurs when a program

pauses to perform special processing based on the value of a field

53
New cards

Which of the following is an example of a control break report?

. a list of all customers of a business in zip code order, with a count of the number of customers who reside in each zip code

54
New cards

A control break field _______________.

causes special processing to occur

55
New cards

Whenever a control break occurs during record processing in any control break program, you must _______________.

update the value in the control break field

56
New cards

When you merge records from two or more sequential files, the usual case is that the records in the files

have the same format

57
New cards

A file that holds more permanent data than a transaction file is a(n) _______________ file.

primary

58
New cards

A transaction file is often used to _______________ another file.

update

59
New cards

The saved version of a file that does not contain the most recently applied transactions is known as a _______________ file.

parent

60
New cards

Random access files are used most frequently in all of the following except _______________.

batch processing

61
New cards

Employee records stored in order from highest-paid to lowest-paid have been sorted in _______________ order.

descending

62
New cards

Student records stored in alphabetical order by last name have been sorted in _______________ order.

ascending

63
New cards

When computers sort data, they always _______________.

use numeric values when making comparisons

64
New cards

Which type of sort compares list items in pairs, swapping any two adjacent values that are out of order?

bubble sort

65
New cards

To sort a list of 15 values using a bubble sort, the greatest number of times you would have to pass through the list making comparisons is

14

66
New cards

To completely sort a list of 10 values using a bubble sort, the greatest possible number of required pair comparisons is

81

67
New cards

When you do not know how many items need to be sorted in a program, you can create an array that has _______________.

at least as many elements as the number you predict you will need

68
New cards

In a bubble sort, on each pass through the list that must be sorted, you can stop making pair comparisons

one comparison sooner

69
New cards

When performing a bubble sort on a list of 10 values, you can stop making passes through the list of values as soon as _______________ on a single pass through the list.

no swaps are made

70
New cards

The bubble sort is _______________.

a relatively easy sort to understand

71
New cards

Data stored in a table that can be accessed using row and column numbers is stored as a _______________ array.

two-dimensional

72
New cards

A two-dimensional array declared as num myArray[6][7] has _______________ columns.

7

73
New cards

In a two-dimensional array declared as num myArray[6][7], the highest row number is

5

74
New cards

If you access a two-dimensional array with the expression output myArray[2][5], the output value will be

impossible to tell from the information given

75
New cards

Three-dimensional arrays

are supported in many modern programming languages

76
New cards

Student records are stored in ID number order but accessed by grade-point average for a report. In this example, grade-point average order is a(n) _______________ order.

logical

77
New cards

When you store a list of key fields paired with the storage address for the corresponding data record, you are creating

an index

78
New cards

When a record in an indexed file is not needed for further processing, _______________.

the record can stay in place physically, but its reference is removed from the index

79
New cards

With a linked list, every record _______________.

contains a field that holds the address of another record