CS 120 Chapter 3

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

A(n) _____ structure is a logical design that controls the order in which a set of statements execute.

Control

Python allows you to compare strings, but it is not case sensitive.

False

Short -circuit evaluation is only performed with the not operator.

False

The Python language is not sensitive to block structuring of code.

False

The not operator is a unary operator which must be used in a compound expression.

False

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

False

What will be displayed if the following code is executed and number is 35? if number % 2 == 0: print(number, "is even") else: print(number, "is odd")

Is odd

Which logical operators perform short-circuit evaluation?

Or, and

An action in a single alternative decision structure is performed only when the condition is true.

True

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

True

Nested decision statements are one way to test more than one condition.

True

The if statement causes one or more statements to execute only when a Boolean expression is true.

True

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

True

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

True or False

When using the __________ logical operator, both subexpressions must be true for the compound expression to be true.

and

Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions.

compound

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

dual alternative

Write an if statement that increases pay by 3% if score is greater than 90

if score > 90: pay = pay + pay * 0.03 print ("Your pay has increased by 3%") else: print("You must achieve a score greater than 90 to gain an increased pay)

Write an if statement that assigns 1 to x if y is greater than 0.

if y > 0: x = 1 (y needs to be defined for this to work I believe.)

What will be displayed if the following code is executed and number is 30? if number % 2 == 0: print(number, "is even") print(number, "is odd")

is even

When using the __________ logical operator, one or both of the subexpressions must be true for the compound expression to be true.

or

What does the following expression mean? x <= y

x is less than or equal to y


संबंधित स्टडी सेट्स

Mastering Biology Chapter 2.5 review

View Set

bio exam 2 practice test questions

View Set

NU 112- Nursing Concepts (SAFETY AND INFECTION CONTROL) HESI REVIEW

View Set

accounting 200- chapter 7 multiple choice

View Set

Unit 3: Ch. 3 Study Guide Exam 1

View Set

Western Civilization II-Chapter 21

View Set

GGG's Asthma and autocoids review questions

View Set