51.
What will be the output of the following Java code?
class output 
{
    public static void main(String args[])
    { 
       StringBuffer s1 = new StringBuffer("Hello");
       s1.insert(1,"Java");
       System.out.println(s1);
    }
}

52.
What will be the output of the following Java code?
class output 
{
    public static void main(String args[])
    { 
       String c = "Hello i love java";
       boolean var;
       var = c.startsWith("hello");
       System.out.println(var);
    }
}

55.
What will be the output of the following Java program?
class output 
{
    public static void main(String args[])
    { 
       String c = "  Hello World  ";
       String s = c.trim();
       System.out.println("\""+s+"\"");
    }
}

56.
Which of the following statement is correct?

57.
What will be the output of the following Java program?
class output 
{
    public static void main(String args[])
    {
        String a = "hello i love java";
        System.out.println(a.indexOf('e')+" "+a.indexOf('a')+" "+a.lastIndexOf('l')+" "+a.lastIndexOf('v'));
    }
}

60.
What will be the output of the following Java code?
class output 
{
    public static void main(String args[])
    { 
       String s1 = "Hello i love java";
       String s2 = new String(s1);
       System.out.println((s1 == s2) + " " + s1.equals(s2));
    }
}

Read More Section(Strings)

Each Section contains maximum 100 MCQs question on Strings. To get more questions visit other sections.