Deck 6: Arrays

ملء الشاشة (f)
exit full mode
سؤال
Java provides a looping mechanism for objects of a collection.This looping mechanism is called a __________ loop.

A)While
B)For
C)For each
D)All of the above
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The correct syntax for accessing the length of an array named Numbers is:

A)Numbers.length)
B)Numbers.length
C)both A and B
D)none of the above
سؤال
An arrays length instance variables value can be changed by a program.
سؤال
Which of the following initializer lists correctly initializes the indexed variables of an array named myDoubles?

A)double myDoubles[double] = {0.0,1.0,1.5,2.0,2.5};
B)double myDoubles[5] = new double0.0,1.0,1.5,2.0,2.5);
C)double[] myDoubles = {0.0,1.0,1.5,2.0,2.5};
D)array myDoubles[double] = {0.0,1.0,1.5,2.0,2.5};
سؤال
An ArrayIndexOutOfBounds error is a:

A)compiler error
B)syntax error
C)logic error
D)all of the above
سؤال
A value of an enumerated type is similar to a/an:

A)Instance variable
B)Object of a class
C)Named constant
D)None of the above
سؤال
This type of loop provides a convenient mechanism to iterate through every element of an array.

A)for each
B)for
C)do while
D)while
سؤال
What is the correct expression for accessing the 5< sup >th< /sup > element in an array named colors?

A)colors[3]
B)colors[4]
C)colors[5]
D)colors[6]
سؤال
The name of the sorting algorithm that locates the smallest unsorted value in an array and places it in the next sorted position of the array is called:

A)bubble sort
B)merge sort
C)radix sort
D)selection sort
سؤال
Consider the following array: <strong>Consider the following array:   What is the value of myArray[myArray[1] - myArray[0]]</strong> A)7 B)9 C)-3 D)6 <div style=padding-top: 35px> What is the value of myArray[myArray[1] - myArray[0]]

A)7
B)9
C)-3
D)6
سؤال
The base type of an array may be all of the following but:

A)string
B)boolean
C)long
D)all of these may be a base type of an array.
سؤال
The individual variables that together make up the array are referred to as:

A)indexed variables
B)subscripted variables
C)elements of the array
D)all of the above
سؤال
An array is a collection of variables all of the same type.
سؤال
A type of array in which different rows can have different number of columns is called a/an:

A)partially filled array
B)ragged array
C)initialized array
D)none of the above
سؤال
A ________ loop is a good way to step through the elements of an array and perform some program action on each indexed variable.

A)while
B)do…while
C)for
D)all of the above
سؤال
A _________ can occur if a programmer allows an accessor method to return a reference to an array instance variable.

A)short circuit
B)privacy leak
C)partially filled array
D)syntax error
سؤال
An array with more than one index is called a/an:

A)partially filled array
B)multidimensional array
C)bidirectional array
D)one dimensional array
سؤال
The subscript of the first indexed variable in an array is:

A)0
B)1
C)2
D)3
سؤال
Partially filled arrays require:

A)a variable to track the number of array positions used
B)the use of local variables
C)the use of global variables
D)all of the above
سؤال
An array has only one public instance variable,which is named length.
سؤال
A method can not change the values stored in the indexed variables of an array argument.
سؤال
Given the following character array
char[] h = {'H','E','L','L','O'};
Write a Java statement that will create a new String object from the character array.
سؤال
You may cycle through elements of a collection object using a for loop.
سؤال
Write a Java method that takes an integer array as a formal parameter and returns the sum of integers contained within the array.
سؤال
A variable of an enumerated type can have the special value null.
سؤال
Arrays are objects that are created with new just like class objects.
سؤال
What are three ways you can use the square brackets [ ] with an array name?
سؤال
Java allows you to declare arrays with more than one index.
سؤال
An array of chars is the same as a String in Java.
سؤال
How are arrays tested to see if they contain the same contents?
سؤال
Write a Java statement that declares and creates an array of Strings named Breeds.Your array should be large enough to hold the names of 100 dog breeds.
سؤال
Explain what the main methods array parameter,args,is used for.
سؤال
Declare and create an integer array that will contain the numbers 1 through 100.Use a for loop to initialize the indexed variables.
سؤال
You can only use array indexed variables as arguments to methods.
سؤال
A collection class is a class whose objects store a collection of values.
سؤال
A one dimensional array is also called an array of arrays.
سؤال
An array name references a memory address.
سؤال
In a vararg specification the ellipsis is not part of the Java syntax.
سؤال
Write a Java method as well as any facilitator methods needed to perform a sort on an array of whole numbers in descending order.
سؤال
Discuss how you could represent a table of related records using a multidimensional array.
سؤال
What is the output of the following code?
int[] numbers = new int[10];
forint i=0;i < numbers.length;++i)
numbers[i] = i * 2;
forint i=0;i < numbers.length;++i)
System.out.printnumbers[i] / 2 + " ");
System.out.println);
سؤال
Write a complete Java console application that prompts the user for a series of quiz scores.The user should type -1 to signify that the input of quiz scores is complete.Your program should then average the scores and display the result back to the user.
سؤال
Initialize the array created in number 11 above to -1.0.
سؤال
Declare and create a 10 x 10 multidimensional array of doubles.
سؤال
Declare and create a multidimensional array to hold the first and last names of 10 people.
سؤال
What is the output of the following code?
int[] numbers = new int[10];
forint i=0;i < numbers.length;++i)
numbers[i] = i * 2;
forint i=0;i < numbers.length;++i)
System.out.printnumbers[i] + " ");
System.out.println);
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/46
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 6: Arrays
1
Java provides a looping mechanism for objects of a collection.This looping mechanism is called a __________ loop.

