Question

How would you create an array named someNumbers that holds three rows and four columns? a....

How would you create an array named someNumbers that holds three rows and four columns?

a.

int[] someNumbers = new int[3][4]

b.

int[][] someNumbers = new int[3][4]

c.

int[][] someNumbers = new int[4][3]

d.

double[][] someNumbers = new int[3][4]

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The correct answer is

b. int[][] someNumbers = new int[3][4]

a is incorrect because there is only is one dimensional array declared in left side sysntax error.

c. is also incorrect because 4X3 means four rows and three columns.

d is also incorrect declaration of syntax the left side is declared the double and the right side is declared the integer type syntax error.

Add a comment
Know the answer?
Add Answer to:
How would you create an array named someNumbers that holds three rows and four columns? a....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  •     (10 pts) Define a two-dimensional array named temp with three rows and four columns of type int such that the first...

        (10 pts) Define a two-dimensional array named temp with three rows and four columns of type int such that the first row is initialized to 6, 8, 12, 9; the second row is initialized to 10, 13, 6, 16; and the third row is initialized to 27, 5, 10, 20.     (10 pts) Consider the following declarations, and see p.566: enum brands = { GM, FORD, TOYOTA, BMW, KIA }; const int N_BRANDS = 5; const int COLOR_TYPES = 6; double...

  • C# 1.) Assume an integer array named bArray was dimensioned to store 10 rows and 2...

    C# 1.) Assume an integer array named bArray was dimensioned to store 10 rows and 2 columns. Use a variable named element to reference individual cells. Fill in the blanks below for the foreach loop which might be used to display the contents of the array. foreach(Blank 1, Blank 2, Blank 3, Blank 4) . 2.) In order to place a new element in an ArrayList use the ___________ method. 3.) With the following declaration: int [ , ] ctn...

  • Define a two-dimensional int array which has 5 rows and 3 columns. The elements in array...

    Define a two-dimensional int array which has 5 rows and 3 columns. The elements in array is randomly initialized (using Math.random()). Write a method to find the maximum value in this two dimensional array; Write a method to find the average value in the array; Write a method to count how many elements are smaller than average; Write a method to copy contents in a two-dimensional array to a one-dimensional array. The method will return this one-dimensional array. Method is...

  • You must create a Java class named TenArrayMethods in a file named TenArrayMethods.java. This class must...

    You must create a Java class named TenArrayMethods in a file named TenArrayMethods.java. This class must include all the following described methods. Each of these methods should be public and static.Write a method named getFirst, that takes an Array of int as an argument and returns the value of the first element of the array. NO array lists. Write a method named getLast, that takes an Array of int as an argument and returns the value of the last element...

  • in c++ Create a struct named Contact that holds the values you would normally find in...

    in c++ Create a struct named Contact that holds the values you would normally find in your phone's contact.

  • We want to create and then initialize an array named A to contain the integers: 4,...

    We want to create and then initialize an array named A to contain the integers: 4, 5, 6, 7. There are multiple ways this can be done. From the list below, select all of the correct ways to create and initialize A. int size = 4; int [] A = new int [size]; A[0] = 4; A[1] = 5; A[2] = 6; A[3] = 7; int [] A = new int [4];       A[0] = 4;       A[1] = 5;...

  • Write a C program that uses mallloc to create a 2D array. of c columns and...

    Write a C program that uses mallloc to create a 2D array. of c columns and r rows. Elements of array must be initialized to 0 and you must use malloc and free allocated memory fo array.

  • C++ Question 2: Create a dynamic jagged 2-d array of vehicle structs that holds an array...

    C++ Question 2: Create a dynamic jagged 2-d array of vehicle structs that holds an array of vehicles for different people. You will read the number of people and number of vehicles for each person from the user. Hint: Think about why you need a pointer for the num_vehicles. #include <iostream> using namespace std; int main() { int num_people, *num_vehicles; struct vehicle **v; cout << “How many people? ”; cin >> num_people; }

  • Write a class named RowSort which has the following members. Private: (1) double matrix 0O (a...

    Write a class named RowSort which has the following members. Private: (1) double matrix 0O (a 2D array): (2) int columns; (3) int rows Public: (1) A default constructor that creates a 2D array, 8 6 4 (2) A constructor that takes three values for the three private members, and creates a 2D array accordingly. (3) The "get" and "set" methods for the three private members. (4) A method that displays a 2D array, stored in the private member matrix,...

  • 1. Declare an array of five integers named boxes. 2. what do you type to access...

    1. Declare an array of five integers named boxes. 2. what do you type to access the third element in the boxes array? 3. what do you type to assign the number 10 to the 5th element in the boxes array? 4. Declare an array named cartons that contains these values: 4.2 , 3.1, 6.8 5. what is the subscript value of 6.8 in the cartons array? 6. what will this program output if is in a complete program? cout<<...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT