Deck 4: Repetition Structures

ملء الشاشة (f)
exit full mode
سؤال
In a flowchart,both the decision structure and the repetition structure use the diamond symbol to represent the condition that is tested.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
What are the values that the variable num contains through the iterations of the following for loop?
For num in range(2,9,2):

A) 2, 3, 4, 5, 6, 7, 8, 9
B) 2, 5, 8
C) 2, 4, 6, 8
D) 1, 3, 5, 7, 9
سؤال
A(n)__________ structure is a structure that causes a statement or a set of statements to execute repeatedly.

A) sequence
B) decision
C) module
D) repetition
سؤال
In a nested loop,the inner loop goes through all of its iterations for each iteration of the outer loop.
سؤال
Reducing duplication of code is one of the advantages of using a loop structure.
سؤال
Functions can be called from statements in the body of a loop and loops can be called from within the body of a function.
سؤال
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):
سؤال
A variable used to keep a running total is called a(n)

A) accumulator
B) total
C) running total
D) summer
سؤال
__________ is the process of inspecting data that has been input into a program in order to ensure that the data is valid before it is used in a computation.

A) Input validation
B) Correcting data
C) Data validation
D) Correcting input
سؤال
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.
سؤال
What type of loop structure repeats the code a specific number of times?

A) condition-controlled loop
B) number-controlled loop
C) count-controlled loop
D) Boolean-controlled loop
سؤال
What are the values that the variable num contains through the iterations of the following for loop?
For num in range(4):

A) 1, 2, 3, 4
B) 0, 1, 2, 3, 4
C) 1, 2, 3
D) 0, 1, 2, 3
سؤال
Which of the following is not an augmented assignment operator?

A) *=
B) /=
C) +=
D) <=
سؤال
In Python,an infinite loop usually occurs when the computer accesses an incorrect memory address.
سؤال
The first line in a while loop is referred to as the condition clause.
سؤال
A while loop is called a pretest loop because the condition is tested after the loop has had one iteration.
سؤال
In order to draw an octagon with turtle graphics,you would need a loop that iterates eight times.
سؤال
What type of loop structure repeats the code based on the value of Boolean expression?

A) condition-controlled loop
B) number-controlled loop
C) count-controlled loop
D) Boolean-controlled loop
سؤال
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.
سؤال
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.
سؤال
In Python,a comma-separated sequence of data items that are enclosed in a set of brackets is called

A) sequence
B) variable
C) value
D) list
سؤال
When will the following loop terminate?
While keep_on_going != 999:

A) when keep_on_going refers to a value less than 999
B) when keep_on_going refers to a value greater than 999
C) when keep_on_going refers to a value equal to 999
D) when keep_on_going refers to a value not equal to 999
سؤال
What will be displayed after the following code is executed?
<strong>What will be displayed after the following code is executed?  </strong> A) counting counting counting counting B) counting Counting Counting Counting C) counting Counting D) counting Counting Counting <div style=padding-top: 35px>

A) counting counting counting counting
B) counting
Counting
Counting
Counting
C) counting
Counting
D) counting
Counting
Counting
سؤال
The first operation is called the __________ and its purpose is to get the first input value that will be tested by the validation loop.

A) priming read
B) first input
C) loop set read
D) loop validation
سؤال
A(n)__________ validation loop is sometimes called an error trap or an error handler.
سؤال
What will be displayed after the following code is executed?
What will be displayed after the following code is executed?    <div style=padding-top: 35px>
What will be displayed after the following code is executed?    <div style=padding-top: 35px>
سؤال
A(n)__________ is a special value that marks the end of a sequence of items.
سؤال
A(n)__________ total is a sum of numbers that accumulates with each iteration of the loop.
سؤال
In Python,you would use the __________ statement to write a count-controlled loop.
سؤال
The while loop is known as a(n)__________ loop because it tests the condition before performing an iteration.
سؤال
A(n)__________-controlled loop causes a statement or set of statements to repeat as long as the condition is true.
سؤال
What will be displayed after the following code is executed?
<strong>What will be displayed after the following code is executed?  </strong> A) 30 B) 25 C) 0 5 10 15 20 D) 5 10 15 <div style=padding-top: 35px>

A) 30
B) 25
C) 0 5 10 15 20
D) 5 10 15
سؤال
A(n)___________ structure causes a set of statements to execute repeatedly.
سؤال
What does the following program do?
<strong>What does the following program do?  </strong> A) It accepts 4 test scores for 3 students and outputs the average of the 12 scores. B) It accepts 3 test scores for each of 3 students and outputs the average for each student. C) It accepts 4 test scores for 2 students, then averages and outputs all the scores. D) It accepts one test score for each of 3 students and outputs the average of the 3 scores. <div style=padding-top: 35px>

A) It accepts 4 test scores for 3 students and outputs the average of the 12 scores.
B) It accepts 3 test scores for each of 3 students and outputs the average for each student.
C) It accepts 4 test scores for 2 students, then averages and outputs all the scores.
D) It accepts one test score for each of 3 students and outputs the average of the 3 scores.
سؤال
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.

A) target variable
B) loop variable
C) for variable
D) count variable
سؤال
The acronym __________ refers to the fact that the computer cannot tell the difference between good data and bad data.
سؤال
A(n)___________ loop usually occurs when the programmer does not include code inside the loop that makes the test condition false.
سؤال
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?

A) total + number = total
B) number += number
C) total += number
D) total = number
سؤال
What will be displayed after the following code is executed?
What will be displayed after the following code is executed?    <div style=padding-top: 35px>
What will be displayed after the following code is executed?    <div style=padding-top: 35px>
سؤال
The ___________ function is a built-in function that generates a list of integer values.
سؤال
The following for loop iterates ___________ times to draw a square.
for x in range(4):
turtle.forward(200)
turtle.right(90)
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/41
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 4: Repetition Structures
1
In a flowchart,both the decision structure and the repetition structure use the diamond symbol to represent the condition that is tested.
True
2
What are the values that the variable num contains through the iterations of the following for loop?
For num in range(2,9,2):

A) 2, 3, 4, 5, 6, 7, 8, 9
B) 2, 5, 8
C) 2, 4, 6, 8
D) 1, 3, 5, 7, 9
C
3
A(n)__________ structure is a structure that causes a statement or a set of statements to execute repeatedly.

A) sequence
B) decision
C) module
D) repetition
D
4
In a nested loop,the inner loop goes through all of its iterations for each iteration of the outer loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
5
Reducing duplication of code is one of the advantages of using a loop structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
6
Functions can be called from statements in the body of a loop and loops can be called from within the body of a function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
7
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):
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
8
A variable used to keep a running total is called a(n)

A) accumulator
B) total
C) running total
D) summer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
9
__________ is the process of inspecting data that has been input into a program in order to ensure that the data is valid before it is used in a computation.

A) Input validation
B) Correcting data
C) Data validation
D) Correcting input
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
10
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
11
What type of loop structure repeats the code a specific number of times?

A) condition-controlled loop
B) number-controlled loop
C) count-controlled loop
D) Boolean-controlled loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
12
What are the values that the variable num contains through the iterations of the following for loop?
For num in range(4):

A) 1, 2, 3, 4
B) 0, 1, 2, 3, 4
C) 1, 2, 3
D) 0, 1, 2, 3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
13
Which of the following is not an augmented assignment operator?

A) *=
B) /=
C) +=
D) <=
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
14
In Python,an infinite loop usually occurs when the computer accesses an incorrect memory address.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
15
The first line in a while loop is referred to as the condition clause.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
16
A while loop is called a pretest loop because the condition is tested after the loop has had one iteration.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
17
In order to draw an octagon with turtle graphics,you would need a loop that iterates eight times.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
18
What type of loop structure repeats the code based on the value of Boolean expression?

A) condition-controlled loop
B) number-controlled loop
C) count-controlled loop
D) Boolean-controlled loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
19
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
20
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
21
In Python,a comma-separated sequence of data items that are enclosed in a set of brackets is called

A) sequence
B) variable
C) value
D) list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
22
When will the following loop terminate?
While keep_on_going != 999:

A) when keep_on_going refers to a value less than 999
B) when keep_on_going refers to a value greater than 999
C) when keep_on_going refers to a value equal to 999
D) when keep_on_going refers to a value not equal to 999
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
23
What will be displayed after the following code is executed?
<strong>What will be displayed after the following code is executed?  </strong> A) counting counting counting counting B) counting Counting Counting Counting C) counting Counting D) counting Counting Counting

A) counting counting counting counting
B) counting
Counting
Counting
Counting
C) counting
Counting
D) counting
Counting
Counting
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
24
The first operation is called the __________ and its purpose is to get the first input value that will be tested by the validation loop.

A) priming read
B) first input
C) loop set read
D) loop validation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
25
A(n)__________ validation loop is sometimes called an error trap or an error handler.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
26
What will be displayed after the following code is executed?
What will be displayed after the following code is executed?
What will be displayed after the following code is executed?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
27
A(n)__________ is a special value that marks the end of a sequence of items.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
28
A(n)__________ total is a sum of numbers that accumulates with each iteration of the loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
29
In Python,you would use the __________ statement to write a count-controlled loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
30
The while loop is known as a(n)__________ loop because it tests the condition before performing an iteration.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
31
A(n)__________-controlled loop causes a statement or set of statements to repeat as long as the condition is true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
32
What will be displayed after the following code is executed?
<strong>What will be displayed after the following code is executed?  </strong> A) 30 B) 25 C) 0 5 10 15 20 D) 5 10 15

A) 30
B) 25
C) 0 5 10 15 20
D) 5 10 15
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
33
A(n)___________ structure causes a set of statements to execute repeatedly.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
34
What does the following program do?
<strong>What does the following program do?  </strong> A) It accepts 4 test scores for 3 students and outputs the average of the 12 scores. B) It accepts 3 test scores for each of 3 students and outputs the average for each student. C) It accepts 4 test scores for 2 students, then averages and outputs all the scores. D) It accepts one test score for each of 3 students and outputs the average of the 3 scores.

A) It accepts 4 test scores for 3 students and outputs the average of the 12 scores.
B) It accepts 3 test scores for each of 3 students and outputs the average for each student.
C) It accepts 4 test scores for 2 students, then averages and outputs all the scores.
D) It accepts one test score for each of 3 students and outputs the average of the 3 scores.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
35
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.

A) target variable
B) loop variable
C) for variable
D) count variable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
36
The acronym __________ refers to the fact that the computer cannot tell the difference between good data and bad data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
37
A(n)___________ loop usually occurs when the programmer does not include code inside the loop that makes the test condition false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
38
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?

A) total + number = total
B) number += number
C) total += number
D) total = number
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
39
What will be displayed after the following code is executed?
What will be displayed after the following code is executed?
What will be displayed after the following code is executed?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
40
The ___________ function is a built-in function that generates a list of integer values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
41
The following for loop iterates ___________ times to draw a square.
for x in range(4):
turtle.forward(200)
turtle.right(90)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 41 في هذه المجموعة.