Java Quiz: Strings & String Methods

This Java strings quiz tests the String methods you use every day and the traps around them. You will predict the output of substring, indexOf and split, compare strings the right way and see why strings never change in place.

आसान 10 सवाल ~5 मिनट पास होने के लिए 80% Java 17

मोड चुनें

आप गेस्ट के तौर पर खेल रहे हैं: XP और streak सेव रखने के लिए साइन इन करें।

सैंपल सवाल

सवाल 1 / 10

What does this print?

public class Main {
    public static void main(String[] args) {
        String s = "Hello";
        s.toUpperCase();
        System.out.println(s);
    }
}
जवाब दिखाएं

B. Hello Strings are immutable: toUpperCase() returns a new string and leaves s alone. The result is thrown away here; write s = s.toUpperCase(); to keep it.

इस क्विज़ में क्या है

  • Strings are immutable
  • == vs equals() and equalsIgnoreCase()
  • substring, indexOf, charAt and their index rules
  • split and empty trailing strings
  • Concatenating null and using StringBuilder

अक्सर पूछे जाने वाले सवाल

क्या अकाउंट ज़रूरी है?

नहीं। कोई भी खेल सकता है। XP, streak, badge और हिस्ट्री सेव रखने के लिए साइन इन करें।

क्या मैं इसे दोबारा दे सकता हूं?

हां। आपका बेस्ट स्कोर सेव रहता है, और हर बार सवाल और जवाब शफ़ल होते हैं।