Free preview mode
Enjoy the free questions and consider upgrading to gain full access!
1z0-808
Free trial
Verified
Question 26
Given the code fragment:
What is the result?
- A: 3
- B: 4
- C: -1
- D: Compilation fails.
Question 27
Given the code fragment:
What is the result?
- A: 2012-02-10
- B: 2012-02-11
- C: Compilation fails
- D: A DateTimeException is thrown at runtime.
Question 28
Given:
What is the result?
- A: 10 : 30 : 6
- B: 10 : 22 : 22
- C: 10 : 22 : 20
- D: 10 : 22 : 6
Question 29
Given:
And given the code fragment:
What is the result?
- A: Compilation fails at line n2.
- B: Read Book
- C: Read E-Book
- D: Compilation fails at line n1.
- E: Compilation fails at line n3.
Question 30
Given this class:
Which two changes would encapsulate this class and ensure that the area field is always equal to length * height whenever the Rectangle class is used?
(Choose two.)
- A: Call the setArea method at the end of the setHeight method.
- B: Call the setArea method at the beginning of the setHeight method.
- C: Call the setArea method at the end of the setLength method.
- D: Call the setArea method at the beginning of the setLength method.
- E: Change the setArea method to private.
- F: Change the area field to public.
Question 31
Given the code fragment:
What is the result?
- A: [green, red, yellow, cyan]
- B: [green, blue, yellow, cyan]
- C: [green, red, cyan, yellow]
- D: An IndexOutOfBoundsException is thrown at runtime.
Question 32
Given the code fragment:
Which three code fragments are valid at line n1? (Choose three.)
A.
B.
C.
D.
E.
Question 33
Given:
What is the result?
- A: Compilation fails.
- B: 3 5
- C: 0 0
- D: 9 25
Question 34
Given:
Which code fragment should you use at line n1 to instantiate the dvd object successfully?
- A: Option A
- B: Option B
- C: Option C
- D: Option D
Question 35
Given the code fragment:
Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order? (Choose two.)
A.
B.
C.
D.
E.
Question 36
Given:
What is the result?
- A: 10 Hello Hello 11
- B: 10 Hello Hello 121
- C: 100 Hello 121
- D: 100 Hello Hello 121
- E: 10 Hello 11
Question 37
Given the code fragment:
What is the result?
- A: Compilation fails.
- B: Hi removed
- C: An UnsupportedOperationException is thrown at runtime.
- D: The program compiles, but it prints nothing.
Question 38
Which two class definitions fail to compile? (Choose two.)
A.
B.
C.
D.
E.
Question 39
Given:
What is the result?
- A: null Richard Donald
- B: Richard Donald
- C: Compilation fails.
- D: An ArrayIndexOutOfBoundsException is thrown at runtime.
- E: A NullPointerException is thrown at runtime.
Question 40
This grid shows the state of a 2D array:
The grid is created with this code:
Which line of code, when inserted in place of //line n1, adds an X into the grid so that the grid contains three consecutive XS?
- A: grid[2][1] = 'X';
- B: grid[3][2] = 'X';
- C: grid[3][1] = 'X';
- D: grid[2][3] = 'X';
Question 41
Given:
What is the result?
- A: Hello Log 1:0
- B: Hello Log 2:1
- C: Welcome Log 2:1
- D: Welcome Log 1:0
Question 42
Given the code snippet from a compiled Java source file:
Which command-line arguments should you pass to the program to obtain the following output?
Arg is 2 -
- A: java MyFile 1 3 2 2
- B: java MyFile 2 2 2
- C: java MyFile 1 2 2 3 4
- D: java MyFile 0 1 2 3
Question 43
Given the code fragment:
Which two modifications should you make so that the code compiles successfully? (Choose two.)
- A: Replace line 13 with:
- B: Replace line 7 with throw IOException (ג€Exception raisedג€);
- C: Replace line 11 with public static void main(String[]) args) throws Exception {
- D: At line 14, insert throw new IOException();
- E: Replace line 5 with public void printFileContent() throws IOException {
Question 44
Given the code fragment:
What is the result?
- A: 1 3 5 7 1 3
- B: 1 3 1 3
- C: 1 3 1 3 0 0
- D: 1 3 followed by an ArrayIndexOutOfBoundsException
- E: Compilation fails.
Question 45
Given the code fragment:
Which option can replace xxx to enable the code to print 135?
A.
B.
C.
D.
Question 46
Given:
MainTest.java:
and commands:
What is the result?
- A: String main 1
- B: An exception is thrown at runtime
- C: String main 1 2 3
- D: String main 123
Question 47
Which two statements are true about Java byte code? (Choose two.)
- A: It can be serialized across network.
- B: It can run on any platform that has a Java compiler.
- C: It can run on any platform.
- D: It has ג€.javaג€ extension.
- E: It can run on any platform that has the Java Runtime Environment.
That’s the end of your free questions
You’ve reached the preview limit for 1z0-808Consider upgrading to gain full access!
Free preview mode
Enjoy the free questions and consider upgrading to gain full access!