Deck 8: Arrays
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/37
العب
ملء الشاشة (f)
Deck 8: Arrays
1
To add up all the values in a two- dimensional array it would be best to use
A)one for loop
B)one sentinel controlled loop
C)two separate for loops
D)a nested for loop
E)no loop
A)one for loop
B)one sentinel controlled loop
C)two separate for loops
D)a nested for loop
E)no loop
D
2
If the scores array is defined like this: 
A)7
B)8
C)4
D)9
E)the first four scores

A)7
B)8
C)4
D)9
E)the first four scores
D
3
When an array is passed to a function, it is actually _ the array that is/are passed.
A)the data type and size of
B)the value stored in the first element of
C)the starting memory address of
D)a copy of all the values in
E)none of the above
A)the data type and size of
B)the value stored in the first element of
C)the starting memory address of
D)a copy of all the values in
E)none of the above
C
4
To step through a one- dimensional array, accessing the elements one by one, it would be most appropriate to use loop.
A)a nested loop
B)an infinite
C)no
D)a sentinel controlled loop
E)a for loop
A)a nested loop
B)an infinite
C)no
D)a sentinel controlled loop
E)a for loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
5
If you leave out the size declarator in an array declaration
A)the array will contain no elements.
B)the value of each array element is set to a default value of 0.
C)the array size defaults to 100 elements.
D)the array cannot be created.
E)you must furnish an initialization list.
A)the array will contain no elements.
B)the value of each array element is set to a default value of 0.
C)the array size defaults to 100 elements.
D)the array cannot be created.
E)you must furnish an initialization list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
6
An array can store a group of values, but the values must be
A)all the same data type.
B)numeric, not characters or strings.
C)declared at the time the array is created.
D)constants.
E)none of the above.
A)all the same data type.
B)numeric, not characters or strings.
C)declared at the time the array is created.
D)constants.
E)none of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
7
By using the same you can build relationships between data stored in two or more arrays.
A)arguments
B)subscript
C)array name
D)data type
E)data
A)arguments
B)subscript
C)array name
D)data type
E)data
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
8
The statement typedef int oneDArray[20];
Does which of the following?
A)creates an array of 20 integers
B)makes oneDArray an alias for a data type that holds 20 integers
C)creates a one- dimensional integer array with all elements initialized to 20
D)makes oneDArray a copy of another 20- integer array
E)none of the above
Does which of the following?
A)creates an array of 20 integers
B)makes oneDArray an alias for a data type that holds 20 integers
C)creates a one- dimensional integer array with all elements initialized to 20
D)makes oneDArray a copy of another 20- integer array
E)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
9
You can assign the contents of one array to another by using
A)both array names.
B)the equality operator.
C)the assignment operator.
D)A and C together.
E)none of the above.
A)both array names.
B)the equality operator.
C)the assignment operator.
D)A and C together.
E)none of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
10
When a relationship is established between two or more arrays by using the same subscript to relate entries between the arrays, the arrays are called arrays.
A)indexed
B)paired
C)parallel
D)linked
E)brother
A)indexed
B)paired
C)parallel
D)linked
E)brother
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
11
When you pass an array as an argument to a function, the function can modify the contents of the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
12
A two- dimensional array can be viewed as
A)a table with rows and columns.
B)two columns of indexes.
C)two rows of values.
D)any of the above.
E)none of the above.
A)a table with rows and columns.
B)two columns of indexes.
C)two rows of values.
D)any of the above.
E)none of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
13
When an array is passed to a function, it is actually the array that is passed.
A)the data type and name of
B)a copy of all the values in
C)the starting memory address of
D)the value stored in the first element of
E)the data type and size of
A)the data type and name of
B)a copy of all the values in
C)the starting memory address of
D)the value stored in the first element of
E)the data type and size of
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
14
C++ allows array elements to be class objects provided they are all instances of the same class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
15
To access an array element, use the array name and the element's
A)value.
B)name.
C)data type.
D)size declarator.
E)subscript.
A)value.
B)name.
C)data type.
D)size declarator.
E)subscript.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
16
Subscript numbering in C++
A)can begin with a programmer- defined value.
B)automatically begins with zero.
C)can be set at run time.
D)automatically begins with one.
E)varies from program to program.
A)can begin with a programmer- defined value.
B)automatically begins with zero.
C)can be set at run time.
D)automatically begins with one.
E)varies from program to program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
17
The statement
is an example of
A)an illegal array declaration.
B)an illegal array initialization.
C)data encapsulation.
D)default arguments.
E)implicit array sizing.

A)an illegal array declaration.
B)an illegal array initialization.
C)data encapsulation.
D)default arguments.
E)implicit array sizing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
18
Unlike regular variables, arrays can hold multiple
A)data types.
B)values.
C)variables.
D)named constants.
E)operators.
A)data types.
B)values.
C)variables.
D)named constants.
E)operators.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
19
A one- dimensional array can be initialized at the time it is defined, but a two- dimensional array cannot be.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
20
Assuming employee is an array of objects with a public member function named
setHourlyWage, the following statement correctly calls this method for employee[2].
![Assuming <sup>employee</sup><sup> </sup>is an array of objects with a public member function named <sup>setHourlyWage</sup>, the following statement correctly calls this method for <sup>employee[2]</sup>.](https://d2lvgg3v3hfg70.cloudfront.net/TB3767/11eae135_235c_9e4f_92b4_f3293f3ba7c3_TB3767_00.jpg)
setHourlyWage, the following statement correctly calls this method for employee[2].
![Assuming <sup>employee</sup><sup> </sup>is an array of objects with a public member function named <sup>setHourlyWage</sup>, the following statement correctly calls this method for <sup>employee[2]</sup>.](https://d2lvgg3v3hfg70.cloudfront.net/TB3767/11eae135_235c_9e4f_92b4_f3293f3ba7c3_TB3767_00.jpg)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
21
The following statement adds a new element to a the department vector at index 25.


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
22
The following statement is a valid C++ array definition.


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
23
The amount of memory used by an array depends upon the array's data type and how many elements in the array currently have data stored in them.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
24
To assign the entire contents of one array to another, you can use the assignment operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
25
Each individual element of an array can be accessed by the array name and an element number, called a subscript.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
26
When you create a vector it is unnecessary to specify how many elements it will hold because it will expand in size as you add new values to it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
27
The following statement initializes all five elements of the number array to 1.


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
28
The amount of memory used by an array depends solely on the number of elements the array can hold.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
29
After carrying out the following two statements, sales will have been created as a one- dimensional array that can hold 20 double values.


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
30
A one- dimensional array can only store elements of a single data type, but a two- dimensional array can hold data of two different data types.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
31
The following array definition is legal because C++ allows arrays to be implicitly sized.


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
32
In C++ If you attempt to store more data in an array than it can hold, the compiler will issue an error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
33
C++ allows a vector to be created with no elements in it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
34
C++ allows arrays to have more than two dimensions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
35
An element of a two- dimensional array is referenced by the array name and two subscripts, first the element row number and then the element column number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
36
If a C++ program contains the following array definition


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
37
An individual array element can be processed or passed to a function just like a regular C++ variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck