Search Header Logo

String Methods and Characters

Authored by Courtney Yatteau

Computers

10th - 12th Grade

Used 3+ times

String Methods and Characters
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

The following method will return true if and only if:

s starts with two or more of the same characters

s contains two or more of the same characters

s contains two or more of the same character in a row

s ends with two or more of the same characters

s.charAt(0) == s.charAt(1)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Susan is 5 years older than Matt. Three years from now Susan’s age will be twice Matt’s age. What should be in place of the following condition to solve this problem?

s == (m - 5) && (2 * s + 3) == (m + 3)

(s == m - 5) && (s - 3 == 2 * (m - 3))

(s == (m + 5)) && ((s + 3) == (2 * m + 3))

s == m + 5 && s + 3 == 2 * m + 6

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Assuming that x and y have been declared as valid integer values, which of the following is equivalent to this statement?

(x > 15 && x < 18) && (x > 10)

(y < 20) || (x > 15 && x < 18)

((x > 10) || (x > 15 && x < 18)) || (y < 20)

(x < 10 && y > 20) && (x < 15 || x > 18)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Given the following method declaration, what will redo(82, 3) return?

5

4

6

7

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

"foxtrot".substring(3, 5)

What is returned by the substring above?

tr

xtr

xr

fotot

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

"tictactoe".indexOf( 'e' )

What is returned by indexOf?

7

8

9

10

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What does the following segment of Java code print out?

4.5 5

4.5 4

4.5 4.0

4.5 4.5

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?