[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-803 Dumps with VCE and PDF 71-80

By | January 25, 2018

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

Java SE 7 Programmer I

Question No: 71

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 instantiatedby 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 andsimple 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: 72

Given the code fragment:

Ensurepass 2018 PDF and VCE

  1. Super Sub


  2. Contract Contract Super

  3. Compilation fails at line n1

  4. Compilation fails at line n2

Answer: D

Question No: 73

Given the code fragment:

System.out.printIn(quot;Result: quot; 2 3 5);

System.out.printIn(quot;Result: quot; 2 3 * 5); What is theresult?

  1. Result: 10 Result: 30

  2. Result: 10 Result: 25

  3. Result: 235 Result: 215

  4. Result: 215 Result: 215

  5. Compilation fails

Answer: C Explanation: First line:

System.out.println(quot;Result: quot; 2 3 5); String concatenation is produced.

Second line:

System.out.println(quot;Result: quot; 2 3 * 5);

3*5 is calculated to 15 and is appended to string 2. Result 215.

The output is: Result: 235

Result: 215

Note #1:

To produce an arithmetic result, the following code would have to be used: System.out.println(quot;Result: quot; (2 3 5));

System.out.println(quot;Result: quot; (2 1 * 5)); run:

Result: 10

Result: 7

Note #2:

If the code was as follows:

System.out.println(quot;Result: quot; 2 3 5quot;);

System.out.println(quot;Result: quot; 2 1 * 5quot;);

The compilation would fail. There is an unclosed string literal, 5quot;, on each line.

Question No: 74

Which statement initializes a stringBuilder to a capacity of 128?

  1. StringBuilder sb = new String (quot;128quot;);

  2. StringBuilder sb = StringBuilder.setCapacity (128);

  3. StringBuilder sb = StringBuilder.getInstance (128);

  4. StringBuilder sb = new StringBuilder (128);

Answer: D Explanation:

StringBuilder(int capacity)

Constructs a string builder with no characters in it and an initial capacity specified by thecapacityargument.

Note: An instance of a StringBuilder is a mutable sequence of characters.

The principal operations on aStringBuilderare theappendandinsertmethods, which are overloaded so as to accept data of any type. Each effectively converts a given datum to a string and then appends or inserts the characters of that string to the string builder.

Theappendmethod always adds these characters at the end of the builder; theinsertmethod adds the characters at a specified point.

Question No: 75

Given the following four Java file definitions:

// Foo.java package facades;

public interface Foo { }

// Boo.java package facades;

public interface Boo extends Foo { }

// Woofy.java package org.domain

// line n1

public class Woofy implements Boo, Foo {}

// Test.java package.org; public class Test {

public static void main(String[] args) { Foo obj=new Woofy();

Which set modifications enable the code to compile and run?

  1. At line n1, Insert: import facades;At line n2, insert:import facades;importorg.domain;

  2. At line n1, Insert: import facades.*;At line n2, insert:import facades;import org.*;

  3. At line n1, Insert: import facades.*;At line n2, insert:import facades.Boo;import org.*;

  4. At line n1, Insert: import facades.Foo, Boo;At line n2, insert:import org.domain.Woofy;

  5. At line n1, Insert: import facades.*;At line n2, insert:import facades;import org.domain.Woofy;

Answer: E

Question No: 76

Which two will compile, and can be run successfully using the command: Java fred1 hello walls

Ensurepass 2018 PDF and VCE

  1. Option A

  2. Option B

  3. Option C

  4. Option D

Answer: C,D Explanation:

Throwsjava.lang.ArrayIndexOutOfBoundsException: 2 at certquestions.Fred1.main(Fred1.java:3)

  1. Prints out: [Ljava.lang.String;@39341183

  2. Prints out: walls

Question No: 77


Which two statements are true for a two-dimensional array?

  1. It is implemented as an array of the specified element type.

  2. Using a row by column convention, each row of a two-dimensional array must be of the same size.

  3. At declarationtime, the number of elements of the array in each dimension must be specified.

  4. All methods of the class Object may be invoked on the two-dimensional array.

Answer: A,D

Question No: 78


public class ColorTest {

public static void main(String[] args) {

String[] colors = {quot;redquot;, quot;bluequot;,quot;greenquot;,quot;yellowquot;,quot;maroonquot;,quot;cyanquot;}; int count = 0;

for (String c : colors) { if (count gt;= 4) { break;


else { continue;


if (c.length() gt;= 4) { colors[count] = c.substring(0,3);


count ;





What is the result?

  1. Yellow

  2. Maroon

  3. Compilation fails

  4. A StringIndexOutOfBoundsException is thrown at runtime.

Answer: C

Explanation: Theline, if (c.length() gt;= 4) {, is never reached. This causes a compilation error.

Note: The continue statement skips the current iteration of a for, while , or do-while loop. An unlabeled break statement terminates the innermost switch, for, while, or do-

while statement, but a labeled break terminates an outer statement.

Question No: 79

Which code fragment cause a compilation error?

  1. flat flt = 100F;

  2. float flt = (float) 1_11.00;

  3. float flt = 100;

  4. double y1 = 203.22; floatflt = y1

  5. int y2 = 100; floatflt = (float) y2;

Answer: B

Question No: 80


public class SampleClass {

public static void main(String[] args) {

AnotherSampleClass asc = new AnotherSampleClass(); SampleClass sc = new SampleClass();

sc = asc;

System.out.println(quot;sc: quot; sc.getClass()); System.out.println(quot;asc: quot; asc.getClass());


class AnotherSampleClass extends SampleClass {


What is the result?

  1. sc: class Object

    asc: class AnotherSampleClass

  2. sc: class SampleClass

    asc: class AnotherSampleClass

  3. sc: class AnotherSampleClass asc: class SampleClass

  4. sc: class AnotherSampleClass asc: class AnotherSampleClass

Answer: D

100% Ensurepass Free Download!
Download Free Demo:1z0-803 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-803 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.