Top 10 Output questions from String Handling Class 10 ICSE

 HERE, is a list of 10 best questions from String Handling for Class 10 students to practice the output questions and enhance their concepts of strings.

1) System.out.println("Chennai".toUpperCase());

        System.out.println("America".substring(0,4));

        System.out.println("Good".equals("good"));

        String s = "this is your last chance";

        System.out.println(s.length());

OUTPUT:

CHENNAI

Amer

false

24

2)  System.out.println("xyzv".indexOf('z'));

        System.out.println("L".toLowerCase());

        System.out.println("India".compareTo("country"));

OUTPUT:

2

l

-26

3) String a = "Java" , b = "Programming";

       System.out.println(a+b);

       System.out.println(a.substring(3));

       System.out.println(a.equals(b));

       System.out.println(a.charAt(2));

       System.out.println(b.charAt(6));

       OUTPUT:

JavaProgramming

a

false

v

m

4) System.out.println("ComPUter".toUpperCase());

       System.out.println("Continent".charAt(6));

       System.out.println("My Favourite Comic".length());

       System.out.println("Great".indexOf('a'));

       System.out.println("king".equalsIgnoreCase("King"));

       String st = "Happy".concat("Journey");

       System.out.println(st);

OUTPUT:

COMPUTER

e

18

3

true

HappyJourney

5) void test (String s)

       {

       String st = s + "EFG";

       System.out.println("s = "+s);

       System.out.println("st = "+ st);

       

    }

INPUT: ASKRIS

OUTPUT:

ASKRIS

ASKRISEFG

6)String x = "hello", y = "world";

    System.out.println(x+y);

    System.out.println(x.length());

    System.out.println(x.charAt(4));

    System.out.println(x.equalsIgnoreCase(y));

    System.out.println(x.equals(y));

OUTPUT:

helloworld

5

o

false

false

7) String s = "GRaceFuL";

    for(int i = 0; i <s.length(); i+=2)

    {

        System.out.print(s.charAt(i)+ " ");

}

OUTPUT:

G   a  e  u

8) public void show()

    {

    String val = " Cherishing";

    for(int i = 0; i<val.length(); i++)

    {

        for(int j = 0; j < 2; j++)

        {

            System.out.print(val.charAt(i)+ " \t");

            

}

}

}

OUTPUT:

C   C   h   h   e    e   r   r   i   i   s  s   h   h   i   i   n   n   g    g

9)  public void show()


    {  

        String str = "APPS";

        for(int i = 0; i< str.length(); i++)

        {

            for(int j = 0; j<=i; j++)

            {

                System.out.print(str.charAt(j));

            }

            System.out.print("\n");

}

}

OUTPUT:

AP

APP

APPS

10)  public void show()

    {  

        String st = "COLLEGE";

        for(int i = 0; i< st.length(); i++)

        {

            for(int j =0; j <= i; j++)

            {

                System.out.print(st.charAt(i));

            }

            System.out.print("\n");

        }

    }

OUTPUT:

C

OO

LLL

LLLL

EEEEE

GGGGGG

EEEEEEE

Hope you guys liked it.

Thank you for visiting our page please share it with your friends and leave a comment.

Follow https://askrisfor.blogspot.com/ for more such updates.


Comments

Popular Posts