Q40
Which of these statements concerning the collection interfaces are true?
1) Set extends Collection.
2) All methods defined in Set are also defined in Collection.
3) List extends Collection.
4) All methods defined in List are also defined in Collection.
5) Map extends Collection.
Q41
What is the name of the method that threads can use to pause their execution until signalled to continue by another thread?
Fill in the name of the method (do not include a parameter list).
Q42
Given the following class definitions, which expression identifies whether the object referred to by obj was created by instantiating class B rather than classes A, C and D?
class A {}
class B extends A {}
class C extends B {}
class D extends A {}
1) obj instanceof B
2) obj instanceof A && ! (obj instanceof C)
3) obj instanceof B && ! (obj instanceof C)
4) obj instanceof C || obj instanceof D
5) (obj instanceof A) && ! (obj instanceof C) && ! (obj instanceof D)
Q43
What will be written to the standard output when the following program is run?
public class Q8499 {
public static void main(String args[]) {
double d = -2.9;
int i = (int) d;
i *= (int) Math.ceil(d);
i *= (int) Math.abs(d);
System.out.println(i);
}
}
1) 12
2) 18
3) 8
4) 12
5) 27
Q44
What will be written to the standard output when the following program is run?
public class Qcb90 {
int a;
int b;
public void f() {
a = 0;
b = 0;
int[] c = { 0 };
g(b, c);
System.out.println(a + " " + b + " " + c[0] + " ");
}
public void g(int b, int[] c) {
a = 1;
b = 1;
c[0] = 1;
}
public static void main(String args[]) {
Qcb90 obj = new Qcb90();
obj.f();
}
}
1) 0 0 0
2) 0 0 1
3) 0 1 0
4) 1 0 0
5) 1 0 1