Exam 4: Repetition Structures
Exam 1: Introduction to Computers and Programming39 Questions
Exam 2: Input, Processing, and Output40 Questions
Exam 3: Decision Structures and Boolean Logic40 Questions
Exam 4: Repetition Structures41 Questions
Exam 5: Functions66 Questions
Exam 6: Files and Exceptions40 Questions
Exam 7: Lists and Tuples40 Questions
Exam 8: More About Strings37 Questions
Exam 9: Dictionaries and Sets39 Questions
Exam 10: Classes and Object-Oriented Programming38 Questions
Exam 11: Inheritance36 Questions
Exam 12: Recursion35 Questions
Exam 13: Gui Programming42 Questions
Select questions type
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:
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:
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:
True
What will be displayed after the following code is executed?


(Multiple Choice)
4.7/5
(38)
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
for count in range
total count
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)