Search Header Logo

Java-Chapter 18 Exam

Authored by Sundi Tiller

Computers

12th Grade

Used 1+ times

Java-Chapter 18 Exam
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following types of data can be stored in arrays?

Primitive data types

strings

References to any kind of object

All of these can be stored in arrays

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When the line of code below is run, what values will be stored in each of the array elements? int[] teamScores = new int[5];

0

null

false

Java doesn't define an initial value, so the contents are random

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which answer will correctly declare and initialize a 5-element array with specific numeric values?

int[] teamScores = new int(10,5,17,20,3);

int teamScores = (10,5,17,20,3);

int[] teamScores = {10,5,17,20,3};

int[] teamScores = new int[10,5,17,20,3];

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are the minimum and maximum valid array index values for a 5-element array?

0 and 5

0 and 4

1 and 4

1 and 5

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the code below, which statement will correctly set the very first array element equal to 10? int[] teamScores = new int[5];

teamScores(1) = 10;

teamScores[0] = 10;

teamScores[10] = 0;

teamScores = 10;

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If the Score class has been defined, how many unique Score objects are created by the following code?

Score[] teamScores = new Score[4];

teamScores[0] = new Score();

teamScores[1] = new Score();

teamScores[2] = teamScores[1];

1

3

2

4

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If the Score class has been defined, what phrases should replace the ??? marks to set up a standard for() loop to iterate over the entire array?

Score[] teamScores = new Score[4];

for (???)

{

teamScores[i] = new Score();

}

int i=1; i<teamScores.length- 1; i++

int i=0; i<=teamScores.length; i++

int i=1; i<=teamScores.length-1; i++

int i=0; i<teamScores.length; i++

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?