1) Set of Shorts (hehehe)
public class ShortSet {
public static void main(String[] args) {
Set
for(short i=0;i<100;i++){
shortSet.add(i);
shortSet.remove(i-1);
}
System.out.println("Size of Set =" + shortSet.size()) ;
}
}
The choices are
1)1
2)100
3) Throws an exception
4) None of the above
2)Racy little number
public class Test extends TestCase {
int number;
public void test()throws InterruptedException{
number=0;
Thread t=new Thread(new Runnable(){
public void run(){
assertEquals(2, number);
}
});
number=1;
t.start();
number++;
t.join();
}
}
What is the outcome of this test
1) Passes Sometimes
2)Fails Sometimes
3)Always passes
4) Always hangs