Java String & Math Class Review

Java String & Math Class Review

Assessment

Flashcard

Computers

9th - 12th Grade

Practice Problem

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

38 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Is String a primitive data type?

Back

No

2.

FLASHCARD QUESTION

Front

Which method to use to find length of a String?

Back

length()

3.

FLASHCARD QUESTION

Front

Which data type gets returned from length() method in String class?

Back

int

4.

FLASHCARD QUESTION

Front

What is the correct way to find the length of "txt" string? Options: int len = length(txt);, float len = txt.length();, int len = txt.length();, double len = length(txt);

Back

int len = txt.length();

5.

FLASHCARD QUESTION

Front

String txt = "Hello World";
System.out.println(txt.toUpperCase());
Choose the correct output.

Back

HELLO WORLD

6.

FLASHCARD QUESTION

Front

Choose correct purpose of indexOf() in String class.

Back

returns the index (the position) of the first occurrence of a specified text in a string (including whitespace)

7.

FLASHCARD QUESTION

Front

What is the output of the following code?
String firstName = "John ";
String lastName = "Doe";
System.out.println(firstName.concat(lastName));

Back

John Doe

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?