
Java Arrays Quiz
Authored by Geoff Ewart
Computers
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you declare an empty array of integers in Java?
int[] myNum = {};
int myNum = [];
int[] myNum = [];
int myNum[] = {};
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to declare an array of strings in Java?
string[] myText;
String[] myText;
str[] myText;
string = myText;
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? String[] cars = {"Volvo", "BMW", "Ford", "Mazda"}; cars[0] = "Opel"; System.out.println(cars[0]);
Volvo
BMW
Opel
Mazda
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? String[] cars = {"Volvo", "BMW", "Ford", "Mazda"}; System.out.println(cars.length);
3
4
5
6
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid array declaration in Java?
String myText[];
String myText;
String[] myText;
String myText[] = new String[5];
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct way to initialize an array in Java?
String[] cars = new String[4];
String cars[] = {"Volvo", "BMW", "Ford", "Mazda"};
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
All of the above
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of using the length property in a for loop when iterating through an array?
To determine the type of elements in the array
To specify how many times the loop should run
To sort the elements in the array
To reverse the elements in the array
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?
Similar Resources on Wayground
18 questions
Lenguaje de Definición de Datos
Quiz
•
University
10 questions
Programacion Orientada a Objetos
Quiz
•
12th Grade - University
15 questions
Firewall and Network Security
Quiz
•
University
10 questions
Information systems concepts
Quiz
•
University
18 questions
PBO Inheritance Episode 2
Quiz
•
University
13 questions
L1 - Computer Networks
Quiz
•
University
10 questions
Algorithm analysis: divide & conquer theory
Quiz
•
University
13 questions
Five Nights At Freddy's: Security Breach Quiz
Quiz
•
KG - Professional Dev...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade