1.
What is the output of the following Java code:
class operator {
    public static void main(String args[]) {
        boolean a = true;
        boolean b = !true;
        boolean c = a | b;
        boolean d = a & b;
        boolean e = d ? b : c;
        System.out.println(e);
    }
}
2.
In Java, which of the following statements is correct?
3.
What is the output of the following Java code:
import java.util.*;
class Test {
    public static void call(Exception e) {
        System.out.println("Exception");
    }
    public static void call(NullPointerException e) {
        System.out.println("NullPointer");
    }
    public static void call(Object e) {
        System.out.println("Object");
    }
    public static void main(String args[]) {
        call(null);
    }

}
4.
What is the output of the following Java code:

import java.util.*;
public class Test {

    public static void main(String[] args) {
        Integer a = new Integer(4);
        Integer b = new Integer(8);
        Integer c = new Integer(4);
        TreeSet ts = new TreeSet();
        ts.add(a);
        ts.add(b);
        ts.add(c);
        System.out.println(ts);
    }
}
5.
What is the output of the following Java code:

import java.util.*;
interface A {
    public void method1();
}
class One implements A {
    public void method1() {
        System.out.println("Code");
    }
}
class Two extends One {}
public class Test extends Two {
    public static void main(String[] args) {
        A a;
        Two t = new Two();
        a = t;
        a.method1();
    }
}
6.
What is the output of the following Java code:

import java.util.*;
public class X {
    public static void main(String[] args) {
        try {
            badMethod();
            System.out.print("A");
        } catch (Exception ex) {
            System.out.print("B");
        } finally {
            System.out.print("C");
        }
        System.out.print("D");
    }
    public static void badMethod() {}
}
7.
In Java, which of the following methods registers a thread in a thread scheduler:

  1. construct();

  2. run();

  3. start();

  4. register();


  5.  
8.
In Java, which of the following is used to stop the execution of a thread?
9.
In Java, which of the following are valid constructors of the Thread class:

  1. Thread(Runnable r, String name)
  2. Thread()
  3. Thread(int priority)
  4. Thread(Runnable r, ThreadGroup g)
  5. Thread(Runnable r, int priority)

  6.  
10.
In Java, which of the following statements is true?