Deck 10: Javascript: Arrays

ملء الشاشة (f)
exit full mode
سؤال
_________ are data structures consisting of related data items (sometimes called collections of data items).

A) lvalues
B) composites
C) arrays
D) variables
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
What is the effect of the join statement in the following code
Var theArray1 = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
Var theArray2 = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
Var value = theArray1.join( " " );

A) The join method will concatenate the values of theArray2 to theArray1.
B) The join method will concatenate the values of theArray1 to theArray2.
C) The join method will create a string from the values in theArray1.
D) The join method will create a string with the values of theArray2 concatenated to the values of theArray1.
سؤال
What does the following code do
For ( var col = 0; col < a[ 2 ].length; ++col )
A[ 2 ][ col ] = 0;

A) Sets the rows and columns to zero.
B) Sets the rows to zero.
C) Sets the columns to zero.
D) Sets all the elements in row 2 to zero.
سؤال
Which of the following is an illegal array initialization statement

A) var n = [ 10, 20, 30, 40, 50 ];
B) var n = new Array( 10, 20, 30, 40, 50 );
C) var n[ 10, 20, 30, 40, 50 ];
D) var n = new Array( 5 ); for ( var i = 1; i < = 5; i++ )
N[ i ] = i * 10 ;
سؤال
What will the browser display if the following script is executed
< script type = "text/javascript" >
< !--
Var theArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ];
ModifyArray( theArray[ 3 ] );
Document.write( theArray.join( " " ) );
Function modifyArray( i )
{
I = 11;
}
//-- >
< /script >

A) Nothing, the browser will generate an error.
B) 1 2 3 4 5 6 7 8 9
C) 1 2 11 4 5 6 7 8 9
D) 1 2 3 11 5 6 7 8 9
سؤال
To refer to a particular location or element in the array, we spec ify the name of the array and the ________ of the particular element in the array.

A) contents
B) size
C) position number
D) type
سؤال
Which of the following is the proper method to access the length of the array arr

A) arr[].length
B) arr[subscript].length
C) arr.length
D) arr(length)
سؤال
In JavaScript, numbers and boolean values are passed to functions by ________.

A) value
B) parameters
C) memory
D) reference
سؤال
What is the value of num assuming that all 12 elements of array test are initialized to 3
++test[ 7 ];
Var num = test[ 7 ];

A) 3
B) 4
C) 8
D) 10
سؤال
The first statement below ________ the array while the second statement ________ the array.
Var c;
C = new Array( 12 );

A) declares, initializes
B) initializes, declares
C) declares, allocates
D) allocates, declares
سؤال
Pass-by- ________ is the method of passing the argument's address in memory to a function.

A) value
B) parameters
C) memory
D) reference
سؤال
By default, the JavaScript sort method uses ________ to sort the array passed to it.

A) string comparison
B) binary search
C) linear search
D) bubble sort
سؤال
The sort method can be given a function to use for the comparisons it makes, called a(n) ________ function.

A) isLessThan
B) compare
C) compareTo
D) comparator
سؤال
When working with data stored in arrays, it's often necessary to determine whether an array contains a value that matches a certain ________.

A) search value
B) value index
C) sub initializer
D) key value
سؤال
Pass-by- ________ is the method of passing a copy of the argument's value to a function.

A) value
B) parameters
C) memory
D) reference
سؤال
What would the browser output if the following script is executed
< script type = "text/javascript" >
< !--
Var array = [ [ 1, 2, 3 ], [ 1, 2, 3 ] ];
For ( var i in array )
{
For ( var j in array[ i ] )
Document.write( array[ i ][ j ] + " " );
Document.writeln("< br / >");
}
//-- >
< /script >

A) Nothing, the script would generate an error
B) 1 2 3
C) 1 2 3 4 5 6
D) 1 2 3 1 2 3
سؤال
Which of the following is the proper method to dynamically allocate memory to an array of 100 elements

A) var c = new c[ 100 ];
B) var c = new c( 100 );
C) var c = new Array[ 100 ];
D) var c = new Array( 100 );
سؤال
In JavaScript, all objects and arrays are passed to functions by ________.

