1.
What is the result of the piece of code below?
 
public class Test {
    public static void main(String args[]) {
        Person p = new Student();
        p.talk();
    }
}
2.
What is the output of the following Java code:
class Men {
    public int number;
}

public class Test {
    public void doIt(int i, Men p) {
        i = 5;
        p.number = 8;
    }

    public static void main(String args[]) {
        int x = 0;
        Men p = new Men();
        new Test().doIt(x, p);
        System.out.println(x + " " + p.number);
    }
}
3.
In Java, how is an object serialized?
4.
What is the output of the following Java code:
class A {
    final public int GetResult(int a, int b) {
        return 0;
    }
}
class B extends A {
    public int GetResult(int a, int b) {
        return 1;
    }
}
public class Test {
    public static void main(String args[]) {
        B b = new B();
        System.out.println("x = " + b.GetResult(0, 1));
    }
}
5.
The following C segment is equivalent to ______________________.
 
if (x < 0)
    flag = 0;
else
    flag = 1;
6.
What is the output of the following Java program:
public class X {
    public static void badMethod() {

    }
    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");
    }
}
7.
What is the output of the following code snippet:
class Example {
    public static void main(String args[]) {
        int num = 100;
        if (NUM < 1000) {
            System.out.println("Output = " + num);
        }
    }
}
8.

The following OOP code is an example of _______________ inheritance.

 
    class M : public N, public P
    {}
9.
What is the output of the following code snippet:
class Example {
    public static void main(String args[]) {
        int num = 100;
        if (NUM < 1000) {
            System.out.println("Output = " + num);
        }
    }
}
10.
Abstract classes are used in OOP ___________________________________.