Chapter 4

¡Supera tus tareas y exámenes ahora con Quizwiz!

A __________ structure can execute a set of statements only under certain circumstances.

...

What are the following operators? 1. greater than 2. less than 3. greater than or equal to 4. less than or equal to 5. equal to 6. not equal to

1. > 2. < 3. >= 4. <= 5. == 6. !=

Control structure

a logical design that controls the order in which a set of statements execute

Sequence Structure

a set of statements that execute in the order that they appear

flag

a variable that signals when some condition exists in the program

Conditionally Executed

action that is performed only when a certain condition is true

Compare strings

allows you to create decision structures that test the value of a string

if clause

begins with the word if and is followed by the "condition"

How do we test more than one condition?

by nesting a decision structure inside another decision structure

Decision or Selection structures

can execute a set of statements only under certain circumstances

Relational Operator

determines whether a specific relationship exists between two values

condition

expression that will be evaluated as either true or false

Boolean expression

expressions tested by the if statement

Dual Alternative Decision Structure

has two possible paths of execution one path is taken if the condition is true and another is taken if the condition is false

Example if-elif-else statement

if condition1: statement statement elif condition2: statement statement else: statement statement

Example if-else statement

if condition: statement statement else: statement statement

sample if statement

if condition: statement statement

Single Alternative Decision Structure

provides only one alternative path of execution

What happens when the if statement executes?

the condition is tested if it is true the statements in the block are executed if it is false the statements in the block are skippped

What is used to write a single alternative decision structure?

the if statement

What values can be assigned to a bool variable?

true or false

if statement

used to create a decision structure, which allows a program to have more than one path of execution Causes one or more statements to execute only when a boolean expression is true

nested block

when a block of code that is inside another block of code is indented

if-else statement

will execute one block of statements if its condition is true, or another block if its condition is false


Conjuntos de estudio relacionados

Chapter 13 Abnormal Uterine Bleeding (DMS120)

View Set

Math 221 Extra Practice Problems

View Set

Language Conventions: Noun Clauses

View Set

digestive system BY: Lorelei Moll

View Set