we provide Accurate Oracle 1z0 808 book practice question which are the best for clearing java se 8 programmer i 1z0 808 dumps test, and to get certified by Oracle Java SE 8 Programmer I. The java se 8 programmer i 1z0 808 pdf Questions & Answers covers all the knowledge points of the real exam 1z0 808 exam. Crack your Oracle 1z0 808 practice test Exam with latest dumps, guaranteed!
Q91. Given the code fragment:
int b = 3;
if ( !(b > 3)) {
System.out.println("square ");
}{
System.out.println("circle ");
}
System.out.println("...");
What is the result?
A. square...
B. circle...
C. squarecircle...
D. Compilation fails.
Answer: C
Q92. Which of the following data types will allow the following code snippet to compile?
A. long
B. double
C. int
D. float
E. byte
Answer: B,D
Explanation:
Option B and D are the correct answer.
Since the variables I and j are floats, resultant will be float type too. So we have to use float
or primitive type which can hold float, such a primitive type is double, it has wider range
and also can hold floating point numbers, hence we can use double or float for the blank.
As explained above options B and D are correct.
long and int can't be used with floating point numbers so option A is incorrect.
Option E is incorrect as it have smaller range and also can't be used with floating point
numbers.
hnpsy/docs.oracle.com/javase/tutorial/java/javaOO/variables.html
Q93. Given:
What is the output?
A. [21, 13, 11]
B. [30]
C. []
D. Compilation fails due to error at line 7
E. Compilation tails due to error at line 10
Answer: D
Explanation:
Option D is the correct answer.
Code fails to compile as we can't use primitive for collections type, so in this code trying to
use int at line 7, causes a compile error. We should have use wrapper. Integer there. So
option D is correct.
https://docs.oracle.eom/javase/8/docs/api/java/util/ArrayList.html
Q94. Given the code fragment
int var1 = -5;
int var2 = var1--;
int var3 = 0;
if (var2 < 0) {
var3 = var2++;
} else {
var3 = --var2;
}
System.out.println(var3);
What is the result?
A. – 6
B. – 4
C. – 5
D. 5
E. 4
F. Compilation fails
Answer: C
Q95. Given:
public class Painting {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public static void main(String[] args) {
Painting obj1 = new Painting();
Painting obj2 = new Painting();
obj1.setType(null);
obj2.setType("Fresco");
System.out.print(obj1.getType() + " : " + obj2.getType());
}
}
What is the result?
A. : Fresco
B. null : Fresco
C. Fresco : Fresco
D. A NullPointerException is thrown at runtime
Answer: B
Q96. Given:
What is the result?
A. Initialized Started
B. Initialized Started Initialized
C. Compilation fails
D. An exception is thrown at runtime
Answer: B
Q97. Given the code fragment:
What is the result?
A. 1:2:3:4:5:
B. 1:2:3:
C. Compilation fails.
D. An ArrayoutofBoundsException is thrown at runtime.
Answer: A
Q98. Given:
Which code fragment, when inserted at line 9, enables the code to print true?
A. String str2 = str1;
B. String str2 = new string (str1);
C. String str2 = sb1.toString();
D. String str2 = “Duke”;
Answer: B
Q99. Given:
What is the result?
A. Shining Sun Shining Sun Shining Sun
B. Shining Sun Twinkling Star Shining Sun
C. Compilation fails
D. A ClassCastException is thrown at runtime
Answer: D
Q100. Given:
public class X {
static int i;
int j;
public static void main(String[] args) {
X x1 = new X();
X x2 = new X();
x1.i = 3;
x1.j = 4;
x2.i = 5;
x2.j = 6;
System.out.println(
x1.i + " "+
x1.j + " "+
x2.i + " "+
x2.j);
}
}
What is the result?
A. 3 4 5 6
B. 3 4 3 6
C. 5 4 5 6
D. 3 6 4 6
Answer: C