READ Free Dumps For Oracle- 1z0-803
Question ID 21929 | Given the code fragment:
System.out.println("Result: " + 2 + 3 + 5);
System.out.println("Result: " + 2 + 1 * 5);
What is the result?
|
Option A | Result: 10
Result: 30
|
Option B | Result: 10
Result: 25
|
Option C | Result: 235
Result: 215
|
Option D | Result: 215
Result: 215
|
Option F | Correct Answer: C
Explanation:
String concatenatio is produced.
The output is:
Result: 235
Result: 215
Note #1:
To produce an arithmetic result, the following code would have to be used:
System.out.println("Result: " + (2 + 3 + 5));
System.out.println("Result: " + (2 + 3 * 5));
run:
Result: 10
Result: 17
Note #2:
If the code was as follows:
System.out.println("Result: " + 2 + 3 + 5");
System.out.println("Result: " + 2 + 1 * 5");
The compilation would fail. There is an unclosed string literal, 5", on each line.
|
Correct Answer | F |
Explanation
Question ID 21930 | Which code fragment is illegal?
|
Option A | class Base1 {
abstract class Abs1 { }}
|
Option B | abstract class Abs1 {
void doit () { }
}
|
Option C | class Basel {
abstract class Abs1 extends Basel {
|
Option D | abstract int var1 = 89;
|
Correct Answer | D |
Explanation Explanation: The abstract keyword cannot be used to declare an int variable. The abstract keyword is used to declare a class or method to be abstract[3]. An abstract method has no implementation; all classes containing abstract methods must themselves be abstract, although not all abstract classes have abstract methods.