
Strings Java

Quiz
•
Computers
•
12th Grade
•
Hard
Manoj R
Used 1+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Arrays in Java

Quiz
•
9th - 12th Grade
20 questions
3rd Qtr QUIZ1 COMPUTER PROGRAMMING-Strings in Java-2-22-2023

Quiz
•
12th Grade
20 questions
JAVA FUNDAMENTALS

Quiz
•
9th - 12th Grade
15 questions
JAVA: Level-1

Quiz
•
5th - 12th Grade
13 questions
Unit 4 AP CSA Review

Quiz
•
12th Grade
19 questions
Java Base

Quiz
•
9th - 12th Grade
20 questions
Java String Quiz

Quiz
•
1st Grade - University
13 questions
APCSA Unit 3 Review

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade