
Strings Java
Authored by Manoj R
Computers
12th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
16 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to declare and initialize a String variable in Java?
String str; str = 'Hello';
String str = new String('Hello');
String str = "Hello";
String str = new String(); str = 'Hello';
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you concatenate two Strings in Java?
string1.append(string2)
string1.concat(string2)
string1 + string2
string1.add(string2)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the charAt method in Java return?
The length of the string
The character at the specified index
The index of the specified character
A boolean value
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you extract a substring from a String in Java?
string.extract(startIndex, endIndex)
string.getSubstring(startIndex, endIndex)
substring.extract(startIndex, endIndex)
string.substring(startIndex, endIndex)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method is used to search for a specific character in a String in Java?
searchChar()
findChar()
locateChar()
indexOf()
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you replace a specific character in a String in Java?
str.replace('a', 'b', 1);
str.replaceFirst('a', 'b');
str.replaceAll('a', 'b');
str = str.replace('a', 'b');
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which class is preferred for manipulating mutable strings in Java?
String
StringBuilder
StringBuffer
StringWriter
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
12 questions
Programming - Output
Quiz
•
KG - 12th Grade
20 questions
Round-1 Technical Aptitude
Quiz
•
11th Grade - Professi...
20 questions
Design your website
Quiz
•
7th - 12th Grade
17 questions
Project Stem Python Unit 1 Test Review
Quiz
•
9th - 12th Grade
11 questions
Servidores Web
Quiz
•
11th - 12th Grade
20 questions
UID uCertify Chapter 9 Test
Quiz
•
8th - 12th Grade
15 questions
Virtual Private Server
Quiz
•
12th Grade
20 questions
Computer Science: Chapter 2 Test Review
Quiz
•
9th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade