Search Header Logo

APCSA unit 6

Authored by Thomas Wright

Computers

11th Grade

Used 11+ times

APCSA unit 6
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

26 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Which of the following arrays has a length of 5?

double[] arr = new double[6];

double[] arr = {3, 12, 52, 23, 14, 0};

double[] arr = new double[]{3, 12, 52, 23, 14, 0};

all of these

none of these

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements correctly initializes an array of integers with a size of 4?

int[] arr = new int[4];

int[] arr = {1, 2, 3};

int[] arr = new int[]{1, 2, 3, 4, 5};

none of these

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which option represents a correctly initialized string array containing exactly 3 elements?

String[] arr = new String[2];

String[] arr = {"Hello", "World", "!"};

String[] arr = new String[]{"Java"};

all of these

none of these

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you initialize a boolean array of size 5 with all elements set to true?

boolean[] arr = new boolean[5];

boolean[] arr = {true, true, true, true, true};

boolean[] arr = new boolean[]{true};

none of these

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

The following code is designed to return true if a target value is present in an array of integers.

Which of the following statements is true?

The code will not work correctly because the loop will not access each of the numbers correctly.

The code will not work correctly because it may return true too soon.

The code will not work correctly because the method may return false too soon.


The code will work as intended.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What does the following code do when executed?

It will produce an error because the conditional statement is not set up correctly.

It will count the number of times the value in the highTemp array exceeds the target value.

It will produce an ArrayIndexOutOfBoundsException

It will count the number of times that the value in the array is greater than the previous value in the array.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements is valid? Assume that variable arr is an array of n integers and that the following is true:

arr[0] != arr[i] for all values of i from 1 through n - 1

The element arr[0] does not occur anywhere else in the array

arr has no duplicates

arr has duplicates

arr is sorted

arr is not sorted

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?