Deck 5: Repetition Structures

ملء الشاشة (f)
exit full mode
سؤال
What type of loop structure repeats the code based on the value of the Boolean expression?

A) Condition-controlled loop
B) Number-controlled loop
C) Count-controlled loop
D) Boolean-controlled loop
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The first line in the while loop is referred to as the condition clause.
سؤال
In Python, an infinite loop usually occurs when the computer accesses the wrong memory address.
سؤال
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
سؤال
In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called a _____.

A) sequence
B) variable
C) value
D) list
سؤال
_____ is the process of inspecting data that has been input to a program to make sure it is valid before it is used in a computation.

A) Input validation
B) Correcting data
C) Data validation
D) Correcting input
سؤال
The variable used to keep the running total is called a(n) _____.

A) Accumulator
B) Total
C) running total
D) grand total
سؤال
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 represents an example to calculate the sum of the numbers (accumulator)?

A) total + number = total
B) number += number
C) total += number
D) total = number
سؤال
What is the format for the while clause in Python?

A) while condition
B) while condition :
C) while condition statement
D) while condition : statement
سؤال
In flowcharting, the decision structure and the repetition structure both use the diamond symbol to represent the condition that is tested.
سؤال
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 is the disadvantage of coding in one long sequence structure?

A) Duplicated code makes the program faster to write.
B) Writing a long sequence of statements is error prone.
C) If parts of the duplicated code have to be corrected, the correction has to be made many times.
D) It does not make use of decision structures.
سؤال
What is the structure that causes a statement or a set of statements to execute repeatedly?

A) Sequence
B) Decision
C) Module
D) Repetition
سؤال
The first input 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
سؤال
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
سؤال
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 is not an example of an augmented assignment operator?

A) *=
B) /=
C) -=
D) <=
سؤال
A better 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 the statements as many times as necessary.
سؤال
Reducing duplication of code is one of the advantages of using a loop structure.
سؤال
The _______________ function is a built-in function that generates a list of integer values.
سؤال
A(n) _______________ validation loop is sometimes called an error trap or an error handler.
سؤال
In a nested loop, the inner loop goes through all of its iterations for every single iteration of an outer loop.
سؤال
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(n) _______________ total is a sum of numbers that accumulates with each iteration of a loop.
سؤال
To get the total number of iterations of a nested loop, multiply the number of iterations of all the loops.
سؤال
A(n) _______________ is a special value that marks the end of a sequence of items.
سؤال
In Python, you would use the _______________ statement to write a count-controlled loop.
سؤال
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 forgets to write code inside the loop that makes the test condition false.
سؤال
functions can be called from statements in the body of a loop, and loops can be called from the body of a function.
سؤال
The while loop is known as a(n) _______________ loop because it tests conditions before performing an iteration.
سؤال
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 correct data.
سؤال
A(n) _______________ structure causes a statement or set of statements to execute repeatedly.
سؤال
A(n) _______________-controlled loop causes a statement or set of statements to repeat as long as a condition ist.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/35
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 5: Repetition Structures
1
What type of loop structure repeats the code based on the value of the Boolean expression?

A) Condition-controlled loop
B) Number-controlled loop
C) Count-controlled loop
D) Boolean-controlled loop
A
2
The first line in the while loop is referred to as the condition clause.
False
3
In Python, an infinite loop usually occurs when the computer accesses the wrong memory address.
False
4
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
5
In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called a _____.

A) sequence
B) variable
C) value
D) list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
6
_____ is the process of inspecting data that has been input to a program to make sure it is valid before it is used in a computation.

A) Input validation
B) Correcting data
C) Data validation
D) Correcting input
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
7
The variable used to keep the running total is called a(n) _____.

A) Accumulator
B) Total
C) running total
D) grand total
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
8
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following represents an example to calculate the sum of the numbers (accumulator)?

A) total + number = total
B) number += number
C) total += number
D) total = number
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
10
What is the format for the while clause in Python?

A) while condition
B) while condition :
C) while condition statement
D) while condition : statement
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
11
In flowcharting, the decision structure and the repetition structure both use the diamond symbol to represent the condition that is tested.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
12
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
13
What is the disadvantage of coding in one long sequence structure?

A) Duplicated code makes the program faster to write.
B) Writing a long sequence of statements is error prone.
C) If parts of the duplicated code have to be corrected, the correction has to be made many times.
D) It does not make use of decision structures.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
14
What is the structure that causes a statement or a set of statements to execute repeatedly?

A) Sequence
B) Decision
C) Module
D) Repetition
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
15
The first input 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
16
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
17
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
18
What is not an example of an augmented assignment operator?

A) *=
B) /=
C) -=
D) <=
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
19
A better 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 the statements as many times as necessary.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
20
Reducing duplication of code is one of the advantages of using a loop structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
21
The _______________ function is a built-in function that generates a list of integer values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
22
A(n) _______________ validation loop is sometimes called an error trap or an error handler.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
23
In a nested loop, the inner loop goes through all of its iterations for every single iteration of an outer loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
24
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):
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
25
A(n) _______________ total is a sum of numbers that accumulates with each iteration of a loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
26
To get the total number of iterations of a nested loop, multiply the number of iterations of all the loops.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
27
A(n) _______________ is a special value that marks the end of a sequence of items.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
28
In Python, you would use the _______________ statement to write a count-controlled loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
29
The acronym _______________ refers to the fact that the computer cannot tell the difference between good data and bad data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
30
A(n) _______________ loop usually occurs when the programmer forgets to write code inside the loop that makes the test condition false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
31
functions can be called from statements in the body of a loop, and loops can be called from the body of a function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
32
The while loop is known as a(n) _______________ loop because it tests conditions before performing an iteration.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
33
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 correct data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
34
A(n) _______________ structure causes a statement or set of statements to execute repeatedly.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
35
A(n) _______________-controlled loop causes a statement or set of statements to repeat as long as a condition ist.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.