A) value
B) parameters
C) memory
D) reference
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/18
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 10: Javascript: Arrays
1
_________ are data structures consisting of related data items (sometimes called collections of data items).

A) lvalues
B) composites
C) arrays
D) variables
C
2
What is the effect of the join statement in the following code
Var theArray1 = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
Var theArray2 = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
Var value = theArray1.join( " " );

A) The join method will concatenate the values of theArray2 to theArray1.
B) The join method will concatenate the values of theArray1 to theArray2.
C) The join method will create a string from the values in theArray1.
D) The join method will create a string with the values of theArray2 concatenated to the values of theArray1.
C
3
What does the following code do
For ( var col = 0; col < a[ 2 ].length; ++col )
A[ 2 ][ col ] = 0;

A) Sets the rows and columns to zero.
B) Sets the rows to zero.
C) Sets the columns to zero.
D) Sets all the elements in row 2 to zero.
D
4
Which of the following is an illegal array initialization statement

A) var n = [ 10, 20, 30, 40, 50 ];
B) var n = new Array( 10, 20, 30, 40, 50 );
C) var n[ 10, 20, 30, 40, 50 ];
D) var n = new Array( 5 ); for ( var i = 1; i < = 5; i++ )
N[ i ] = i * 10 ;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
5
What will the browser display if the following script is executed
< script type = "text/javascript" >
< !--
Var theArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ];
ModifyArray( theArray[ 3 ] );
Document.write( theArray.join( " " ) );
Function modifyArray( i )
{
I = 11;
}
//-- >
< /script >

A) Nothing, the browser will generate an error.
B) 1 2 3 4 5 6 7 8 9
C) 1 2 11 4 5 6 7 8 9
D) 1 2 3 11 5 6 7 8 9
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
6
To refer to a particular location or element in the array, we spec ify the name of the array and the ________ of the particular element in the array.

A) contents
B) size
C) position number
D) type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which of the following is the proper method to access the length of the array arr

A) arr[].length
B) arr[subscript].length
C) arr.length
D) arr(length)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
8
In JavaScript, numbers and boolean values are passed to functions by ________.

A) value
B) parameters
C) memory
D) reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
9
What is the value of num assuming that all 12 elements of array test are initialized to 3
++test[ 7 ];
Var num = test[ 7 ];

A) 3
B) 4
C) 8
D) 10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
10
The first statement below ________ the array while the second statement ________ the array.
Var c;
C = new Array( 12 );

A) declares, initializes
B) initializes, declares
C) declares, allocates
D) allocates, declares
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
11
Pass-by- ________ is the method of passing the argument's address in memory to a function.

A) value
B) parameters
C) memory
D) reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
12
By default, the JavaScript sort method uses ________ to sort the array passed to it.

A) string comparison
B) binary search
C) linear search
D) bubble sort
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
13
The sort method can be given a function to use for the comparisons it makes, called a(n) ________ function.

A) isLessThan
B) compare
C) compareTo
D) comparator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
14
When working with data stored in arrays, it's often necessary to determine whether an array contains a value that matches a certain ________.

A) search value
B) value index
C) sub initializer
D) key value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
15
Pass-by- ________ is the method of passing a copy of the argument's value to a function.

A) value
B) parameters
C) memory
D) reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
16
What would the browser output if the following script is executed
< script type = "text/javascript" >
< !--
Var array = [ [ 1, 2, 3 ], [ 1, 2, 3 ] ];
For ( var i in array )
{
For ( var j in array[ i ] )
Document.write( array[ i ][ j ] + " " );
Document.writeln("< br / >");
}
//-- >
< /script >

A) Nothing, the script would generate an error
B) 1 2 3
C) 1 2 3 4 5 6
D) 1 2 3 1 2 3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
17
Which of the following is the proper method to dynamically allocate memory to an array of 100 elements

A) var c = new c[ 100 ];
B) var c = new c( 100 );
C) var c = new Array[ 100 ];
D) var c = new Array( 100 );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
18
In JavaScript, all objects and arrays are passed to functions by ________.

A) value
B) parameters
C) memory
D) reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 18 في هذه المجموعة.