Test 2

Ace your homework & exams now with Quizwiz!

dual alternative decision structure

2 possible path of an execution. 1 path is taken if true and another if it false. IF ELSE statements

In Python the ________ symbol is used as the equality operator.

==

Boolean expression was name after

English mathematician George Boole

not

The unary operation _________ inverts the value of its operand. Must be a boolean expression. Reverses the truth of its operand. The expression is true it will be false, if false it returns true.

A Boolean variable can reference one of two values which are

True or False

What is an example of a sequence structure

When everything executed from top to bottom

block

a set of statements that belong together as a group

What is y after the following statements are executed? x = 0 y = "red" if x > 0 else "blue"

blue

and

combines into one expression. BOTH must be true

or

combines into one expression. One or both can be true. doesnt matter which is true

What do bool data types allow you to do?

create variables that are true or false

relational operator

determines wether a specific relationship exists between 2 values (< > =)

The decision structure that has two possible paths of execution is known as

dual alternative

What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8?x < y and z > x

false

boolean expression

if statement tests an expression to determine whether true or false

control structure

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

What will print if x = 9? if x >= 10: print ("10 or larger")

nothing will print

single alternative decision structure

provides only one alternative path of execution

Which statement will give a random number between 1 & 5 inclusive (meaning only numbers 1 2 3 4 or 5)

random.randint (1, 5)

sequence structure

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

Conditionally executed

specific actions can only be accomplished if a certain condition exists

When is the best time to use the "or" operator

to determine whether the value is OUT of range

When is the best time to use the "and" operator?

to determine whether the value is in range

Expressions that are tested by the if statement are called Boolean expressions.

true

Flag

variable that signals when some condition exists in the program


Related study sets

Organizational Psychology- Quiz 10 CH 14

View Set

Anatomy of the Fingers, Hand, and Wrist

View Set

Nutrition Chapter 13: Food Insecurity

View Set

Nerve Innervation - Upper Extremity

View Set