Deck 10: Arrays

ملء الشاشة (f)
exit full mode
سؤال
Like other variables, an array must be declared with a data type, but the number of elements it contains is not declared.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Declaring an array, like declaring a variable, does not necessarily give it a value.
سؤال
An array that has been loaded with data values is said to be "populated."
سؤال
Array subscripts are numbered with negative integers (whole numbers) starting with 0.
سؤال
You can define a numeric array named custNumber with 10 elements like this:
Declare Numeric custNumber = 10
سؤال
A For loop is an excellent tool for traversing an array.
سؤال
Because the first element has a subscript of 1, the subscripts for an array of 10 elements range from 0 to 10.
سؤال
In JavaScript, an array can be declared and instantiated in one statement.
سؤال
A limitation of the For loop is that it is designed for counter-controlled loops, in which only one condition is used to determine when to quit.
سؤال
The For loop's syntax makes it easy to use multiple conditions.
سؤال
When an array has already been sorted and you are looking for only a single match, search algorithms other than a sequential search are more efficient, even with a Boolean flag for an early exit.
سؤال
An easy way to create a sorted array is to increment the value of each element as you increment the subscript.
سؤال
A binary search will work whether or not values in the array have been sorted first.
سؤال
An array has a single name and data type.
سؤال
In arrays where values are expected to occur only once (such as ID numbers), a search normally ends when a single match is found.
سؤال
In arrays that might have multiple occurrences of values, such as an array of last names in a parallel array, a search normally lists all matches, along with values from other parallel arrays.
سؤال
An array can be thought of as a list of variables, each numbered with its subscript.
سؤال
A two-dimensional array has three subscripts.
سؤال
   -The above table represents a one-dimensional array.<div style=padding-top: 35px>

-The above table represents a one-dimensional array.
سؤال
A For loop works well to traverse a one-dimensional array
سؤال
Languages in which arrays are objects, including JavaScript, implement a two-dimensional array as an array of arrays, so separate brackets must be used for the subscripts.
سؤال
In JavaScript, two-dimensional arrays are implemented by making each array element contain an array object of its own.
سؤال
A one-dimensional array in JavaScript is an array of arrays.
سؤال
To assign values to a 2-D array in JavaScript, create a one-dimensional array as usual, and then add a for loop that sets each array element to an array of its own.
سؤال
If a two-dimensional array is organized in rows and columns, its values can be displayed row by row for easy readability.
سؤال
The solution for keeping multiple occurrences of similar variables is a(n) ____.

A) subscript
B) truth table
C) array
D) decision table
سؤال
An array is a collection of variables called ____, each with the same name and data type.

A) elements
B) subscripts
C) variables
D) sentinels
سؤال
A(n) ____ is a nonnegative integer used to identify an element in an array.

A) sentinel
B) subscript
C) iteration
D) counter
سؤال
What is the size of the following array?
Declare Numeric custNumber[10]
//Load custNumber array
CustNumber[0] = 10001
CustNumber[1] = 10643
CustNumber[2] = 10922
CustNumber[3] = 11532
CustNumber[4] = 11765

A) 2
B) 5
C) 10
D) 15
سؤال
Based on the information below, what is the value in the fourth position of the array?
Declare Numeric custNumber[10]

//Load custNumber array
CustNumber[0] = 10001
CustNumber[1] = 10643
CustNumber[2] = 10922
CustNumber[3] = 11532
CustNumber[4] = 11765

A) 10001
B) 10643
C) 10922
D) 11532
سؤال
Based on the information below, what is the value of the first element?
Declare Numeric custNumber[10]
//Load custNumber array

CustNumber[0] = 10001
CustNumber[1] = 10643
CustNumber[2] = 10922
CustNumber[3] = 11532
CustNumber[4] = 11765

A) 10001
B) 10643
C) 10922
D) 11532
سؤال
Based on the information below, which of the following sets the tenth element of the array to 20643?
Declare Numeric custNumber[10]

A) custNumber[10] = 20643
B) custNumber[9] = 20643
C) custNumber[8] = 20643
D) custNumber[7] = 20643
سؤال
Which of the following is considered an interactive array?

A) Declare Numeric numbersEntered[numEntries]
B) For index = 0 to SIZE - 1
CustNumber[index] = 0
End For

C) Declare String vegetables[] = "asparagus", "beans", "carrots"

D) Declare index
For index = 0 to SIZE - 1
Display "Enter the customer ID for subscript " + index
Input custNumber[index]
End For
سؤال
JavaScript arrays are objects created (instantiated) with the keyword ____.

A) var
B) new
C) start
D) Display
سؤال
Which of the following creates an array of five book titles?

A) var bookTitles = new Array(5);
B) var bookTitles = Array(5);
C) var bookTitles = new Array(0 to 5);
D) var SIZE = 5; var bookTitles;
BookTitles = new Array(SIZE-1);
سؤال
Which of the following creates an array with the elements 5, 19, 25, and 4?

A) myArray = new Array(5, 19, 25, 4);
B) var myArray = new Array(5, 19, 25, 4);
C) myArray = Array(5, 19, 25, 4);
D) var myArray = Array(5, 19, 25, 4);
سؤال
A shorthand notation for decrementing a variable is ____.

A) variable++
B) variable=+
C) variable--
D) variable+-
سؤال
A shorthand notation for incrementing a variable is ____.

A) variable++
B) variable=+
C) variable--
D) variable+-
سؤال
____ is the process of examining the elements of an array in order, looking for a match for a specific value.

A) Bubble sort
B) Sequential search
C) Heap sort
D) Shell sort
سؤال
The following algorithm depicts a ____ search.
// Prompt for customer number, search array for matches
Declare Numeric searchValue
Declare Numeric index = 0
Display "Enter the customer number you're looking for: "
Input searchValue

For index = 0 to SIZE - 1
If custNumber[index] == searchValue Then
Display "Match found at subscript: " + index
End If
End For

A) binary search
B) sequential search
C) parallel search
D) multidimensional search
سؤال
A search algorithm that's more efficient on large arrays-meaning it requires far fewer comparisons-is a ____.

A) sequential search
B) selection search
C) binary search
D) repetition search
سؤال
A ____ checks whether the search value is lower or higher than an element in the array, adjusting the limits of the array's searchable area with each comparison.

A) sequential search
B) selection search
C) binary search
D) repetition search
سؤال
____ use a common subscript to relate data fields.

A) Two-dimensional arrays
B) Parallel arrays
C) Multidimensional arrays
D) Single arrays
سؤال
____ arrays have a single name and data type, but they use two or more subscripts to identify a particular element.

A) Multidimensional
B) Single
C) Parallel
D) Sequential
سؤال
Which of the following statements is correct?

A) Case structures are ideal for traversing two-dimensional arrays.
B) Nested For loops are ideal for traversing two-dimensional arrays.
C) Do while loops are ideal for traversing two-dimensional arrays.
D) Nested For loops are ideal for traversing one-dimensional arrays.
سؤال
JavaScript uses which of the following notations for the first element of a two-dimensional array: ____.

A) [0][1]
B) [1][0]
C) [0][0]
D) [1][1]
سؤال
Based on the information below, how would you access the first index of the array?
Var x = [0, 1, 2, 3, 4, 5];
Var y = [x];

A) document.write(y[0]);
B) document.write(y[0][0]);
C) document.write(y[3]);
D) document.write(y[0][1]);
سؤال
Based on the information below, what is the value of the third index array x?
Var x = [0, 1, 2, 3, 4, 5];
Var y = [x];

A) 0
B) 1
C) 2
D) 3
سؤال
Which of the following is a three-dimensional array?

A) var SIZE = 5000000;
Var numberArray = new Array(SIZE);

B) Declare Constant SIZE = 1000
Declare Numeric empNumber[SIZE]
Declare String empLastName[SIZE], empFirstName[SIZE]
Declare Numeric index
Declare String moreInput = "Y"
For index = 0 to SIZE - 1
EmpNumber[index] = 0
EmpLastName[index] = ""
EmpFirstName[index] = ""
End For

C) var ROWS = 4;
Var COLUMNS = 6;
Var scores = new Array(ROWS);
For (index = 0; index < ROWS; index++) {
Scores[index] = new Array(COLUMNS);
}

D) var cube = new Array();
Cube[0] = new Array();
Cube[0][0] = new Array();
سؤال
Which of the following will cause a syntax error?

A) for (index = 0; index < 6000000;) {
X = 123.456789 / 987.654321;
}

B) numberArray = new Array(SIZE);

C) for (index = 0; index < SIZE; index++) {
NumberArray[index] = index + 1;
}

D) for (index = 0; index < SIZE; index++) {
BookTitles[index] = prompt
("Enter title for book #" + (index + 1) + ":",ES);
}
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 10: Arrays
1
Like other variables, an array must be declared with a data type, but the number of elements it contains is not declared.
False
2
Declaring an array, like declaring a variable, does not necessarily give it a value.
True
3
An array that has been loaded with data values is said to be "populated."
True
4
Array subscripts are numbered with negative integers (whole numbers) starting with 0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
You can define a numeric array named custNumber with 10 elements like this:
Declare Numeric custNumber = 10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
A For loop is an excellent tool for traversing an array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
Because the first element has a subscript of 1, the subscripts for an array of 10 elements range from 0 to 10.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
In JavaScript, an array can be declared and instantiated in one statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
A limitation of the For loop is that it is designed for counter-controlled loops, in which only one condition is used to determine when to quit.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
The For loop's syntax makes it easy to use multiple conditions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
When an array has already been sorted and you are looking for only a single match, search algorithms other than a sequential search are more efficient, even with a Boolean flag for an early exit.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
An easy way to create a sorted array is to increment the value of each element as you increment the subscript.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
A binary search will work whether or not values in the array have been sorted first.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
An array has a single name and data type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
In arrays where values are expected to occur only once (such as ID numbers), a search normally ends when a single match is found.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
In arrays that might have multiple occurrences of values, such as an array of last names in a parallel array, a search normally lists all matches, along with values from other parallel arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
An array can be thought of as a list of variables, each numbered with its subscript.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
A two-dimensional array has three subscripts.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
   -The above table represents a one-dimensional array.

-The above table represents a one-dimensional array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
A For loop works well to traverse a one-dimensional array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
Languages in which arrays are objects, including JavaScript, implement a two-dimensional array as an array of arrays, so separate brackets must be used for the subscripts.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
In JavaScript, two-dimensional arrays are implemented by making each array element contain an array object of its own.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
A one-dimensional array in JavaScript is an array of arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
To assign values to a 2-D array in JavaScript, create a one-dimensional array as usual, and then add a for loop that sets each array element to an array of its own.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
If a two-dimensional array is organized in rows and columns, its values can be displayed row by row for easy readability.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
The solution for keeping multiple occurrences of similar variables is a(n) ____.

A) subscript
B) truth table
C) array
D) decision table
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
An array is a collection of variables called ____, each with the same name and data type.

A) elements
B) subscripts
C) variables
D) sentinels
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
A(n) ____ is a nonnegative integer used to identify an element in an array.

A) sentinel
B) subscript
C) iteration
D) counter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
What is the size of the following array?
Declare Numeric custNumber[10]
//Load custNumber array
CustNumber[0] = 10001
CustNumber[1] = 10643
CustNumber[2] = 10922
CustNumber[3] = 11532
CustNumber[4] = 11765

A) 2
B) 5
C) 10
D) 15
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
Based on the information below, what is the value in the fourth position of the array?
Declare Numeric custNumber[10]

//Load custNumber array
CustNumber[0] = 10001
CustNumber[1] = 10643
CustNumber[2] = 10922
CustNumber[3] = 11532
CustNumber[4] = 11765

A) 10001
B) 10643
C) 10922
D) 11532
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Based on the information below, what is the value of the first element?
Declare Numeric custNumber[10]
//Load custNumber array

CustNumber[0] = 10001
CustNumber[1] = 10643
CustNumber[2] = 10922
CustNumber[3] = 11532
CustNumber[4] = 11765

A) 10001
B) 10643
C) 10922
D) 11532
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
Based on the information below, which of the following sets the tenth element of the array to 20643?
Declare Numeric custNumber[10]

A) custNumber[10] = 20643
B) custNumber[9] = 20643
C) custNumber[8] = 20643
D) custNumber[7] = 20643
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which of the following is considered an interactive array?

A) Declare Numeric numbersEntered[numEntries]
B) For index = 0 to SIZE - 1
CustNumber[index] = 0
End For

C) Declare String vegetables[] = "asparagus", "beans", "carrots"

