1.
What is the output of the following Java code:
public class Test {
    public static void main(String[] args) {
        int j = 2, y = 3, z = 10;
        for (; j < 6; j++) {
            y = (++y + z++);
            System.out.println(y + z);
        }
    }
}
2.
What is the output of the following Java code:
class A1 {
    public int i;
    protected int j;
}


class B2 extends A1 {
    int j;

    void display() {
        super.j = 3;
        super.i = 10;
        System.out.println(i + " " + j);
    }
}

public class TestClass {

    public static void main(String args[]) {

        B2 obj = new B2();
        obj.i = 1;
        obj.j = 2;
        obj.display();
    }
}
3.
In Java, which of the following is an unchecked exception?
4.
What is the output of the following Java code:
import java.util.*;
class TestClass {
    public static void main(String args[]) throws Exception {
        Stack s = new Stack();
        s.push("A");
        s.push("B");
        System.out.println(s);
        System.out.println(s.search("Z"));
        System.out.println(s.isEmpty());
    }
}
5.
In Java, which of the following methods is inherited from the AbstractMap class?
6.
What is the output of the following Java code:
class TestClass {
    public static void main(String args[]) throws Exception {

        try {
            int a = 5;
            int b = 0;
            int c = a / b;
            System.out.println(c);
        } catch (Exception e) {
            System.out.print("There is an error");
        } finally {
            System.out.println("There is no error");
        }
    }
}
7.
In Java, which of the following commands is used to create an empty TreeSet object?
8.
What is the output of the following Java code:
import java.util.*;
class Test {
    public static void main(String args[]) throws Exception {
        TreeSet t = new TreeSet();
        t.add(new StringBuffer("H"));
        t.add(new StringBuffer("A"));
        t.add(new StringBuffer("C"));
        t.add(new StringBuffer("K"));
        System.out.println(t);
    }
}
9.
What is the output of the following Java code:
class con {
    public static void main(String args[]) {
        double a = 295.04;
        int b = 300;
        byte c = (byte) a;
        byte d = (byte) b;
        System.out.println(c + " " + d);
    }
}
10.
What is the output of the following Java code:
class Sample {
    public static void main(String args[]) {
        int a = 1;
        int b = 2;
        int c;
        int d;
        c = ++b;
        d = a++;
        c++;
        b++;
        System.out.println(a + " " + b + " " + c);
    }
}