Search Header Logo

Java String Quiz

Authored by M. R.

Computers

1st Grade - University

Used 17+ times

Java String Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the type of objects that can store a sequence of characters in Java?

Character

String

Array

Text

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used for both addition and concatenation in Java?

/

-

*

+

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create a string using the new keyword in Java?

String str = new String[];

String str = String.new();

String str = new String("");

String str = new String();

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What escape character is used to insert a double quote in a string?

\"

\'

\\

\n

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the result of the following code:

String x = "50";

int y = 20;

String z = x + y;

50.20

50

5020

70

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which escape sequence represents a new line in Java?

\b

\r

\t

\n

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code:

String str = "Hello";

System.out.println(str.length());

5

4

Null

6

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?

Discover more resources for Computers