NEW
Font size
WorksheetsArrays & Strings using C
Total questions: 15
Worksheet time: 11mins
Given the code, what is in values[2][1] ?
7.9
9.2
7.3
0.5
Given the code, what is the value of things.length ?
4
3
12
7
Given the following:
double [][] stuff ;
Which of the following statements constructs an array with 5 rows of 7 columns each and assign its reference to stuff ?
stuff = new stuff[5][7] ;
stuff = new double[5][7] ;
new stuff = double[5][7] ;
stuff = double new[5][7] ;
Given the code, which of the following fragments prints out every element of items?
Each piece of data in an array is BEST described as a what?
Integer and string
Item
Element
Elephant
Which BEST describes an array?
A data structure - Stores a collection of values under one name
A data collection - Stores a structure of values under one name
A list - Stores a list of numbers
A list - Stores a list of strings
Why are arrays useful?
It saves storage space storing under one name
You can store integers and strings together
You can store thing related on different topics
You may have lots of related data that you don't want to store separately
Which of the following statements correctly declares a two-dimensional integer array?
int Matrix[ ] = new int[5,4];
int Matrix[ ]; Matrix = new int[5,4];
int Matrix[ ][ ] = new int[5][4];
int Matrix[ ][ ] = int[5][4];
How would you get the value "6" out of the following array?
a [0][3]
a [1][3]
c) a[0][2]
d) a[2][0]
e) a[3][1]
What would the statement a[1].length return?
3
4
2
1
An array elements are always stored in ________ memory locations.
sequential
Random
Sequential and Random
None of the above
