Up to the immediate present 1z0-808 question Guide
It is impossible to pass Oracle 1z0-808 exam without any help in the short term. Come to Pass4sure soon and find the most advanced, correct and guaranteed Oracle 1z0-808 practice questions. You will get a surprising result by our Renovate Java SE 8 Programmer I practice guides.
2021 Sep 1z0-808 exam topics
Q1. Given:
public class Marklist {
int num;
public static void graceMarks(Marklist obj4) {
obj4.num += 10;
}
public static void main(String[] args) {
MarkList obj1 = new MarkList();
MarkList obj2 = obj1;
MarkList obj1 = null;
obj2.num = 60;
graceMarks(obj2);
}
}
How many objects are created in the memory runtime?
A. 1
B. 2
C. 3
D. 4
Answer: B
Explanation: obj1 and obj3.
when you do e2 = e1 you're copying object references - you're not making a copy of the object - and so the variables e1 and e2 will both point to the same object.
Q2. Which of the following can fill in the blank in this code to make it compile?
A. abstract
B. final
C. private
D. default
E. int
Answer: C
Explanation:
From Java SE 8, we can use static and/or default methods in interfaces, but they should be non abstract methods. SO in this case using default in blank is completely legal. Hence option C is correct. Option A is incorrect as given method is not abstract, so can't use abstract there. Options B and E are incorrect as we can't have non abstract method interface if they are not default or static. httpsy/docs.oracle.com/javase/tutorial/iava/landl/defaultmethods.html
Q3. Given the code fragment:
And given the requirements:
. If the value of the qty variable is greater than or equal to 90, discount = 0.5
. If the value of the qty variable is between 80 and 90, discount = 0.2
Which two code fragments can be independently placed at line n1 to meet the requirements?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Answer: A,C
Q4. Given the code fragment:
Which code fragment prints red: blue: small: medium?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: D
Q5. Given the following code:
What is the output?
A. 4
4
B. 3
5
C. 4
7
D. 5
4
E. 4
5
F. 4
21
Answer: E
Leading 1z0-808 exam topics:
Q6. Which of the following can fill in the blank in this code to make it compile? (Select 2 options.)
A. On line 1, fill in throws
B. On line 1, fill in throws new
C. On line 2, fill in throw new
D. On line 2, fill in throws
E. On line 2, fill in throws new
Answer: A,C
Explanation:
Option A and C are the correct answer.
In a method declaration, the keyword throws is used. So here at line 1 we have to use
option A.
To actually throw an exception, the keyword throw is used and a new exception is created,
so at line 2 we have to use throw and new keywords, which is option C. Finally it will look
like;
public void method() throws Exception {
throw new Exception0;
}
REFERENCE : httpsy/docs.oracle.com/javase/tutorial/essential/io/fileOps.html#exception
The correct answer is: On line 1, fill in throws. On line 2, fill in throw new
Q7. Given:
What is the result?
A. True false
B. True null
C. Compilation fails
D. A NullPointerException is thrown at runtime
Answer: A
Q8. Given the code fragment:
What is the result?
A. 10 : 10
B. 5 : 5
C. 5 : 10
D. Compilation fails
Answer: A
Q9. Given:
public class TestField {
int x;
int y;
public void doStuff(int x, int y) {
this.x = x;
y =this.y;
}
public void display() {
System.out.print(x + " " + y + " : ");
}
public static void main(String[] args) {
TestField m1 = new TestField();
m1.x = 100;
m1.y = 200;
TestField m2 = new TestField();
m2.doStuff(m1.x, m1.y);
m1.display();
m2.display();
}
}
What is the result?
A. 100 200 : 100 200
B. 100 0 : 100 0 :
C. 100 200 : 100 0 :
D. 100 0 : 100 200 :
Answer: C
Q10. Given:
A. X XX
B. X Y X
C. Y Y X
D. Y YY
Answer: D
see more http://www.2passeasy.com/exam/1z0-808/