please explian , thanks!
1.The 8859-1 character code for the uppercase letter A is 65. Which of these code fragments declare and initialize a variable of type char with this value?
A]char ch = 65
B]char ch ='\65'
C]char ch ='\0041'
D]char ch ='A'
E]char ch ="A"
2. 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 {}
A]obj instanceof B
B]obj instanceof A &&!(obj instanceof C)
C]obj instanceof B &&!(obj instanceof C)
D]obj instanceof C | | obj instanceof D
E]obj instance of A) &&!(obj instanceof C) &&!(obj instanceof D
3.Given the following code, which statements concerning the objects referenced through the member variables i, j and k are true, given that any
thread may call the methods a, b and c at any time?
class Counter {
int v = 0;
synchronized void inc() { v++; }
synchronized void dec() { v--; }
}
public class Q7ed5 {
Counter i;
Counter j;
Counter k;
public synchronized void a() {
i.inc();
System.out.println("a");
i.dec();
}
public synchronized void b() {
i.inc(); j.inc(); k.inc();
System.out.println("b");
i.dec(); j.dec(); k.dec();
}
public void c() {
k.inc();
System.out.println("c");
k.dec();
}
}
A]i.v is guarenteed to be 0 or 1
B]j.v is guarenteed to be 0 or 1
C]k.v is guarenteed to be 0 or 1
D]j.v will always be greater than or equal to k.v at any given time
E]k.v will always be greater than j.v at any given time
4. Which statements are true concerning the effect of the >> and >>> operators?
A]For non negative values fo the left oprerand the >> and >>> operators will have the same effect
B]The result of (-1>>1) is 0
C]The result of -1>>>1 is -1
D]The value returned by >>> will never be negative as long as the value of the right operand is equal to or greater than 1
E]When using the >> operator, the leftmost bit of the bit representation of the resulting value will always be the same bit value as the left
5. What will be the result of attempting to compile and run the following code?
public class Q6b0c {
public static void main(
String args[]) {
int i = 4;
float f = 4.3;
double d = 1.8;
int c = 0;
if (i == f) c++;
if (((int) (f + d)) == ((int) f + (int) d)) c += 2;
System.out.println(c);
}
}
A] It will not compile
B]0
C]1
D]2
E]3
6. Which one of these are valid at position 1?
public class Q6db8 {
int a;
int b = 0;
static int c;
public void m() {
int d;
int e = 0;
// Position 1
}
}
A]a++
B]b++
C]c++
D]d++
E]e++