Java Strings

Quiz
•
Computers
•
9th - 12th Grade
•
Hard
ELIZABETH DIERKER
Used 503+ times
FREE Resource
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
Similar Resources on Wayground
10 questions
10 câu kiểu xâu tiết 1

Quiz
•
11th Grade
16 questions
Database Query

Quiz
•
11th - 12th Grade
12 questions
Python Basic

Quiz
•
10th Grade
16 questions
Java Chapter 1 CS2

Quiz
•
9th - 12th Grade
10 questions
Программирование C#

Quiz
•
1st - 10th Grade
16 questions
Python Beginner

Quiz
•
9th - 10th Grade
10 questions
Unit 1 Post Test: Basic Python

Quiz
•
9th - 12th Grade
11 questions
#124 Unit 2 Lesson 6 Variables

Quiz
•
11th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
30 questions
Introduction to Computers

Quiz
•
8th - 9th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade