Chapter 3 - Reading Quiz - CSC121

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

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

Compound

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

True

A Boolean variable can reference one of two values which are

True/False

executed because it is performed only when a specific condition is true.

conditionally

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

control

statement is used to create a decision structure.

if

Which of the following will hide the turtle if it is visible?

if turtle.isvisible(): turtle.hideturtle()

Python provides a special version of a decision structure known as the ___________ statement, which makes the logic of the nested decision structure simpler to write.

if-elif-else

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

if-else

In Python the ________ symbol is used as the not-equal-to operator.

!=

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

==

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

False

Python uses the same symbols for the assignment operator as for the equality operator. T/F

False

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

False

Decision structures are also known as selection structures. T/F

True

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

True

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

True

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

True

The following code snippet will change the turtle's pen size to 4 if it is presently less than 4: if turtle.pensize() < 4: turtle.pensize(4) T/F

True

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

and

Boolean variables are commonly used as _______________ to indicate whether a specific condition exists.

flags

The logical _______________ operator reverses the truth of a Boolean expression.

not

Which logical operators perform short-circuit evaluation?

not, and

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

or

operator determines whether a specific relationship exists between two values.

relational

The following statement will check to see if the turtle's pen color is 'green': if turtle.pencolor() = 'green' T/F

False

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

False

decision structure provides only one alternative path of execution.

Single alternative

The turtle.isdown() function returns _____________ if the turtle's pen is down.

true

symbol is used to represent a Boolean expression.

Diamond

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

Dual alternative

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

True

expression is made up of two or more Boolean expressions.

compound

Which of the following is the correct if clause to determine whether choice is anything other than 10?

if choice != 10:

Which of the following will determine if the turtle's pen is up and will change it to down if that is the case?

if not(turtle.isdown()): turtle.pendown()


Conjuntos de estudio relacionados

1984 Part III Content Study Guide

View Set

US History Regents Vocab: Home Rule - Imperialism

View Set

Types of pressure cookers and Slow cookers

View Set

BMGT 3630 TEST 5 CH 11, 12, 13 & 16

View Set

CompTIA Network+ Certification Practice Exam (N10-007) 550 Questions

View Set

Sales General Exam - Stringham Real Estate School

View Set

History of Art 3 Study Guide for Exam 3

View Set