AllExam Dumps

DUMPS, FREE DUMPS, VCP5 DUMPS| VMWARE DUMPS, VCP DUMPS, VCP4 DUMPS, VCAP DUMPS, VCDX DUMPS, CISCO DUMPS, CCNA, CCNA DUMPS, CCNP DUMPS, CCIE DUMPS, ITIL, EXIN DUMPS,


READ Free Dumps For Oracle- 1z0-803





Question ID 21939

Given the code fragment:
System.out.println ("Result:" +3+5);
System.out.println ("result:" + (3+5));
What is the result?

Option A

Result: 8
Result: 8

Option B

Result: 35
Result: 8

Option C

Result: 8
Result: 35

Option D

Result: 35
Result: 35

Correct Answer B
Explanation Explanation: In the first statement 3 and 5 are treated as strings and are simply concatenated. In the first statement 3 and 5 are treated as integers and their sum is calculated.


Question ID 21940

Given:
public class Main {
public static void main(String[] args) throws Exception { doSomething();
}
private static void doSomething() throws Exception {
System.out.println("Before if clause");
if (Math.random() > 0.5) {
throw new Exception();
}

System.out.println ("After if clause");
}

}
Which two are possible outputs?

Option A

Before if clause
Exception in thread "main" java.lang.Exception
At Main.doSomething (Main.java:8)
At Main.main (Main.java:3)

Option B

Before if clause
Exception in thread "main" java.lang.Exception
At Main.doSomething (Main.java:8)
At Main.main (Main.java:3)
After if clause

Option C

Exception in thread "main" java.lang.Exception
At Main.doSomething (Main.java:8)
At Main.main (Main.java:3)

Option D

Before if clause
After if clause

Correct Answer A,D
Explanation Explanation: The first println statement, System.out.println("Before if clause");, will always run. If Math.Random() > 0.5 then there is an exception. The exception message is displayed and the program terminates. If Math.Random() > 0.5 is false, then the second println statement runs as well. Incorrect answers: B: The second println statement would not run. C: The first println statement will always run.

Send email to admin@getfreedumps for new dumps request!!!