Java String Methods

Java String Methods

9th - 12th Grade

7 Qs

quiz-placeholder

Similar activities

Introduction AppSheet

Introduction AppSheet

12th Grade

10 Qs

Lógica Computacional - Os tipos de armazenamento de dados

Lógica Computacional - Os tipos de armazenamento de dados

10th Grade

10 Qs

Ομάδα 5 "Web 2.0 εργαλεία": Πόσο καλά τα γνωρίζετε;"

Ομάδα 5 "Web 2.0 εργαλεία": Πόσο καλά τα γνωρίζετε;"

10th Grade - University

10 Qs

PC1.8 Evaluate computer program

PC1.8 Evaluate computer program

9th Grade

10 Qs

Pre-Assessment: ICT 10 Orientation Day

Pre-Assessment: ICT 10 Orientation Day

10th Grade

10 Qs

Interstate Competition

Interstate Competition

7th - 10th Grade

11 Qs

Data Type- XI

Data Type- XI

11th Grade

10 Qs

12 CA One Mark 1-3

12 CA One Mark 1-3

12th Grade

10 Qs

Java String Methods

Java String Methods

Assessment

Quiz

Computers

9th - 12th Grade

Practice Problem

Hard

Created by

Michael Toepper

Used 87+ times

FREE Resource

AI

Enhance your content in a minute

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

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will myString.length() return?

27

28

26

29

Answer explanation

myString is 28 characters long

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will myString.indexOf("Sci") return?

8

9

10

-1

Answer explanation

remember the first character of a String is at index 0

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will myString.indexOf("x") return?

15

16

17

-1

Answer explanation

indexOf method returns -1 when the actual parameter is not found in the String object referenced before the dot "."

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will myString.substring(12) return?

e

ence is awesome!

This is invalid

cience is awesome!

Answer explanation

when only one actual parameter called with the substring method, the substring returned starts at the index given through the end of the String

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will myString.substring(10,15) return?

Scien

c

cienc

cien

Answer explanation

the index of the last character in the substring returned is one character before the second integer given in the method call

[(from, to) -> to index-1]

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will myString.substring( myString.length()-1) return?

-1

e

This is invalid

!

Answer explanation

length() is always one more than than the last index, so length()-1 is always gives the last character from a String

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will myString.substring( myString.length()) return?

!

e!

This is invalid

Computer Science is awesome!

Answer explanation

length() will always return an integer one greater than the index of the last character in a String, so using length() for an index will give a value outside the largest index of a String

Access all questions and much more by creating a free account

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?