Search Header Logo

Unit 7 Review (AP Comp Sci A)

Authored by Jennifer Greene

Computers

12th Grade

Used 14+ times

Unit 7 Review (AP Comp Sci A)
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Consider the method.

What is the output when the ArrayList [3, 6, 9, 12, 14] is passed into the method?

[3, 6, 9, 9, 9]

[12. 9, 6, 3]

[3, 6, 9,]

[9, 9 6, 3]

b.    [3, 6, 9, 9]

2.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Consider the method. What will output given the ArrayList values and method call below?

[“carrots”, “celery”, “peppers”, “zucchini”, “onion”, “lettuce”]

hasWords(list, "onion", "radish", “peppers”)

0

1

2

3

true

3.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Consider the method. If the following ArrayList were passed to the method, how many elements would the ArrayList store after executing?

[“oops”, “whoops”, “nooope”, “whoooee”, “yoo”, “hoo”]

removeWord(list)

6

5

4

2

0

4.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Analyze the method

[0, 12, 11, 4, 8]

[0, 11, 4, 8, 12]

[0, 11, 12, 4, 8]

[0, 11, 12, 8, 4]

[0, 11, 12]

5.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Which of the following pieces of code could complete the method such that the method would count the number of Strings that have a length that is greater than 3?

if(words.get(i).length() < 3) count++;

if(words.get(i).length() == 3) count++;

if(words.get(i).length() >= 3) count++;

if(words.get(i).length() > 3) count++;

if(words.get(i).length() % 3 == 0) count++;

6.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Given an ArrayList<Integer> nums populated with values, which loop correctly subtracts two from each value in the list and replaces the original value with the lesser value?

i only

ii only

iii only

i and ii

ii and iii

7.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

The following code is incorrect. The intention of the loop is to find the product of all the values in the ArrayList nums that end in the number zero.  You may assume all the values stored in nums are two-digit numbers. Which of the statements below will correct the code?

I only

II only

III only

II and III

I, II, and III

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?