Exam 4: Repetition Structures

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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

Free
(True/False)
4.8/5
(47)
Correct Answer:
Verified

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.

Free
(True/False)
4.9/5
(34)
Correct Answer:
Verified

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):

Free
(True/False)
4.8/5
(35)
Correct Answer:
Verified

True

What will be displayed after the following code is executed? What will be displayed after the following code is executed?

(Multiple Choice)
4.7/5
(38)

A variable used to keep a running total is called a(n)

(Multiple Choice)
4.9/5
(42)

A(n)__________ validation loop is sometimes called an error trap or an error handler.

(Short Answer)
4.7/5
(36)

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.

(True/False)
4.8/5
(39)

A while loop is called a pretest loop because the condition is tested after the loop has had one iteration.

(True/False)
4.8/5
(42)

When will the following loop terminate? While keep_on_going != 999:

(Multiple Choice)
4.9/5
(35)

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

(Multiple Choice)
4.9/5
(33)

The following for loop iterates ___________ times to draw a square. for x in range(4): turtle.forward(200) turtle.right(90)

(Short Answer)
4.9/5
(36)

Which of the following represents an example to calculate the sum of numbers (that is,an accumulator),given that the number is stored in the variable number and the total is stored in the variable total?

(Multiple Choice)
4.7/5
(37)

A(n)__________ total is a sum of numbers that accumulates with each iteration of the loop.

(Short Answer)
4.8/5
(42)

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

(True/False)
4.7/5
(43)

In Python,the variable in the for clause is referred to as the __________ because it is the target of an assignment at the beginning of each loop iteration.

(Multiple Choice)
4.8/5
(32)

What will be displayed after the following code is executed? total =0 =0 for count in range (4,6): (4,6): \quad total += += count \quad print (total)

(Multiple Choice)
4.9/5
(34)

Functions can be called from statements in the body of a loop and loops can be called from within the body of a function.

(True/False)
4.8/5
(37)

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

(Multiple Choice)
4.9/5
(42)

In Python,a comma-separated sequence of data items that are enclosed in a set of brackets is called

(Multiple Choice)
4.8/5
(34)

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

(True/False)
4.8/5
(37)
Showing 1 - 20 of 41
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)