B4 - More about Strings

B4 - More about Strings

University

16 Qs

quiz-placeholder

Similar activities

R STARTER

R STARTER

University

20 Qs

2R C-Skill Lab Test Autumn 2024-25

2R C-Skill Lab Test Autumn 2024-25

University

14 Qs

Основы Python

Основы Python

University

19 Qs

Tech quiz Round 1

Tech quiz Round 1

University

15 Qs

Python Basics

Python Basics

University

11 Qs

IEEE Coding Competition

IEEE Coding Competition

University

13 Qs

Algo-Unlock

Algo-Unlock

University

20 Qs

JAVA FUNDAMENTALS

JAVA FUNDAMENTALS

University

12 Qs

B4 - More about Strings

B4 - More about Strings

Assessment

Quiz

Other

University

Easy

Created by

Ahmetcan türk

Used 7+ times

FREE Resource

16 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following write?

String str = "Hello World!" ;

str.substring(6);

System.out.println( str );

World!

Hello

Hello World!

The fragment will not compile.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Examine this code:

String str = "Hello World!" ;

System.out.println( str.substring(6) );

What will it write?

World!

Hello

Hello World!

The fragment will not compile.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Examine this code:

String str = "Hello World!" ;

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

What will it write?

0

10

11

12

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Examine this code:

String myString = "";

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

What what will it write?

0

1

2

the code will not compile

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Examine this code:

String str = "Hello\tWorld!" ;

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

What will it write?

0

10

11

12

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Examine this code:

String str = "Hello World!" ;

What is the index of the character 'W' ?

0

5

6

7

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Examine this code:

String str = "One Fine Day" ;

String val = str.substring(4) ;

System.out.println( val );

What does the fragment print?

One Fine Day

Fine Day

Day

One Fine

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?