1. What will be printed as the output of the following program?

public class testincr
                {
                public static void main(String args[])
                {
                int i = 0;
                i = i++ + i;
                System.out.println(“I = ” +i);
                }
                }
                




2.Which Set class should be most popular in a multi-threading environment, considering performance constraint?





3.What is the output of the following program?

                public class testmeth
                {
                static int i = 1;
                public static void main(String args[])
                {
                System.out.println(i+” , “);
                m(i);
                System.out.println(i);
                }
                public void m(int i)
                {
                i += 2;
                }
                }
                
               




4. Which Map class should be most popular in a multi-threading environment, considering performance constraint ?





5. Which allows the removal of elements from a collection?






6.Which offers the best performance?





7.Which of these is the most popularly used class as a key in a HashMap?





8. Iterator returned by ArrayList is?





9.Which of the following statements about Java Threads is correct?






10.Among these expressions, which is(are) of type String?






11.Consider the two methods (within the same class)?

public static int foo(int a, String s)
{
s = “Yellow”;
a=a+2;
return a;
}
public static void bar()
{
int a=3;
String s = “Blue”;
a = foo(a,s);
System.out.println(“a=”+a+” s=”+s);
}
public static void main(String args[])
{
bar();
}

            





12.The method setValue assigns the value of i to the instance field value. What could you write for the implementation of setValue?

public class MyClass
{
private int value;
public void setValue(int i){ / code / }
// Other methods…
}

            





13.To instantiate MyClass, you would write?

public class MyClass
{
public MyClass(){/code/}
// more code…
}

            




14.What is the output of the following code:?

class eq
{
public static void main(String args[])
{
String s1 = “Hello”;
String s2 = new String(s1);
System.out.println(s1==s2);
}
}

            




15.Use the following declaration and initialization to evaluate the Java expressions?

                int a = 2, b = 3, c = 4, d = 5;
                float k = 4.3f;
                System.out.println( – -b * a + c *d – -);