Logo

Java Questions Set 124:

Quiz Mode

Array list, Linked list and Vector are __________.

1
2
3
4

Solution:

Which of the following method is used to get the length of string?

1
2
3
4

Solution:

What will be the output of the following program?

int a , b , c;

a = 1 ;

b = 2 ;

a = b = c = 3 ;

System.out.print(a);

1
2
3
4

Solution:

 

public class j 

{

public static void main(String args[])

String s1 = new String("Java");

String s2 = new String("HTML");

System.out.println(s1.concat(s2));

}

}

1
2
3
4

Solution:

 Not a run time exception......

Statement 1- Arithmetic Exception

Statement 2- Arraystore Exception

Statement 3- illigalargument Exception

Statement 4 - AWT Exception

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

   int x=10,y=15;

   if(x++<=10 || ++y>15)

   {

       x++;

   }

   else

   {

       y--;    

   }

   System.out.println(x+" "+y);

}

}

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

  int x=10;

  if(++x<10 && x/0>10)

  System.out.println("Hello");

  else

  System.out.println("Hi");

}

}

1
2
3
4

Solution:

What is the output of the following code?

 class output 

    {

        public static void main(String args[])

        { 

           String str = "Hello i love java";

           boolean var;

           var = str.startsWith("hello");

           System.out.println(var);

        }

    }

1
2
3
4

Solution:

What will be the output of the following code?

 class Out

    {

        public static void main(String args[])

        {

            int arr1[] = new int[10];

            int arr2[] = {1, 2, 3, 4, 5};

            System.out.println(arr1.length + " " + arr2.length);

        } 

    }

1
2
3
4

Solution:

What will be the output of the following code?


class A

    {

        public static void main(String args[])

        {

   String a = "abekus";

            String b = "world";   

            String c = "abekus";

            System.out.println(a.equals(b) + " " + a.equals(c));  

        }

   }

1
2
3
4

Solution: