Which of these is a correct way of declaring an array of integers?
Java - arrays and String methods

Quiz
•
Computers
•
9th - 12th Grade
•
Hard
Sebastian Pinzon
Used 48+ times
FREE Resource
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
int[] arrayA = new int[10];
int arrayB = new int[20];
int arrayC[] = int[30];
int[] arrayD = new int[40]
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Suppose you create a typical array of Strings, containing the subjects you will see next year. Which of the following is NOT true.
You may remove one of the subjects (it will be replaced by null).
You may add another subject to the array.
You may replace one subject with another one different.
You may copy the contents of that array into another array with the same size.
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which are Java's primitive data types?
byte, short, int, long, float, double, boolean, char, String
byte, short, int, long, float, double, boolean, char, array
byte, short, int, long, float, double, boolean, char, String, array
byte, short, int, long, float, double, boolean, char
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Suppose the variable 'word' stores a String more than 2 letters long.
Suppose the variable 'number' stores an int greater than 4.
What is the correct way to replace 'word' with itself repeated 'number' times?
word = word.repeat(number);
word = word.repeat(number+1);
word += word.repeat(number);
word = word.repeat(number-1);
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How to get the first letter of a String saved in the variable 'abc'?
abc.get(1);
abc[1]
abc.substring(0);
abc.substring(0,1);
6.
MULTIPLE SELECT QUESTION
1 min • 1 pt
You want to relabel your company from "9lionz" to "10lionz".
Which of these ways are valid ways to achieve that?
company = "10lionz";
String company = "10lionz";
company.substring(0,1) = "10";
company += "10" - "9";
7.
MULTIPLE SELECT QUESTION
2 mins • 1 pt
The code is supposed to return the initials from an array of names... Why is it not working properly?
The return type should be an array of Strings, not int[].
The substring method ca only be applied to Strings, not arrays themselves.
The substring should look the first letter always: .substring(0,1);
The method should return initials.
Create a free account and access millions of resources
Similar Resources on Quizizz
15 questions
Area and Arrays

Quiz
•
10th - 12th Grade
16 questions
Python programming

Quiz
•
6th - 12th Grade
12 questions
Java Strings

Quiz
•
9th - 12th Grade
16 questions
CSA Unit 3 Review

Quiz
•
10th - 12th Grade
15 questions
Array

Quiz
•
11th Grade
15 questions
Pentaksiran T4(1.3)

Quiz
•
11th Grade
10 questions
Soal-soal C++

Quiz
•
11th Grade
15 questions
Java Basic Data Structures

Quiz
•
6th - 10th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade
Discover more resources for Computers
25 questions
Spanish preterite verbs (irregular/changed)

Quiz
•
9th - 10th Grade
10 questions
Identify Slope and y-intercept (from equation)

Quiz
•
8th - 9th Grade
10 questions
Juneteenth: History and Significance

Interactive video
•
7th - 12th Grade
8 questions
"Keeping the City of Venice Afloat" - STAAR Bootcamp, Day 1

Quiz
•
9th - 12th Grade
26 questions
June 19th

Quiz
•
4th - 9th Grade
20 questions
Distance, Midpoint, and Slope

Quiz
•
10th Grade
20 questions
Figurative Language Review

Quiz
•
10th Grade
27 questions
STAAR English 1 Review

Quiz
•
9th Grade