APCSA unit 6

APCSA unit 6

11th Grade

26 Qs

quiz-placeholder

Similar activities

pra PSPM SC025 (F02 KML)

pra PSPM SC025 (F02 KML)

6th Grade - University

24 Qs

Python Strings

Python Strings

11th Grade

21 Qs

AP CSA - Unit 6 Arrays Test Review

AP CSA - Unit 6 Arrays Test Review

10th - 12th Grade

30 Qs

Array and ArrayLists in Java

Array and ArrayLists in Java

9th - 12th Grade

25 Qs

Multidimensional Arrays (Review)

Multidimensional Arrays (Review)

10th - 12th Grade

25 Qs

Print, Input, Subroutines, Selection

Print, Input, Subroutines, Selection

10th - 11th Grade

22 Qs

Languages - Javascript and Node

Languages - Javascript and Node

1st - 12th Grade

21 Qs

2 D Arrays

2 D Arrays

10th - 12th Grade

24 Qs

APCSA unit 6

APCSA unit 6

Assessment

Quiz

Computers

11th Grade

Medium

Created by

Thomas Wright

Used 11+ times

FREE Resource

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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?