
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
15 questions
JAVA: Level-1

Quiz
•
5th - 12th Grade
20 questions
Arrays in Java

Quiz
•
9th - 12th Grade
20 questions
JAVA FUNDAMENTALS

Quiz
•
9th - 12th Grade
20 questions
1TEC_AVALIAÇÃO LÓGICA COMPUTACIONAL 3º TRI_AV5

Quiz
•
12th Grade - University
15 questions
PYTHON PROGRAMMING

Quiz
•
11th - 12th Grade
21 questions
CodeHS JavaScript

Quiz
•
8th - 12th Grade
18 questions
AP CSA U1L01-03

Quiz
•
11th - 12th Grade
15 questions
Python Programming 1: print, strings, variables, casting

Quiz
•
9th Grade - University
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
20 questions
Digital Citizenship

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

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

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

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade