Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java
Absolutely! Are you ready to put your Java string skills to the ultimate test? Buckle up and prepare to embark on a thrilling adventure with this interactive quiz! Packed with challenging questions, it’s designed to fully assess your grasp of string manipulation, methods, and those core concepts that make you a string master. No matter if you’re a seasoned Java developer or just beginning your coding journey, this quiz is a guaranteed blast.
It’s the perfect way to solidify your existing knowledge, pinpoint areas where you can shine even brighter, and ultimately unlock your true string mastery! So, are you ready to dive in and conquer this string challenge? Let’s test your knowledge of Java String.
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 15
1. Question
- class Sample {
public static void main ( String args [ ] )
{
String text = “DataFlair”;
system.out.println(text.length());
}
}
CorrectIncorrect -
Question 2 of 15
2. Question
class Example {
public static void main ( String args [ ] )
{
String s = new String();
system.out.println(s);
}
}
CorrectIncorrect -
Question 3 of 15
3. Question
class StringExample {
public static void main ( String args [ ] )
{
Char data[] = { “h” , “e” , “l” , “o” , “o” };
String s = new String(data);
system.out.println(s);
}
}
CorrectIncorrect -
Question 4 of 15
4. Question
class StringProgram {
public static void main ( String args [ ] )
{
String one = “Data”;
Char a = { ‘F’ , ‘l’ , ‘a’, ‘i’, ‘r’ };
String two = new String(a);
system.out.println(one.concat(two));
}
}
CorrectIncorrect -
Question 5 of 15
5. Question
Which of the following is not a way to declare a string in Java ?
CorrectIncorrect -
Question 6 of 15
6. Question
class CompareExample {
public static void main ( String args [ ] )
{
String First = “Data”;
String Second = “Flair”;
if(First.isequals(Second) {
system.out.println(“These two strings are equal”);
} else {
system.out.println(“These two strings are not equal”);
}
}
}
CorrectIncorrect -
Question 7 of 15
7. Question
class SplitExample {
public static void main ( String args [ ] )
{
String datas = “DataFlair , ”webservices”;
String data[] = datas.split(“,”);
system.out.println(Arrays.toString(data));
}
}
CorrectIncorrect -
Question 8 of 15
8. Question
Which of the following is the correct syntax to compare two strings ?
CorrectIncorrect -
Question 9 of 15
9. Question
class TrimExample {
public static void main ( String args [ ] )
{
String text = “Hello World !”;
String originalvalue = text.trim();
system.out.println(originalvalue.length());
}
}
CorrectIncorrect -
Question 10 of 15
10. Question
class UpperCase {
public static void main( String args [ ] )
{
String data = “dataflair”;
String a = data.charAt(0).toUpperCase();
String b = data.charAt(1);
String c = data.charA(2);
String d = data.charAt(3);
String e = data.charAt(4).toUppercase();
String f = data.charAt(5);
String g = data.charAt(6);
String h = data.charAt(7);
String i = data.charAt(8);
system.out.println(a+b+c+d+e+f+g+h+i);
}
}
CorrectIncorrect -
Question 11 of 15
11. Question
class Index {
public static void main ( String args [ ] )
{
String s = “World”;
int a = s.indexof(‘r’);
system.out.println(a);
}
}
CorrectIncorrect -
Question 12 of 15
12. Question
class GetBytes {
public static void main ( String args [ ] )
{
String text = “ABCD”;
int a = text.charAt(3).getBytes();
system.out.println(a);
}
}
class GetBytes {
public static void main ( String args [ ] )
{
String text = “ABCD”;
int a = text.charAt(3).getBytes();
system.out.println(a);
}
}
CorrectIncorrect -
Question 13 of 15
13. Question
Which of the following methods in Java is used to return a formatted output?
CorrectIncorrect -
Question 14 of 15
14. Question
class AddingString {
public static void main (String args [ ] )
{
String a = “9”;
String b = “9”;
String c = a + b ;
system.out.println(c);
}
}
CorrectIncorrect -
Question 15 of 15
15. Question
Why toChararray() method used in Java?
CorrectIncorrect
Summary:
Conquering those challenges on the Java strings quiz is a fantastic first step! Now that you’ve aced that hurdle, it’s all about keeping the momentum going to truly master this essential Java building block. Remember, just like building muscles, strengthening your Java skills takes dedication and consistent practice.
To really dive deep and solidify your understanding, explore the treasure trove of Java tutorials and courses we offer. These resources will provide in-depth knowledge, taking you beyond the basics and unlocking the full potential of Java strings.
But the learning doesn’t stop there! We’ll keep the fun and challenge rolling with even more interactive quizzes designed to push your boundaries and solidify your programming skills. So buckle up and get ready for an amazing Java strings adventure!
