[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-808 Dumps with VCE and PDF 41-50

By | January 25, 2018

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-808
100% Free Download! 100% Pass Guaranteed!

Java SE 8 Programmer I

Question No: 41


Ensurepass 2018 PDF and VCE

Which is true?

  1. Sum for 0 to 0 = 55

  2. Sum for 0 to 10 = 55

  3. Compilation fails due to error on line 6.

  4. Compilation fails due to error on line 7.

  5. An Exception is thrown at the runtime.

Answer: D Explanation:

Loop variables scope limited to that enclosing loop. So in this case, the scope of the loop variable x declared at line 5, limited to that for loop. Trying to access that variable at line 7, which is out of scope of the variable x, causes a compile time error. So compilation fails due to error at line 7. Hence option D is correct.

Options A and B are incorrect, since code fails to compile.

Reference: httpsy/docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html

Question No: 42

Which statement best describes encapsulation?

  1. Encapsulation ensures that classes can be designed so that only certain fields and methods of an object are accessible from other objects.

  2. Encapsulation ensures that classes can be designed so that their methods are inheritable.

  3. Encapsulation ensures that classes can be designed with some fields and methods declared as abstract.

  4. Encapsulation ensures that classes can be designed so that if a method has an argument MyType x, any subclass of MyType can be passed to that method.

Answer: A

Question No: 43

Given the code fragment:

Ensurepass 2018 PDF and VCE

What is the result if the integer aVar is 9?

  1. 10 Hello world!

  2. 10 Hello universe!

  3. 9 Hello world!

  4. Compilation fails.

Answer: A

Question No: 44

What is the name of the Java concept that uses access modifiers to protect variables and hide them within a class?

  1. Encapsulation

  2. Inheritance

  3. Abstraction

  4. Instantiation

  5. Polymorphism

Answer: A

Question No: 45


public class Natural { private int i;

void disp() { while (i lt;= 5) {

for (int i=1; i lt;=5;) { System.out.print(i quot; quot;); i ;

} i ;



public static void main(String[] args) { new Natural().disp();



What is the result?

  1. Prints 1 2 3 4 5 once

  2. Prints 1 3 5 once

  3. Prints 1 2 3 4 5 five times

  4. Prints 1 2 3 4 5 six times

  5. Compilation fails

Answer: D

Explanation: 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5

Question No: 46


Class A { } Class B { }

Interface X { } Interface Y { }

Which two definitions of class C are valid?

  1. Class C extends A implements X { }

  2. Class C implements Y extends B { }

  3. Class C extends A, B { }

  4. Class C implements X, Y extends B { }

  5. Class C extends B implements X, Y { }

Answer: A,E

Explanation: extends is for extending a class.

implements is for implementing an interface.

Java allows for a class to implement many interfaces.

Question No: 47

Which three statements are true about the structure of a Java class?

  1. A class can have only one private constructor.

  2. A method can have the same name as a field.

  3. A class can have overloaded static methods.

  4. A public class must have a main method.

  5. The methods are mandatory components of a class.

  6. The fields need not be initialized before use.

Answer: A,B,C

Explanation: A: Private constructors prevent a class from being explicitly instantiated by its callers.

If the programmer does not provide a constructor for a class, then the system will always provide a default, public no-argument constructor. To disable this default constructor, simply add a private no-argument constructor to the class. This private constructor may be empty.

B: The following works fine: int cake() {

int cake=0; return (1);


C: We can overload static method in Java. In terms of method overloading static method are just like normal methods and in order to overload static method you need to provide another static method with same name but different method signature.


Not D: Only a public class in an application need to have a main method. Not E:


class A


public string something; public int a;


Q: What do you call classes without methods? Most of the time: An anti pattern.

Why? Because it faciliates procedural programming with quot;Operatorquot; classes and data structures. You separate data and behaviour which isn#39;t exactly good OOP.

Often times: A DTO (Data Transfer Object)

Read only datastructures meant to exchange data, derived from a business/domain object. Sometimes: Just data structure.

Well sometimes, you just gotta have those structures to hold data that is just plain and simple and has no operations on it.

Not F: Fields need to be initialtized. If not the code will not compile. Example:

Uncompilable source code – variable x might not have been initialized

Question No: 48

Given the code fragment:

Ensurepass 2018 PDF and VCE

What is the result?

  1. Execution terminates in the first catch statement, and caught a RuntimeException is printed to the console.

  2. Execution terminates In the second catch statement, and caught an Exception is printed to the console.

  3. A runtime error is thrown in the thread quot;mainquot;.

  4. Execution completes normally, and Ready to us漏 is printed to the console.

  5. The code fails to compile because a throws keyword is required.

Answer: C

Question No: 49

Given the code fragment:

Ensurepass 2018 PDF and VCE

Which three code fragments can be independently inserted at line nl to enable the code to print one?

  1. Byte x = 1;

  2. short x = 1;

  3. String x = quot;1quot;;

  4. Long x = 1;

  5. Double x = 1;

  6. Integer x = new Integer (quot;1quot;);

Answer: A,B,F

Question No: 50

Given the code fragment:

Ensurepass 2018 PDF and VCE

Which option represents the state of the num array after successful completion of the outer loop?

Ensurepass 2018 PDF and VCE

  1. Option A

  2. Option B

  3. Option C

  4. Option D

Answer: A

100% Ensurepass Free Download!
Download Free Demo:1z0-808 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-808 Dumps

EnsurePass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.