A)While
B)For
C)For each
D)All of the above
C
2
The correct syntax for accessing the length of an array named Numbers is:

A)Numbers.length)
B)Numbers.length
C)both A and B
D)none of the above
B
3
An arrays length instance variables value can be changed by a program.
False
4
Which of the following initializer lists correctly initializes the indexed variables of an array named myDoubles?

A)double myDoubles[double] = {0.0,1.0,1.5,2.0,2.5};
B)double myDoubles[5] = new double0.0,1.0,1.5,2.0,2.5);
C)double[] myDoubles = {0.0,1.0,1.5,2.0,2.5};
D)array myDoubles[double] = {0.0,1.0,1.5,2.0,2.5};
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
5
An ArrayIndexOutOfBounds error is a:

A)compiler error
B)syntax error
C)logic error
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
6
A value of an enumerated type is similar to a/an:

A)Instance variable
B)Object of a class
C)Named constant
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
7
This type of loop provides a convenient mechanism to iterate through every element of an array.

A)for each
B)for
C)do while
D)while
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
8
What is the correct expression for accessing the 5< sup >th< /sup > element in an array named colors?

A)colors[3]
B)colors[4]
C)colors[5]
D)colors[6]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
9
The name of the sorting algorithm that locates the smallest unsorted value in an array and places it in the next sorted position of the array is called:

A)bubble sort
B)merge sort
C)radix sort
D)selection sort
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
10
Consider the following array: <strong>Consider the following array:   What is the value of myArray[myArray[1] - myArray[0]]</strong> A)7 B)9 C)-3 D)6 What is the value of myArray[myArray[1] - myArray[0]]

A)7
B)9
C)-3
D)6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
11
The base type of an array may be all of the following but:

A)string
B)boolean
C)long
D)all of these may be a base type of an array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
12
The individual variables that together make up the array are referred to as:

A)indexed variables
B)subscripted variables
C)elements of the array
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
13
An array is a collection of variables all of the same type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
14
A type of array in which different rows can have different number of columns is called a/an:

A)partially filled array
B)ragged array
C)initialized array
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
15
A ________ loop is a good way to step through the elements of an array and perform some program action on each indexed variable.

A)while
B)do…while
C)for
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
16
A _________ can occur if a programmer allows an accessor method to return a reference to an array instance variable.

A)short circuit
B)privacy leak
C)partially filled array
D)syntax error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
17
An array with more than one index is called a/an:

A)partially filled array
B)multidimensional array
C)bidirectional array
D)one dimensional array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
18
The subscript of the first indexed variable in an array is:

A)0
B)1
C)2
D)3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
19
Partially filled arrays require:

A)a variable to track the number of array positions used
B)the use of local variables
C)the use of global variables
D)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
20
An array has only one public instance variable,which is named length.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
21
A method can not change the values stored in the indexed variables of an array argument.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
22
Given the following character array
char[] h = {'H','E','L','L','O'};
Write a Java statement that will create a new String object from the character array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
23
You may cycle through elements of a collection object using a for loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
24
Write a Java method that takes an integer array as a formal parameter and returns the sum of integers contained within the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
25
A variable of an enumerated type can have the special value null.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
26
Arrays are objects that are created with new just like class objects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
27
What are three ways you can use the square brackets [ ] with an array name?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
28
Java allows you to declare arrays with more than one index.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
29
An array of chars is the same as a String in Java.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
30
How are arrays tested to see if they contain the same contents?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
31
Write a Java statement that declares and creates an array of Strings named Breeds.Your array should be large enough to hold the names of 100 dog breeds.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
32
Explain what the main methods array parameter,args,is used for.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
33
Declare and create an integer array that will contain the numbers 1 through 100.Use a for loop to initialize the indexed variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
34
You can only use array indexed variables as arguments to methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
35
A collection class is a class whose objects store a collection of values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
36
A one dimensional array is also called an array of arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
37
An array name references a memory address.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
38
In a vararg specification the ellipsis is not part of the Java syntax.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
39
Write a Java method as well as any facilitator methods needed to perform a sort on an array of whole numbers in descending order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
40
Discuss how you could represent a table of related records using a multidimensional array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
41
What is the output of the following code?
int[] numbers = new int[10];
forint i=0;i < numbers.length;++i)
numbers[i] = i * 2;
forint i=0;i < numbers.length;++i)
System.out.printnumbers[i] / 2 + " ");
System.out.println);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
42
Write a complete Java console application that prompts the user for a series of quiz scores.The user should type -1 to signify that the input of quiz scores is complete.Your program should then average the scores and display the result back to the user.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
43
Initialize the array created in number 11 above to -1.0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
44
Declare and create a 10 x 10 multidimensional array of doubles.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
45
Declare and create a multidimensional array to hold the first and last names of 10 people.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
46
What is the output of the following code?
int[] numbers = new int[10];
forint i=0;i < numbers.length;++i)
numbers[i] = i * 2;
forint i=0;i < numbers.length;++i)
System.out.printnumbers[i] + " ");
System.out.println);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 46 في هذه المجموعة.