D) Declare index
For index = 0 to SIZE - 1
Display "Enter the customer ID for subscript " + index
Input custNumber[index]
End For
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
JavaScript arrays are objects created (instantiated) with the keyword ____.

A) var
B) new
C) start
D) Display
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which of the following creates an array of five book titles?

A) var bookTitles = new Array(5);
B) var bookTitles = Array(5);
C) var bookTitles = new Array(0 to 5);
D) var SIZE = 5; var bookTitles;
BookTitles = new Array(SIZE-1);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following creates an array with the elements 5, 19, 25, and 4?

A) myArray = new Array(5, 19, 25, 4);
B) var myArray = new Array(5, 19, 25, 4);
C) myArray = Array(5, 19, 25, 4);
D) var myArray = Array(5, 19, 25, 4);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
A shorthand notation for decrementing a variable is ____.

A) variable++
B) variable=+
C) variable--
D) variable+-
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
A shorthand notation for incrementing a variable is ____.

A) variable++
B) variable=+
C) variable--
D) variable+-
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
____ is the process of examining the elements of an array in order, looking for a match for a specific value.

A) Bubble sort
B) Sequential search
C) Heap sort
D) Shell sort
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
The following algorithm depicts a ____ search.
// Prompt for customer number, search array for matches
Declare Numeric searchValue
Declare Numeric index = 0
Display "Enter the customer number you're looking for: "
Input searchValue

For index = 0 to SIZE - 1
If custNumber[index] == searchValue Then
Display "Match found at subscript: " + index
End If
End For

A) binary search
B) sequential search
C) parallel search
D) multidimensional search
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
A search algorithm that's more efficient on large arrays-meaning it requires far fewer comparisons-is a ____.

A) sequential search
B) selection search
C) binary search
D) repetition search
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
A ____ checks whether the search value is lower or higher than an element in the array, adjusting the limits of the array's searchable area with each comparison.

A) sequential search
B) selection search
C) binary search
D) repetition search
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
____ use a common subscript to relate data fields.

A) Two-dimensional arrays
B) Parallel arrays
C) Multidimensional arrays
D) Single arrays
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
____ arrays have a single name and data type, but they use two or more subscripts to identify a particular element.

A) Multidimensional
B) Single
C) Parallel
D) Sequential
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
Which of the following statements is correct?

A) Case structures are ideal for traversing two-dimensional arrays.
B) Nested For loops are ideal for traversing two-dimensional arrays.
C) Do while loops are ideal for traversing two-dimensional arrays.
D) Nested For loops are ideal for traversing one-dimensional arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
JavaScript uses which of the following notations for the first element of a two-dimensional array: ____.

A) [0][1]
B) [1][0]
C) [0][0]
D) [1][1]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
Based on the information below, how would you access the first index of the array?
Var x = [0, 1, 2, 3, 4, 5];
Var y = [x];

A) document.write(y[0]);
B) document.write(y[0][0]);
C) document.write(y[3]);
D) document.write(y[0][1]);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
Based on the information below, what is the value of the third index array x?
Var x = [0, 1, 2, 3, 4, 5];
Var y = [x];

A) 0
B) 1
C) 2
D) 3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
Which of the following is a three-dimensional array?

A) var SIZE = 5000000;
Var numberArray = new Array(SIZE);

B) Declare Constant SIZE = 1000
Declare Numeric empNumber[SIZE]
Declare String empLastName[SIZE], empFirstName[SIZE]
Declare Numeric index
Declare String moreInput = "Y"
For index = 0 to SIZE - 1
EmpNumber[index] = 0
EmpLastName[index] = ""
EmpFirstName[index] = ""
End For

C) var ROWS = 4;
Var COLUMNS = 6;
Var scores = new Array(ROWS);
For (index = 0; index < ROWS; index++) {
Scores[index] = new Array(COLUMNS);
}

D) var cube = new Array();
Cube[0] = new Array();
Cube[0][0] = new Array();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
Which of the following will cause a syntax error?

A) for (index = 0; index < 6000000;) {
X = 123.456789 / 987.654321;
}

B) numberArray = new Array(SIZE);

C) for (index = 0; index < SIZE; index++) {
NumberArray[index] = index + 1;
}

D) for (index = 0; index < SIZE; index++) {
BookTitles[index] = prompt
("Enter title for book #" + (index + 1) + ":",ES);
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.