Unit 6 - Arrays Review

Interactive Video
•
Computers
•
11th Grade
•
Medium
Myra Deister
Used 2+ times
FREE Resource
13 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements about Java arrays is false?
Arrays can hold primitive data types and objects
The size of an array can be changed after initialization
Multi-dimensional arrays are arrays of arrays
Array elements are stored in contiguous memory locations
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a valid way to declare and initialize an array in Java?
nt[] numbers = new int[5];
int numbers[] = {1, 2, 3, 4, 5};
int[] numbers = new int[]{1, 2, 3, 4, 5};
int numbers[5] = {1, 2, 3, 4, 5};
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code snippet:
int[] arr = new int[5];
arr[5] = 10;
What will happen when this code is executed?
The value 10 will be stored at index 5
An ArrayIndexOutOfBoundsException will be thrown
The array will automatically resize to accommodate the new element
The value 10 will be stored at index 4
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best describes the relationship between an array's reference variable and its object in memory?
They are stored in the same memory location
The reference variable stores the first element of the array
The reference variable points to the array object on the heap
The reference variable stores the length of the array
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
int[] a = {1, 2, 3, 4, 5};
int[] b = a;
b[2] = 10;
System.out.println(a[2]);
3
10
5
An error occurs
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In the example, is it possible to use an enhanced for loop instead of a for loop?
True
False
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code:
int[] arr = {1, 2, 3, 4, 5};
for(int i = 0; i < arr.length; i += 2) {
System.out.print(arr[i] + " ");
}
What will be the output?
1 2 3 4 5
1 3 5
2 4
1 3
Create a free account and access millions of resources
Similar Resources on Wayground
6 questions
CSA Fun Friday 4-12-24

Interactive video
•
12th Grade
6 questions
AP CS MCQ array

Interactive video
•
12th Grade
11 questions
Data Structures and Algorithms Concepts

Interactive video
•
9th - 12th Grade
11 questions
Understanding Arrays, Records, Lists, and Tuples

Interactive video
•
9th - 12th Grade
11 questions
Full Stack Web Development MASTERY Course - Novice to Expert - All about Arrays

Interactive video
•
University
11 questions
Modular Spreadsheets for Character Customization

Interactive video
•
9th - 10th Grade
11 questions
C# Programming Concepts and Fundamentals

Interactive video
•
9th - 10th Grade
11 questions
Understanding 2D Arrays and Row Major Order

Interactive video
•
9th - 12th Grade
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade