Search Header Logo

comp sci final

Authored by Yathin Mrudul

Other

11th Grade

Used 1+ times

comp sci final
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

51 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the proper syntax to initialize an empty 6x6 2D String array?

String[] array = new String[6][6];

int[][] array = new int[6][6];

String[][] array = new String[6];

String[][] array = new String[6][6];

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int[][] grid = new int[5][3]

What is the value of grid[0].length?

0

5

3

15

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A 2D array is initialized:

int [][] array = {{1,2,3},{4,5,6},{7,8,9}};

What is the result of array[0][1] + array[2][0]?

10

15

9

5

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A 2D double array is declared and initialized to track the terrain of a city park. Each value in the 2D array represents the height of a particular latitude and longitude above sea level. The 2D grid represents the map of the part and each entry in the grid represents the height.

With this in mind, the columns are positioned to represent Longitude in the 2D array and Latitude is represented by each row in the 2D array.

The creator of this 2D array would like to look at the height of the city park along the longitude 100.0 - which traversal method would make the most sense in order to do so?

Row-Major Order

Enhanced for loop

Column-Major Order

This isn’t possible given the 2D array.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A 2D double array terrainMap is declared and initialized to track the terrain of a city park. Each value in the 2D array represents the height of a particular latitude and longitude above sea level. The 2D grid represents the map of the part and each entry in the grid represents the height.

With this in mind, the columns are positioned to represent Longitude in the 2D array and Latitude is represented by each row in the 2D array.

Which of the following would be a correct way to write the traversal for this 2D array?

Media Image
Media Image
Media Image
Media Image

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A 2D double array terrainMap is declared and initialized to track the terrain of a city park. Each value in the 2D array represents the height of a particular latitude and longitude above sea level. The 2D grid represents the map of the part and each entry in the grid represents the height.

With this in mind, the columns are positioned to represent Longitude in the 2D array and Latitude is represented by each row in the 2D array.

Which of the following would be the correct way to print out all the indices that are more than 5 feet above sea level?

Media Image
Media Image
Media Image
Media Image

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What would be a correct way to instantiate this 2D array?

int[][] table = { 1, 0, 10, 0, 3, 8, 38, 0 };

int[][] table = { {1, 0, 10, 0}, {3, 8, 38, 0} };

int[][] table = { {1}, {0}, {10}, {0}, {3}, {8}, {38}, {0} };

int[][] table = { "1, 0, 10, 0", "3, 8, 38, 0" };

int[][] table = new int[1, 0, 10, 0][3, 8, 38, 0];

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?