1/38
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Decision Structure (Selection Structure)
allows a program to perform actions only under certain conditions.
Control Structure
a logical design that controls the order in which a set of statements executes
If condition Then
statement
statement
etc.
End If
How do you write a decision structure in pseudocode?
George Boole
which are Boolean expressions named after?
Relational Operator (<, >, etc.)
determines whether a specific relationship exists between two values.
Dual alternative decision structure
This structure will execute one group of statements if its Boolean expression is true, or another group if its Boolean expression is false.
Single alternative decision structure
This structure only provides one alternative path of execution.
Nested (Nested Decision Structures)
To test more than one condition, a decision structure can be ___________ another decision structure.
Case Structure
This structure lets the value of a variable or an expression determine which path of execution the program will take.
Multiple Alternative Decision Structure
What type of decision structure is a case structure?
Case Structure
This structure allows you to test the value of a variable or an expression and then use that value to determine which statement or set of statements to execute.
AND, OR logical operators
These logical operators allow you to connect multiple Boolean expressions to create a compound expression.
Logical Operators
can be used to create complex Boolean expressions.
NOT operator
This logical operator reverses the truth of a Boolean expression.
Boolean variable
This type of variable can hold one of two values: true or false.
flags
Boolean variables are commonly used as _____, which indicate whether specific conditions exist.
Flag
is a variable that signals when some condition exists in the program.
Repetition Structure
This structure causes a statement or set of statements to execute repeatedly.
- Condition-controlled loop
- Count-controlled loop
Two categories of loops:
Condition-controlled loop
This loop uses a true/false condition to control the number of times that it repeats.
Count-controlled loop
this loop repeats a specific number of § times.
While and Do-While loops
These loops cause a statement or set of statements to repeat as long as a condition is true.
Do-until loop
This loop causes a statement or set of statements to repeat until a condition is true.
Boolean expression (its condition is)
what expression is a while loop?
Body of the loop
these are the statements that appear on the lines between the While and the End While clauses
Infinite Loop
continues to repeat until the program is interrupted.
- usually occur when the programmer forgets to write code inside the loop that makes the test condition false.
Do-while loop
This loop performs an iteration before testing its condition.
Do-until loop
iterates until a condition is true
- a loop that iterates as long as a condition is false, and then stops when the condition becomes true.
Count-controlled loop
This loop iterates a specific number of times. Although you can write the logic of a condition controlled loop so it iterates a specific number of times
For loop
most languages provide a loop known as the ____ loop, which is specifically designed as a count-controlled loop.
counter
A count-controlled loop uses a variable known as a __________ variable, or simply ___________, to store the number of iterations that it has performed.
counterVariable
is the name of a variable that is used as a counter
startingValue
is the value that the counter will be initially set to
maxValue
is the maximum value that the counter can contain.
step amount
The amount by which the counter variable is incremented in a For loop is known as the?
Sentinel
is a special value that marks the end of a list of values. When a program reads the sentinel value, it knows it has reached the end of the list, so the loop terminates.
Nested Loop
A loop that is inside another loop is called?
Running Total
is a sum of numbers that accumulates with each iteration of a loop
Accumulator
the variable used to keep the running total is called an?