
JavaP2 Unit 2 Data Structures Quiz
Authored by Krista Dobbins
Computers
9th - 12th Grade
Used 17+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
22 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following arrays has a length of 5?
double[] arr = new double[6];
double[] arr = {0, 1, 2, 3, 4, 5};
double[] arr = new double[]{1, 2.3, 4, 5};
None of the above
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following are valid arrays?
I only
II only
III only
I and II
I and III
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following program?
hel
hello
hellow
Error
None of the above
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
When run, which of the following yields the integer 5?
int[] newArray = {5, 5, 5, 5, 5, 5};
System.out.println(newArray.length);
String pets[] = new String[5];
System.out.println(pets.length());
int[] anotherArray = {5, 10, 15, 20, 25};
System.out.println(anotherArray[(anotherArray.length - 2)] - 15);
String[] favoriteNumbers = {"5", "7", "12", "13", "5"};
System.out.println(favoriteNumbers[favoriteNumbers[0]]);
int[] greatArray = {5, 4, 3, 2, 1, 0};
System.out.println(greatArray.get(0));
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What values will the array contain after the following the code is run?
{6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4}
{1, -3, 3, -1, 5, 1, 7, 3, 9, 5, 11}
{1, 3, 5, 7, 9, 7, 5, 3, 1, -1, -3}
{-4, 1, -2, 3, -4, 5, -6, 7, -8, 9}
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
You are working at the frozen yogurt shop in the mall. Your boss asks you to count how many flavors have the word chocolate in their name. You begin going through the list of flavors, but quickly realize that their are over 9000 flavors to check! Luckily, your boss stored all of the different flavors in a Java Array named flavorArray on the company computer. Write a Java program to count the number of flavors that have chocolate in their name.
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What value will be held in mysteryNumber when this code finishes running?
0
17
1
16
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 Microsoft
or continue with
%20(1).png)
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?