Java SE 8 Programmer v1.0 (1z0-808)

Page:    1 / 16   
Total 226 questions

Given this array:


Which two code fragments, independently, print each element in this array? (Choose two.)
A.

B.

C.

D.

E.

F.



Answer : BE

Given the content of three files:


Which statement is true?

  • A. Only the A.Java file compiles successfully.
  • B. Only the B.java file compiles successfully.
  • C. Only the C.java file compiles successfully.
  • D. The A.Java and B.java files compile successfully.
  • E. The B.java and C.java files compile successfully.
  • F. The A.Java and C.java files compile successfully.


Answer : A

Given the code fragment:


And given the requirements:
1. Process all the elements of the array in the order of entry.
2. Process all the elements of the array in the reverse order of entry.
3. Process alternating elements of the array in the order of entry.
Which two statements are true? (Choose two.)

  • A. Requirements 1, 2, and 3 can be implemented by using the enhanced for loop.
  • B. Requirements 1, 2, and 3 can be implemented by using the standard for loop.
  • C. Requirements 2 and 3 CANNOT be implemented by using the standard for loop.
  • D. Requirement 1 can be implemented by using the enhanced for loop.
  • E. Requirement 3 CANNOT be implemented by using either the enhanced for loop or the standard for loop.


Answer : DE

Given:


What is the result?

  • A. 400 200
  • B. 200 200
  • C. 400 400
  • D. Compilation fails.


Answer : A

Given the following class declarations:
✑ public abstract class Animal
✑ public interface Hunter
✑ public class Cat extends Animal implements Hunter
✑ public class Tiger extends Cat
Which answer fails to compile?


  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
  • E. Option E


Answer : E

Which statement is true about Java byte code?

  • A. It can run on any platform.
  • B. It can run on any platform only if it was compiled for that platform.
  • C. It can run on any platform that has the Java Runtime Environment.
  • D. It can run on any platform that has a Java compiler.
  • E. It can run on any platform only if that platform has both the Java Runtime Environment and a Java compiler.


Answer : D

Explanation:
Java bytecodes help make "write once, run anywhere" possible. You can compile your program into bytecodes on any platform that has a Java compiler. The bytecodes can then be run on any implementation of the Java VM. That means that as long as a computer has a Java VM, the same program written in the Java programming language can run on Windows 2000, a Solaris workstation, or on an iMac.
Reference:
http://www.math.uni-hamburg.de/doc/java/tutorial/getStarted/intro/definition.html

Given:


How many MarkList instances are created in memory at runtime?

  • A. 1
  • B. 2
  • C. 3
  • D. 4


Answer : A

Given:


What is the result?

  • A. Area is 6.0
  • B. Area is 3.0
  • C. Compilation fails at line n1
  • D. Compilation fails at line n2.


Answer : A

Given the code fragment:


Which three code fragments can be independently inserted at line n1 to enable the code to print One? (Choose three.)

  • A. byte x = 1;
  • B. short x = 1;
  • C. String x = "1";
  • D. long x = 1;
  • E. double x = 1;
  • F. Integer x = new Integer("1");


Answer : ABF

Given:


What is the result?

  • A. True false
  • B. True null
  • C. Compilation fails
  • D. A NullPointerException is thrown at runtime


Answer : A

Given the following code for the classes MyException and Test:


What is the result?

  • A. A
  • B. B
  • C. Either A or B
  • D. A B
  • E. A compile time error occurs at line n1


Answer : B

Given:


What is the result?

  • A. myStr: 9009, myNum: 9009
  • B. myStr: 7007, myNum: 7007
  • C. myStr: 7007, myNum: 9009
  • D. Compilation fails


Answer : C

Which two are benefits of polymorphism? (Choose two.)

  • A. Faster code at runtime
  • B. More efficient code at runtime
  • C. More dynamic code at runtime
  • D. More flexible and reusable code
  • E. Code that is protected from extension by other classes


Answer : BD

Reference:
https://www.cs.princeton.edu/courses/archive/fall98/cs441/mainus/node5.html

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 : B

Given:


What is the result?

  • A. true:true
  • B. true:false
  • C. false:true
  • D. false:false


Answer : C

Page:    1 / 16   
Total 226 questions