One Dimensional Array
Quiz
•
Computers
•
University
•
Hard
Thomas Martinez
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the possible output of the following code?
String[] strings = new String[2];
System.out.println(strings);
[null, null]
[ , ]
String@74a14482
None of the above
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many lines does the following code output?
String[] days = new String[] { “sun”, ”mon”, ”tue”, ”wed”, ”thr”, ”fri”, ”sat”, ”sun”} ;
for(int i =1;i<=days.length ;i++)
System.out.println (days[i]);
six
seven
The code does not compile
The code compiles but throws an exception at runtime
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many dimensions does the array reference moreBools allow?
boolean[][] bools[], moreBools;
one dimension
two dimensions
three dimensions
none of the above
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If an index value is less than 0 or greater than or equal to 'array name'.length in an array element access expression, an . . . . . . is thrown.
ArrayOutOfBoundsException
ArraysIndexOutOfBoundsException
ArrayIndexOutOfBoundsException
ArrayIndexIsOutOfBoundsException
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
To declare a one-dimensional array, you will use this general form
type[] array-name = new [size];
type[size] array-name = new type[];
type[] array-name = new type[size];
type[] array-name = type[size];
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these array declaration statements are not legal?
int[ ][ ] i = { { 1, 2 }, { 1 }, {}, { 1, 2, 3 } };
int[ ] x = new int[2] {1, 2};
int[ ][ ] x = new int[ ][ ] { {1, 2, 3}, {4, 5, 6} };
int[ ][ ] x = { { 1, 2 }, new int[ 2 ] };
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these operators is used to allocate memory to array variables in Java?
malloc
alloc
new
new malloc
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
10 questions
MS Excel - Day 04
Quiz
•
University
10 questions
CompTIA Core 2 20221023
Quiz
•
University
12 questions
CSSE Quiz Day2
Quiz
•
University
10 questions
Recursion Practice, Recursion Practice, Recursion Practice...
Quiz
•
10th Grade - University
10 questions
cp06-01-1D-Array
Quiz
•
University
10 questions
PDS - 04225 Pointers & Dynamic Arrays - Chapter 8
Quiz
•
University - Professi...
10 questions
Listen in Python
Quiz
•
University
13 questions
Chap 1: What is a program made of?
Quiz
•
University
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade
Discover more resources for Computers
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
22 questions
FYS 2024 Midterm Review
Quiz
•
University
20 questions
Physical or Chemical Change/Phases
Quiz
•
8th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
12 questions
1 Times Tables
Quiz
•
KG - University
20 questions
Disney Trivia
Quiz
•
University
38 questions
Unit 6 Key Terms
Quiz
•
11th Grade - University