Logo

Java Questions Set 152:

Quiz Mode

Which keyword is used to access the current object?

1
2
3
4

Solution:

Which character encoding technique is used by the isDefined() method?

1
2
3
4

Solution:

Which of these methods is used to get the x-coordinate of the mouse?

1
2
3
4

Solution:

Which of the following is the method of the Integer wrapper class to convert the value of an object into an int?

1
2
3
4

Solution:

Which of the following is FALSE about arrays on Java

1
2
3

Solution:

What will be the output of the following Java code?

class isNaN_output

{

public static void main(String args[])

{

Double d = new Double(1 / 0.);

boolean x = d.isNaN();

System.out.print(x);

}

}

1
2
3
4

Solution:

Which is the correct output?

public class abekus

{

public static void sum(int a, int b){

    System.out.print(a+b+" ");

  }

public static void main(String[] args) {

sum(10,10);

sum(-11,-11);

}

}

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:

Predict the output of the following Java code:

import java.util.Scanner;

public class MyClass

{

public static void main(String args[])

{

StringBuffer str1 = new StringBuffer("Engineer");

str1.deleteCharAt(5);

System.out.println(" " + str1);

}

}

1
2
3
4

Solution:

import java.util.*;

    public class outputs 

    {

        public static void main(String args[]) 

        {

            LinkedList list = new LinkedList();

            list.add(new Integer(2));

            list.add(new Integer(8));

            list.add(new Integer(5));

            list.add(new Integer(1));

            Iterator i = list.iterator();

            Collections.reverse(list);

            while(i.hasNext())

       System.out.print(i.next() + " ");

        }

    }

1
2
3
4

Solution: