81.
What will be the output of the following Java program?
class output 
{
    public static void main(String args[])
    {
       String s1 = "Hello World";
       String s2 = s1.substring(0 , 4);
       System.out.println(s2);
    }
}

83.
What will be the output of the following Java program?
class String_demo 
{
    public static void main(String args[])
    {
        int ascii[] = { 65, 66, 67, 68};
        String s = new String(ascii, 1, 3);
        System.out.println(s);
    }
}

84.
Which of these is an incorrect statement?

85.
What will be the output of the following Java program?
class output 
{
    public static void main(String args[])
    {             String s = "Hello World";
         int i = s.indexOf('o');
         int j = s.lastIndexOf('l');
         System.out.print(i + " " + j);

    }
}

87.
What will be the output of the following Java program?
class output 
{
   class output 
   {
     public static void main(String args[])
     {
        char c[]={'A', '1', 'b' ,' ' ,'a' , '0'};
        for (int i = 0; i < 5; ++i)
        {
               i++; 
               if(Character.isDigit(c[i]))
                   System.out.println(c[i]+" is a digit");
               if(Character.isWhitespace(c[i]))
                   System.out.println(c[i]+" is a Whitespace character");
               if(Character.isUpperCase(c[i]))
                   System.out.println(c[i]+" is an Upper case Letter");
               if(Character.isLowerCase(c[i]))
                   System.out.println(c[i]+" is a lower case Letter");
               i++;
        }
    }
}

89.
What will be the output of the following Java code?
class output 
{
    public static void main(String args[])
    {
        char c[]={'a', '1', 'b' ,' ' ,'A' , '0'};
        for (int i = 0; i < 5; ++i)
        {
               if(Character.isDigit(c[i]))
                   System.out.println(c[i]+" is a digit");
               if(Character.isWhitespace(c[i]))
                   System.out.println(c[i]+" is a Whitespace character");
               if(Character.isUpperCase(c[i]))
                   System.out.println(c[i]+" is an Upper case Letter");
               if(Character.isLowerCase(c[i]))
                   System.out.println(c[i]+" is a lower case Letter");
           i=i+3;
        }
    }
}

90.
What will be the output of the following Java program?
class output 
{
    public static void main(String args[])
    { 
         StringBuffer c = new StringBuffer("Hello");
         c.delete(0,2);
         System.out.println(c);
    }
}

Read More Section(Strings)

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