Java Strings

Java Strings

9th - 12th Grade

12 Qs

quiz-placeholder

Similar activities

C-Programming Basics

C-Programming Basics

12th Grade

16 Qs

conditional constructs in Java

conditional constructs in Java

10th Grade

10 Qs

Kuis tipedata, flowchart informatima kelas X j4njang SMA

Kuis tipedata, flowchart informatima kelas X j4njang SMA

9th - 12th Grade

10 Qs

conditional and iterative statements

conditional and iterative statements

11th Grade

10 Qs

End of term assessment

End of term assessment

9th Grade

15 Qs

BTEC Level 3 Nat Ext Dip in Computing - Unit 2.1 Hardware and Software

BTEC Level 3 Nat Ext Dip in Computing - Unit 2.1 Hardware and Software

11th - 12th Grade

10 Qs

Xcode and Playgrounds

Xcode and Playgrounds

9th - 11th Grade

9 Qs

Quiz 3-  Life Cycle of Program

Quiz 3- Life Cycle of Program

10th Grade

10 Qs

Java Strings

Java Strings

Assessment

Quiz

Computers

9th - 12th Grade

Practice Problem

Hard

Created by

ELIZABETH DIERKER

Used 512+ times

FREE Resource

AI

Enhance your content in a minute

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

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

int len = "jump it!".length();


What is the value of len?

8

7

9

6

This code does not compile.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int x = "quarantine".indexOf("a");


What is the value of x?

4

3

2

This code does not compile.

StringIndexOutOfBoundsException

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

String s = "whatever".substring(1,4);


What is the value of s?

"hate"

"hat"

"whate"

"what"

StringIndexOutOfBoundsException

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

String s1 = "hello";

String s2 = new String("hello");

if (s1 == s2) System.out.print("Hey");

else System.out.print("Yo");


What is the output?

Hey

Yo

There is no output.

This code will not compile.

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

int p = "Go Paw Patrol!".indexOf("p");


What is the value of p?

0

4

3

-1

This code will not compile.

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

String s = "cool cat".substring(6);


What is the value of s?

"cat"

"at"

"cool c"

This code does not compile.

StringIndexOutOfBoundsException

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

int x = "Mary".compareTo("Molly");

if (x>=0) System.out.print("Yes");

else System.out.print("No");


What is the output?

Yes

No

There is no output.

This code will not compile.

Create a free account and access millions of resources

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?