Java Arrays Quiz

Java Arrays Quiz

University

15 Qs

quiz-placeholder

Similar activities

Online Test-3 ( Wipro Talent Next )- 30th July 2020

Online Test-3 ( Wipro Talent Next )- 30th July 2020

University

20 Qs

Asas JavaScript

Asas JavaScript

1st Grade - University

18 Qs

BSIS 2-3- Quiz in ARRAY

BSIS 2-3- Quiz in ARRAY

University

20 Qs

module3

module3

University

15 Qs

Recap C++

Recap C++

University

20 Qs

JavaScript Variables, Data Types, and Operators Quiz

JavaScript Variables, Data Types, and Operators Quiz

University

18 Qs

Java Programming-1

Java Programming-1

University

10 Qs

Pascal Quiz

Pascal Quiz

University

20 Qs

Java Arrays Quiz

Java Arrays Quiz

Assessment

Quiz

Computers

University

Hard

Created by

Geoff Ewart

FREE Resource

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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?