Java - arrays and String methods

Java - arrays and String methods

9th - 12th Grade

12 Qs

quiz-placeholder

Similar activities

TQ - Review Quiz Week 1

TQ - Review Quiz Week 1

9th Grade

10 Qs

Microcontroller

Microcontroller

11th Grade - University

10 Qs

Input, output and storage de

Input, output and storage de

8th Grade - Professional Development

14 Qs

TIN 11 - PYTHON - PHÉP TOÁN - BIỂU THỨC - CÂU LỆNH GÁN

TIN 11 - PYTHON - PHÉP TOÁN - BIỂU THỨC - CÂU LỆNH GÁN

11th Grade

10 Qs

Ulangan harian 1 Algoritma dan Pemrograman

Ulangan harian 1 Algoritma dan Pemrograman

12th Grade - University

13 Qs

QBASIC Programming

QBASIC Programming

5th - 10th Grade

10 Qs

hardware and software(g3)

hardware and software(g3)

2nd - 10th Grade

10 Qs

Quis Grade 5

Quis Grade 5

9th - 12th Grade

15 Qs

Java - arrays and String methods

Java - arrays and String methods

Assessment

Quiz

Computers

9th - 12th Grade

Practice Problem

Hard

Created by

Sebastian Pinzon

Used 48+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these is a correct way of declaring an array of integers?

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

Media Image

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

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?