chapter 3-4 intor programing

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

What are the values that the variable num contains through the iterations of the following for loop? for num in range(4)

0, 1, 2, 3

What are the values that the variable num contains through the iterations of the following for loop? for num in range(2, 9, 2):

2, 4, 6, 8

Which of the following is not an augmented assignment operator?

<=

In Python, an infinite loop usually occurs when the computer accesses an incorrect memory address

False

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

False

Python uses the same symbols for the assignment operator as for the equality operator.

False

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

False

The first line in a while loop is referred to as the condition clause.

False

The integrity of a program's output is only as good as the integrity of its input. For this reason, the program should discard input that is invalid and prompt the user to enter valid data.

False

To get the total number of iterations in a nested loop, add the number of iterations in the inner loop to the number in the outer loop.

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 is the result of the following Boolean expression, given that x = 5, y = 3, and z= 8? not (x < y or z > x) and y < z

False

A good way to repeatedly perform an operation is to write the statements for the task once and then place the statements in a loop that will repeat as many times as necessary.

True

Both of the following for clauses would generate the same number of loop iterations. for num in range(4): for num in range(1, 5):

True

In a flowchart, both the decision structure and the repetition structure use the diamond symbol to represent the condition that is tested.

True

In a nested loop, the inner loop goes through all of its iterations for each iteration of the outer loop.

True

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

True

Reducing duplication of code is one of the advantages of using a loop structure.

True

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

True

The integrity of a program's output is only as good as the integrity of its input. For this reason, the program should discard input that is invalid and prompt the user to enter valid data.

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

A Boolean variable can reference one of two values which are

True or Flase

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

compound

What type of loop structure repeats the code based on the value of Boolean expression?

condition-controlled loop

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

control

What type of loop structure repeats the code a specific number of times?

count-controlled loop

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

dual alternative

Which of the following is the correct if clause to determine whether y is in the range 10 through 50, inclusive?

if y>= 10 and y <=50:

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

or

Which logical operators perform short-circuit evaluation?

or, and


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

Chapter 11 Poisoning & Substance Abuse

View Set

Pierre L'Enfant and the purpose of Washington D.C.

View Set

Chapter 54: Drugs Acting on the Upper Respiratory Tract

View Set

Graphic Design History Final (pt. 1)

View Set

Spanish 1 Unit 2/ 8.2 Grammar: Friends & Family

View Set

chapter 27 growth and development of the preschooler

View Set