
Computer Programming 2 Term 1 Review
Authored by Ryan Trujillo
Computers
9th - 12th Grade
Used 4+ times

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 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 Strings?
ArrayList<String> myArray = new ArrayList<String>();
String ArrayList myArray = new String ArrayList();
ArrayList myArray = new ArrayList.ofType(String);
ArrayList myArray = new ArrayList(String);
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?