Monday, February 6, 2012

SCJP model question answer pagr 8


70)
if(0.0 == -0.0) {
  System.out.println("true");
}
else{
    System.out.println("false");
}

prints false

prints true

Ans: 2

71)
class C {
public static void main(String[] args) {
double d1 = Math.floor(0.5);
double d2 = Math.floor(1.5);
System.out.print(d1 + "," + d2);
}}

Prints: 0.0,1.0

Prints: 0.0,2.0

Prints: 1.0,1.0

Prints: 1.0,2.0

None of the above

Ans: 1


72)
System.out.println("String".substring(0,4));
This statement will Print

will print "Strin"

will print "Stri"

will cause compiler error

none of the above

Ans: 2


73)
if("String".replace('t','T') == "String".replace('t','T'))
System.out.println("Equal");
else
System.out.println("Not Equal");

will Print Equal

will Print Not Equal

compile time error

none of the above

Ans: 2


74)
Which of the following classes  will not allow unsynchronized read operations by multiple threads?

Vector

TreeMap

TreeSet

HashMap

HashSet

Ans: 1

75)
StringBuffer objects once created can not be modified

true

false

Ans: 2

No comments:

Post a Comment