Java String Methods

Java String Methods

9th - 12th Grade

7 Qs

quiz-placeholder

Similar activities

algoritma

algoritma

10th Grade

10 Qs

NHTW Programming

NHTW Programming

9th Grade

10 Qs

Access - Lesson 14

Access - Lesson 14

9th - 12th Grade

10 Qs

ICT 10 : Introduction to Adobe Illustrator(CS5)

ICT 10 : Introduction to Adobe Illustrator(CS5)

10th Grade

10 Qs

Wee Word Intro

Wee Word Intro

7th - 12th Grade

12 Qs

Basic Python Bug Squashing

Basic Python Bug Squashing

9th Grade

11 Qs

HTML 1

HTML 1

8th - 11th Grade

10 Qs

MIL March 8, 2023

MIL March 8, 2023

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?