Logo

Java Questions Set 145:

Quiz Mode

PipedInputStream is a type of byte stream

1
2

Solution:

Which of the following Java methods will directly stop the execution of a Thread?

1
2
3
4

Solution:

Which Java access modifier means a variable cannot be accessed outside the class it is defined in?

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

   int a=3^4;

   int b=~4;

   System.out.println(b|~a);

}

}

1
2
3
4

Solution:

The process of defining a method more than once but differentiated by method signatures - 

1
2
3
4

Solution:

Which of the following is correct?

1
2
3
4

Solution:

Which construct creates an anonymous inner class instance?

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

        byte x = (byte)256;

             int i;

             byte y; 

             i = x>>2;

             y = (byte) (x <<2);

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

}

}

1
2
3
4

Solution:

public class outputs 

    {

        static int math(int x){

          return x*x%32+x*x%5+ ++x*x%10;

 

        } 

public static void main(String args[]){ 

    int result=outputs.math(12);

 System.out.println(result);

}

}

1
2
3
4

Solution:

What will be the output of the following Java code?


class Abekus {

    public static void main(String args[]) {

        int arr[] = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

        int n = 6;

        n = arr[arr[n] / 2];

        System.out.println(arr[n] / 2);

   } 

}

1
2
3
4

Solution: