Deck 5: Arrays

ملء الشاشة (f)
exit full mode
سؤال
As with a while loop,when you use a for loop,you must be careful to stay within array bounds.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
In most modern programming languages,the highest subscript you should use with an 8-element array is ____ .

A) 6
B) 7
C) 8
D) 9
سؤال
A(n)____ is a contiguous series of variables in computer memory.

A) collection
B) matrix
C) vector
D) array
سؤال
Any array's subscripts are always a ____ of integers.

A) group
B) sequence
C) list
D) range
سؤال
Each individual element in an array has a unique ____ indicating how far away it is from the first element.

A) indicator
B) element
C) subscript
D) script
سؤال
The smaller the array,the more beneficial it becomes to exit the searching loop as soon as you find what you're looking for.
سؤال
The number of elements an array will hold is known as the ____ of the array.

A) bounds
B) limits
C) constraints
D) size
سؤال
The values stored in arrays should never be constants.
سؤال
All array elements have the same ____ name.

A) group
B) target
C) structure
D) collection
سؤال
All the variables in an array are differentiated with special numbers called ____.

A) scripts
B) subscripts
C) elements
D) pointers
سؤال
When you create parallel arrays,each array must be of the same data type.
سؤال
Each separate array variable is one ____ of the array.

A) element
B) aspect
C) index
D) member
سؤال
Subscripts begin with a value of ____.

A) -1
B) 0
C) 1
D) the number of elements in the array
سؤال
A(n)____,also called an index,is a number that indicates the position of a particular item within an array.

A) indicator
B) element
C) subscript
D) script
سؤال
Subscript values can be negative integers in all languages.
سؤال
If you assume an array's first subscript is 0,you will always be "off by one" in your array manipulation.
سؤال
You cannot initialize array elements when you declare the array.
سؤال
Each array element occupies an area in memory next to the others.
سؤال
In many languages,when you declare an array,a constant that represents the array size is automatically created for you.
سؤال
All the variables in an array have the same name and data type.
سؤال
An element in an array is 3 bytes long and there are 10 elements in the array.How big is the array?

A) 30 bytes
B) 10 bytes
C) 3 bytes
D) Not enough information to determine
سؤال
When declaring an array,depending on the syntax rules of the programming language you use,you place the subscript within parentheses or ____ following the group name.

A) asterisks
B) slashes
C) curly brackets
D) square brackets
سؤال
A ____ search starts looking in the middle of a sorted list,and then determines whether it should continue higher or lower.

A) linear
B) quick
C) graphic
D) binary
سؤال
When you search through a list from one end to the other,you are performing a ____ search.

A) linear
B) binary
C) quick
D) Google
سؤال
In Java,C++,and C#,the for loop looks like the following:

A) for(dep = 0; dep++; dep < SIZE)
B) for(dep > SIZE; dep = 0; dep++)
C) for(dep = 0; dep < SIZE; dep++)
D) for(dep = SIZE,dep > 0,dep++)
سؤال
Learning to use arrays correctly can make many programming tasks far more ____ and professional.

A) confusing
B) efficient
C) slick
D) literal
سؤال
The ____ is a particularly convenient tool when working with arrays because you frequently need to process every element of an array from beginning to end.

A) binary search
B) range check
C) for loop
D) parallel array
سؤال
Leaving a loop as soon as a match is found improves the program's ____.

A) indirect relationships
B) logic
C) simplicity
D) efficiency
سؤال
Frequently,a flag holds a ____ value.

A) subscript
B) true or false
C) string
D) junk
سؤال
The relationship between an item's number and its price is a(n)____ relationship.

A) direct
B) indirect
C) hidden
D) clear
سؤال
Besides making your code easier to modify,using a ____ makes the code easier to understand.

A) constant
B) named constant
C) named declaration
D) named variable
سؤال
When you use parallel arrays,a ____ relates the arrays.

A) link
B) flag
C) subscript
D) script
سؤال
When you use parallel arrays,two or more arrays contain ____ data.

A) connected
B) equivalent
C) identical
D) related
سؤال
A ____ is a variable that you set to indicate whether some event has occurred.

A) handler
B) rudder
C) flag
D) bug
سؤال
Most programming languages use a statement similar to the following to declare a three-element array and assign values to it: ____

A) {20,30,40} = num someVals[3]
B) num someVals[3] = {someVals}
C) num someVals[] = 20,30,40
D) num someVals[3] = 20,30,40
سؤال
When working with arrays,you can use ____ in two ways: to hold an array's size and as the array values.

A) structures
B) literals
C) constants
D) strings
سؤال
The true benefit of an array lies in your ability to use a(n)____ as a subscript to the array.

A) variable
B) table
C) operator
D) field
سؤال
In ____ arrays,each element in one array is associated with the element in the same relative position in the other array.

A) parallel
B) related
C) grouped
D) combined
سؤال
When you have a six element array and use subscript 6,your subscript is said to be out of ____.

A) bounds
B) scope
C) range
D) array
سؤال
What is TRUE about the following array? num someVals[5] = 1,3,5,7,9

A) someVals[1] has the value of 1
B) someVals[1] has the value of 3
C) There are 6 elements in this array.
D) someVals[3] has the value of 3
سؤال
The following pseudocode is not working correctly.The code should total the array elements.What code needs to be changed? start
Declarations
Num count = 0
Num total = 0
Num scores[6] = 2,4,6,8,10,12
While count < 6
Total = total + scores
Count = count + 1
Endwhile
Stop

A) Change the while to:
While count < 7
B) move count = count + 1 after the endwhile
C) Change the total = to:
Total = scores + scores[count]
D) Change the total = to:
Total = total + scores[count]
سؤال
The following pseudocode is not working correctly.How should the for loop be changed? start
Declarations
Num count = 0
Num scores[6] = 0,0,0,0,0,0
Num SIZE = 6
For count 0 to SIZE step
Input entry
Scores[count] = entry
Endfor
Stop

A) for count 0 to SIZE + 1 step 1
B) for count 0 to SIZE - 1 step 1
C) for count 0 to SIZE - 1 step
D) for count 0 to SIZE - 1 step -1
سؤال
You are working with parallel arrays to detemine the grade a student earns in a class.The student earns a grade based on the following: minimum points to earn an A is 900
Minimum points to earn a B is 800
Minimum points to earn a C is 700
Minimum points to earn a D is 600
Below 600 earns an F
The points array is defined as follows: num points[5] = 900,800,700,600,0
How should the grades array be defined?

A) num grades[5] = A,B,C,D,F
B) string grades[5] = "A","B","C","D","F"
C) num grades[5] = "A","B","C","D","F"
D) string grades[5] = "F","D","C","B","A"
سؤال
Write the pseudocode to define a five element array called "scores," and then allow a user to enter 5 scores and store them in the array using a while loop.
سؤال
Write the pseudocode to define and initialize a five element array called "evens," with even numbers from 2 to 10,and then find the total of the values in the array using a for loop.
سؤال
The following pseudocode checks if an item number is valid: start
Declarations
Num sub = 0
Num SIZE = 5
Num VALID_ITEM [5] = 27,53,84,89,95
String foundIt = "N"
Input item
While sub < SIZE
If item = VALID_ITEM[sub] then
FoundIt = "Y"
Endif
Sub = sub +1
Endwhile
If foundIt = "Y" then
Output "Valid item number"
Else
Output "Invalid item number"
Endif
Stop
Which while loop makes this more efficient?

A) while sub < SIZE AND foundIt = "N"
B) while sub < SIZE AND foundIt > "N"
C) while sub < SIZE AND foundIt = "Y"
D) The while loop is already efficient
سؤال
Define and initialize an array that contains the names of the days of the week.
سؤال
Write the pseudocode to define and initialize a four element array called "evens," with even numbers from 2 to 8,and then find the total of the values in the array using a while loop.
سؤال
Write the pseudocode to define a six element array called "scores," and then allow a user to enter 6 scores and store them in the array using a for loop.
سؤال
The following pseudocode is not working correctly.What kind of error is this? start
Declarations
Num count = 0
Num scores[6] = 0,0,0,0,0,0
Num SIZE = 6
For count 0 to SIZE step 1
Input entry
Scores[count] = entry
Endfor
Stop

A) out of memory
B) no match was found
C) out of bounds
D) bounded
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 5: Arrays
1
As with a while loop,when you use a for loop,you must be careful to stay within array bounds.
True
2
In most modern programming languages,the highest subscript you should use with an 8-element array is ____ .

A) 6
B) 7
C) 8
D) 9
B
3
A(n)____ is a contiguous series of variables in computer memory.

A) collection
B) matrix
C) vector
D) array
D
4
Any array's subscripts are always a ____ of integers.

A) group
B) sequence
C) list
D) range
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
Each individual element in an array has a unique ____ indicating how far away it is from the first element.

A) indicator
B) element
C) subscript
D) script
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
The smaller the array,the more beneficial it becomes to exit the searching loop as soon as you find what you're looking for.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
The number of elements an array will hold is known as the ____ of the array.

A) bounds
B) limits
C) constraints
D) size
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
The values stored in arrays should never be constants.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
All array elements have the same ____ name.

A) group
B) target
C) structure
D) collection
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
All the variables in an array are differentiated with special numbers called ____.

A) scripts
B) subscripts
C) elements
D) pointers
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
When you create parallel arrays,each array must be of the same data type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
Each separate array variable is one ____ of the array.

A) element
B) aspect
C) index
D) member
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
Subscripts begin with a value of ____.

A) -1
B) 0
C) 1
D) the number of elements in the array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
A(n)____,also called an index,is a number that indicates the position of a particular item within an array.

A) indicator
B) element
C) subscript
D) script
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
Subscript values can be negative integers in all languages.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
If you assume an array's first subscript is 0,you will always be "off by one" in your array manipulation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
You cannot initialize array elements when you declare the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
Each array element occupies an area in memory next to the others.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
In many languages,when you declare an array,a constant that represents the array size is automatically created for you.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
All the variables in an array have the same name and data type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
An element in an array is 3 bytes long and there are 10 elements in the array.How big is the array?

A) 30 bytes
B) 10 bytes
C) 3 bytes
D) Not enough information to determine
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
When declaring an array,depending on the syntax rules of the programming language you use,you place the subscript within parentheses or ____ following the group name.

A) asterisks
B) slashes
C) curly brackets
D) square brackets
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
A ____ search starts looking in the middle of a sorted list,and then determines whether it should continue higher or lower.

A) linear
B) quick
C) graphic
D) binary
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
When you search through a list from one end to the other,you are performing a ____ search.

A) linear
B) binary
C) quick
D) Google
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
In Java,C++,and C#,the for loop looks like the following:

A) for(dep = 0; dep++; dep < SIZE)
B) for(dep > SIZE; dep = 0; dep++)
C) for(dep = 0; dep < SIZE; dep++)
D) for(dep = SIZE,dep > 0,dep++)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
Learning to use arrays correctly can make many programming tasks far more ____ and professional.

A) confusing
B) efficient
C) slick
D) literal
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
The ____ is a particularly convenient tool when working with arrays because you frequently need to process every element of an array from beginning to end.

A) binary search
B) range check
C) for loop
D) parallel array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
Leaving a loop as soon as a match is found improves the program's ____.

A) indirect relationships
B) logic
C) simplicity
D) efficiency
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
Frequently,a flag holds a ____ value.

A) subscript
B) true or false
C) string
D) junk
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
The relationship between an item's number and its price is a(n)____ relationship.

A) direct
B) indirect
C) hidden
D) clear
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Besides making your code easier to modify,using a ____ makes the code easier to understand.

A) constant
B) named constant
C) named declaration
D) named variable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
When you use parallel arrays,a ____ relates the arrays.

A) link
B) flag
C) subscript
D) script
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
When you use parallel arrays,two or more arrays contain ____ data.

A) connected
B) equivalent
C) identical
D) related
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
A ____ is a variable that you set to indicate whether some event has occurred.

A) handler
B) rudder
C) flag
D) bug
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Most programming languages use a statement similar to the following to declare a three-element array and assign values to it: ____

A) {20,30,40} = num someVals[3]
B) num someVals[3] = {someVals}
C) num someVals[] = 20,30,40
D) num someVals[3] = 20,30,40
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
When working with arrays,you can use ____ in two ways: to hold an array's size and as the array values.

A) structures
B) literals
C) constants
D) strings
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
The true benefit of an array lies in your ability to use a(n)____ as a subscript to the array.

A) variable
B) table
C) operator
D) field
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
In ____ arrays,each element in one array is associated with the element in the same relative position in the other array.

A) parallel
B) related
C) grouped
D) combined
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
When you have a six element array and use subscript 6,your subscript is said to be out of ____.

A) bounds
B) scope
C) range
D) array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
What is TRUE about the following array? num someVals[5] = 1,3,5,7,9

A) someVals[1] has the value of 1
B) someVals[1] has the value of 3
C) There are 6 elements in this array.
D) someVals[3] has the value of 3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
The following pseudocode is not working correctly.The code should total the array elements.What code needs to be changed? start
Declarations
Num count = 0
Num total = 0
Num scores[6] = 2,4,6,8,10,12
While count < 6
Total = total + scores
Count = count + 1
Endwhile
Stop

A) Change the while to:
While count < 7
B) move count = count + 1 after the endwhile
C) Change the total = to:
Total = scores + scores[count]
D) Change the total = to:
Total = total + scores[count]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
The following pseudocode is not working correctly.How should the for loop be changed? start
Declarations
Num count = 0
Num scores[6] = 0,0,0,0,0,0
Num SIZE = 6
For count 0 to SIZE step
Input entry
Scores[count] = entry
Endfor
Stop

A) for count 0 to SIZE + 1 step 1
B) for count 0 to SIZE - 1 step 1
C) for count 0 to SIZE - 1 step
D) for count 0 to SIZE - 1 step -1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
You are working with parallel arrays to detemine the grade a student earns in a class.The student earns a grade based on the following: minimum points to earn an A is 900
Minimum points to earn a B is 800
Minimum points to earn a C is 700
Minimum points to earn a D is 600
Below 600 earns an F
The points array is defined as follows: num points[5] = 900,800,700,600,0
How should the grades array be defined?

A) num grades[5] = A,B,C,D,F
B) string grades[5] = "A","B","C","D","F"
C) num grades[5] = "A","B","C","D","F"
D) string grades[5] = "F","D","C","B","A"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Write the pseudocode to define a five element array called "scores," and then allow a user to enter 5 scores and store them in the array using a while loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
Write the pseudocode to define and initialize a five element array called "evens," with even numbers from 2 to 10,and then find the total of the values in the array using a for loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
The following pseudocode checks if an item number is valid: start
Declarations
Num sub = 0
Num SIZE = 5
Num VALID_ITEM [5] = 27,53,84,89,95
String foundIt = "N"
Input item
While sub < SIZE
If item = VALID_ITEM[sub] then
FoundIt = "Y"
Endif
Sub = sub +1
Endwhile
If foundIt = "Y" then
Output "Valid item number"
Else
Output "Invalid item number"
Endif
Stop
Which while loop makes this more efficient?

A) while sub < SIZE AND foundIt = "N"
B) while sub < SIZE AND foundIt > "N"
C) while sub < SIZE AND foundIt = "Y"
D) The while loop is already efficient
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
Define and initialize an array that contains the names of the days of the week.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
Write the pseudocode to define and initialize a four element array called "evens," with even numbers from 2 to 8,and then find the total of the values in the array using a while loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
Write the pseudocode to define a six element array called "scores," and then allow a user to enter 6 scores and store them in the array using a for loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
The following pseudocode is not working correctly.What kind of error is this? start
Declarations
Num count = 0
Num scores[6] = 0,0,0,0,0,0
Num SIZE = 6
For count 0 to SIZE step 1
Input entry
Scores[count] = entry
Endfor
Stop

A) out of memory
B) no match was found
C) out of bounds
D) bounded
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.