Java Arrays Prt 1Quiz

Quiz
•
Computers
•
9th - 12th Grade
•
Hard
Edwin Charikinya
Used 1+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main purpose of an array in Java?
To store multiple data types
To store a single value only
To create a collection of indexed like values
To link classes and objects
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the default value assigned to elements in a newly created int array?
Null
-1
Random values
0
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the valid way to declare and create an array in a single line?
int numbers; = new int[6];
int numbers = new int[];
int[] numbers = new int[6];
int[] = new int[6] numbers;
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens if you access an array index that is out of bounds?
The value returned is null
Compilation error
ArrayIndexOutOfBoundsException
It returns the last element
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is an off-by-one error?
Initialising array with a negative size
Accessing index from 0 to array.length
Declaring an array without specifying a size
Using the wrong data type
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the .length property of an array return?
Number of non-zero elements
Maximum index
Number of elements in the array
Total memory used by the array
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which loop is recommended for read-only access to all elements in an array?
while loop
do-while loop
enhanced for loop
nested loop
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
SIP C

Quiz
•
12th Grade
12 questions
APCSA Unit 7

Quiz
•
9th - 12th Grade
17 questions
AP CS ArrayLists

Quiz
•
12th Grade
10 questions
Advanced Java Study Guide

Quiz
•
11th - 12th Grade
15 questions
AP Computer Science A Quiz

Quiz
•
12th Grade
15 questions
Unit 8 - Searching and Sorting

Quiz
•
9th - 12th Grade
20 questions
X - Progdas - Array dan Fungsi

Quiz
•
10th Grade
10 questions
Array

Quiz
•
10th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
14 questions
Inputs and Outputs: Computer Science Intro

Lesson
•
5th - 9th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade