Search Header Logo

Computer Programming 2 Final Review

Authored by Ryan Trujillo

Computers

9th - 12th Grade

Used 4+ times

Computer Programming 2 Final Review
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following creates an int array of size 10?

int[10] myArray = new int[10];

int[] myArray = new int[10];

int[] myArray = { 10 };

int myArray[] = int[] * 10;

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do I create an ArrayList to hold ints?

ArrayList<Integer> myArray = new ArrayList<Integer>();

int ArrayList myArray = new int ArrayList();

ArrayList<int> myArray = new ArrayList<int>();

ArrayList myArray = new ArrayList(Integer);

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do I add a String called myString to an ArrayList called myArray?

myArray[0] = myString;

myArray.add(myString);

myString.addTo(myArray);

myArray += myString;

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code do?

int[] myArray = new int[10];

myArray[10] = 100;

Assigns the int 100 to position 10 in the array.

Throw an error

Resize the array from 10 to 100

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

I have an Integer ArrayList named myArray. I want to add the number 99 to my list, but I want to guarantee it will show up at the very front. How do I do this?

myArray.add(99);

myArray.add(1, 99);

myArray.add(0, 99);

myArray.front(99);

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If I have the following Strings contained in an ArrayList

"Dog"

"Cat"

"Bird"

What would the index of "Cat" be if I remove "Dog"?

0

1

2

3

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do I remove an object from an ArrayList myArray?

The object I want to remove is at index 0.

myArray.remove(0);

myArray.remove(myArray[0]);

myArray.delete(0);

myArray.get(0) = null;

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?