- Selenium
- JMeter
- DevOps
- VERSION CTRL
- ONLINE QUIZ
- Number System MCQ - 1
- Number System MCQ - 2
- Number System MCQ - 3
- Simplification MCQ - 1
- Average MCQ - 1
- Simple Interest MCQ - 1
- Compound Interest - MCQ
- Percentage - MCQ
- Ratio and Proportion - MCQ
- Profit and Loss - MCQ
- Time, Speed, and Distance - MCQ
- Time, and Work - MCQ
- Boats and Streams - MCQ
- General Knowledge Quiz - Indian Polity
- General Knowledge Quiz - History
- General Knowledge Quiz - Geography
- GK Quiz - Indian Polity - 2
- GK Quiz - Banking and Finance
- GK Quiz - Economics
- GK Quiz- Merger and Acquisition
- GK Quiz- International Bodies
- English Grammar quiz-1
- English Grammar quiz-2
- S/W PROJECT MANAGEMENT
- PROTRACTOR
- Java -Tutorials
- MORE
Java Quiz on String
This section contains a quick assessment test on Java string for interview preparation.
Instructions
Topic- Java - String
The test consists of 11 questions.
No negative marking for this test.
No Time limit
The pass percentage is 70%
The correct answer with a description will be displayed after the answer has been marked.
Submit the test to calculate your score once you are done with all the questions.
Complexity Level- Moderate
Q1: Which of the following is true for StringBuilder class?
Q2: Which of the following is true for StringBuffer class?
Q3: StringBuffer is immutable.
Select true or false
Select true or false
Q4: StringBuilder is mutable
Select true or false
Select true or false
Q5: Which of the following is true for split() method in String?
Q6: Which of the following is true for subString() method in String?
Q7: Given a string -
String str = "my name is robert";
String str2 = str.substring(3, 8);
System.out.println(str2);
What will be the output?
String str = "my name is robert";
String str2 = str.substring(3, 8);
System.out.println(str2);
What will be the output?
Q8: Identify the output of the below String operation:
String str4 = "My @name is @John";
String[] str3=str4.split("@", 5);
for(String a: str3) {
System.out.println(a);
}
String str4 = "My @name is @John";
String[] str3=str4.split("@", 5);
for(String a: str3) {
System.out.println(a);
}
Q9: What will be the output of the below code snippet?
String str = "my name is Robert";
System.out.println(str.charAt(4));
String str = "my name is Robert";
System.out.println(str.charAt(4));
Q10: Select the correct output of the below code snippet:
StringBuffer s = new StringBuffer();
s.append("Hello");
s.append("world");
String str2 = s.toString();
System.out.println(str2);
StringBuffer s = new StringBuffer();
s.append("Hello");
s.append("world");
String str2 = s.toString();
System.out.println(str2);
Q11: Select the correct output of the below code snippet:
String str3="Hello";
str3.concat("Robert");
System.out.println(str3);
String str3="Hello";
str3.concat("Robert");
System.out.println(str3);
Quick Assessment Tests on Java
Java quiz 1
Java quiz 2
Java quiz 3
Java quiz 4
Java quiz 5
Java quiz 6
Java quiz 7
Java quiz 8
Java quiz 9
Java quiz 10