ITS-250: Midterm - Repetition Structures

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

1/34

encourage image

There's no tags or description

Looks like no tags are added yet.

35 Terms

1
New cards

Iterable

An object that is similar to a list. It contains a sequence of values that can be iterated over with something like a loop

2
New cards

Target Variable

The target of an assignment at the beginning of each loop iteration

3
New cards

Initialization, Comparison, Update

The three actions that your code must perform in order to write a count-controlled while loop

4
New cards

Initialization

The counter variable must be initialized to a suitable starting value before the loop begins

5
New cards

Comparison

The loop must compare the counter variable to a suitable ending value, to determine whether the loop should iterate or not

6
New cards

Update

During each iteration, the loop must update the counter variable with a new value

7
New cards

Counter Variable

A variable that is assigned a unique value during each iteration of a loop

8
New cards

Infinite Loop

If a loop does not have a way of stopping it is called an ___. They repeat until the program is interrupted

9
New cards

Pretest Loop

The while loop is known as a ___, which means it tests its condition before performing an iteration

10
New cards

Iteration

Each execution of the body of a loop

11
New cards

Count-Controlled Loop

Repeats a specific number of times

12
New cards

Condition-Controlled Loop

Uses a true/false condition to control the number of times that it repeats

13
New cards

Repetition Structure

Causes a statement or set of statements to execute repeatedly

14
New cards

False

To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops

15
New cards

False

It is not necessary to initialize accumulator variables

16
New cards

True

In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop

17
New cards

True

The while loop is a pretest loop

18
New cards

Augmented Assignment

The -= operator is an example of a(n) operator

19
New cards

Accumulator

A(n) ___ variable keeps a running total

20
New cards

Sentinel

A(n) ___ is a special value that signals when there are no more items from a list of items to be processed. This value cannot be mistaken as an item from the list

21
New cards

Garbage In, Garbage Out

GIGO stands for ___

22
New cards

Input

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

23
New cards

Priming Read

The input operation that appears just before a validation loop is known as the ___

24
New cards

Error Traps

Validation loops are also known as ___

25
New cards

Break

The ___ statement causes a loop to terminate early

26
New cards

Continue

The ___ statement causes a loop to stop its current iteration and begin the next one

27
New cards

Else

When the ___ clause is used with a loop in Python, it executes when the loop ends normally, without encountering a break statement

28
New cards

True

T/F: inner loops complete their iterations faster than outer loops

29
New cards

Multiply

To get the total number of iterations in a nested loop, ___ the number of iterations of all the loops

30
New cards

Input Validation

The process of inspecting data that has been input to a program, to make sure it is valid before it is used in a computation

31
New cards

Loop

A control structure that causes a statement or group of statements to repeat as many times as necessary is known as a(n) _____

32
New cards

Diamond

The symbol that represents the condition being tested

33
New cards

Starting Value

The first argument passed to the range function

34
New cards

Ending Limit

The second argument passed to the range function

35
New cards

Step Value

The third argument passed to the range function