String Methods

String Methods

12th Grade - University

9 Qs

quiz-placeholder

Similar activities

Software Testing

Software Testing

University

10 Qs

Information System and Modern Organization part 1

Information System and Modern Organization part 1

University

14 Qs

CS Open House

CS Open House

University

10 Qs

Chapter 8 Week 1

Chapter 8 Week 1

9th - 12th Grade

11 Qs

Численные методы

Численные методы

12th Grade

10 Qs

IEEE Coding Competition

IEEE Coding Competition

University

13 Qs

Programación en Java

Programación en Java

12th Grade

12 Qs

String Methods

String Methods

Assessment

Quiz

Computers

12th Grade - University

Practice Problem

Medium

Created by

Adam Masters

Used 25+ times

FREE Resource

AI

Enhance your content in a minute

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

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Returns the character found at a specified position in a string. Positions start at 0 and continue to the number of characters in the string minus 1. For example, the letter ‘h’ is at position 5.

String x = "Joseph";System.out.println(x.charAt(2));
String x = "Joe"; System.out.println(x.equals("Joe"));
String x = "Joseph"; System.out.println(x.substring(2));
String x = "Joseph"; System.out.println(x.substring(2,5));

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Returns a true or false value dependent on whether two strings are equal in value (if they match). Use the [equalsIgnoreCase()] method if the caps sensitivity of the value being matched is not important.

String x = "Joseph";System.out.println(x.charAt(2));
String x = "Joe"; System.out.println(x.equals("Joe"));
String x = "Joseph"; System.out.println(x.substring(2));
String x = "Joseph"; System.out.println(x.substring(2,5));

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Returns a substring (a section of a string) starting at a specified position. Like other methods, the positions start at 0 and continue to the number of characters in the string minus 1.

String x = "Joseph";System.out.println(x.charAt(2));
String x = "Joe"; System.out.println(x.equals("Joe"));
String x = "Joseph"; System.out.println(x.substring(2));
String x = "Joseph"; System.out.println(x.substring(2,5));

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Returns a substring (a section of string) between a start position and end position. The positions start at 0 and continue to the number of characters in the string minus 1.

String x = "Joseph";System.out.println(x.charAt(2));
String x = "Joe"; System.out.println(x.equals("Joe"));
String x = "Joseph"; System.out.println(x.substring(2));
String x = "Joseph"; System.out.println(x.substring(2,5));

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Finds a specified character or characters in a string and replaces it with a specified character or characters.

String x = "joseph"; System.out.println(x.replace("j", "J"));
String x = "Joseph"; System.out.println(x.endsWith("h"));
String x = "joseph"; System.out.println(x.toUpperCase());
String x = " joseph "; System.out.println(x.trim());

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Returns a true or false value dependent on whether the string ends/starts with a specified character or characters.

String x = "joseph"; System.out.println(x.replace("j", "J"));
String x = "Joseph"; System.out.println(x.endsWith("h"));
String x = "joseph"; System.out.println(x.toUpperCase());
String x = " joseph "; System.out.println(x.trim());

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Turns all characters in a string to either UPPER-CASE or lower-case. This can be useful when matching strings given from a user.

String x = "joseph"; System.out.println(x.replace("j", "J"));
String x = "Joseph"; System.out.println(x.endsWith("h"));
String x = "joseph"; System.out.println(x.toUpperCase());
String x = " joseph "; System.out.println(x.trim());

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?