Ensurepass

 

QUESTION 131

Given the code fragment:

 

int b = 3;

 

if ( !(b > 3)) {

 

System.out.println(“square “);

 

}{

 

System.out.println(“circle “);

 

}

 

System.out.println(“…”);

 

What is the result?

 

A.

square…

B.

circle…

C.

squarecircle…

D.

Compilation fails.

 

Correct Answer: C

 

 

QUESTION 132

Given:

 

clip_image002

 

What is the result?

 

A.

box

B.

nbo

C.

bo

D.

nb

E.

An exception is thrown at runtime

 

Correct Answer: E

 

 

QUESTION 133

Given:

 

clip_
image004

 

And the commands:

 

Javac Jump.java

 

Java Jump crazy elephant is always

 

What is the result?

 

A.

Lazy lion is jumping

B.

Lion is always jumping

C.

Crazy elephant is jumping

D.

Elephant is always jumping

E.

Compilation fails

 

Correct Answer: D

 

 

QUESTION 134

Given:

 

clip_image005

 

How many objects have been created when the line / / do complex stuff is reached?

 

A.

Two

B.

Three

C.

Four

D.

Six

 

Correct Answer: C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

QUESTION 135

Given:

 

clip_image006

 

What is the result?

 

A.

6 7 8

B.

7 8 9

C.

0 1 2

D.

6 8 10

E.

Compilation fails

 

Correct Answer:
A

 

 

QUESTION 136

Given:

 

clip_image007

 

What is the result?

 

A.

10 20 30 40

B.

0 0 30 40

C.

Compilation fails

D.

< font face="Arial">An exception is thrown at runtime

 

Correct Answer: A

QUESTION 137

Given:

 

public class Painting {

 

private String type;

 

public String getType() {

 

return type;

 

}

 

public void setType(String type) {

 

this.type = type;

 

}

 

public static void main(String[] args) {

 

P
ainting obj1 = new Painting();

 

Painting obj2 = new Painting();

 

obj1.setType(null);

 

obj2.setType(“Fresco”);

 

System.out.print(obj1.getType() + ” : ” + obj2.getType());

 

}

 

}

 

What is the result?

 

A.

: Fresco

B.

null : Fresco

C.

Fresco : Fresco

D.

A NullPointerException is thrown at runtime

 

Correct Answer: B

 

 

QUESTION 138

Given the code fragment:

 

public class Test {

 

public static void main(String[]args) {

 

Test t = new Test();

 

int[] arr = new int[10];

arr = t.subArray(arr,0,2);

 

}

 

// insert code here

 

}

 

Which method can be inserted at line // insert code here to enable the code to compile?

 

A.

public int[] subArray(int[] src, int start, int end) { return src;

}

B.

public int subArray(int src, int start, int end) { return src;

}

C.

public int[] subArray(int src, int start, int end) { return src;

}

D.

public int subArray(int[] src, int start, int end) { return src;

}

 

Correct Answer: A

 

 

QUESTION 139

Given the code fragment:

 

clip_image008

 

What is the result?

 

A.

Found Red

B.

Found Red

Found Blue

C.

Found Red

Found Blue

Found White

D.

Found Red

Found Blue

Found White

Found Default

 

Correct Answer: B

Explanation:

As there is no break statement after the case “Red” statement the case Blue statement will run as well.

 

Note: The body of a switch statement is known as a switch block. A statement in the switch block can be labeled with one or more case or default labels. The switch statement evaluates its expression, then executes all statements that follow the matching case label.

 

Each break statement terminates the enclosing switch statement. Control flow continues with the first statement following the switch block. The break statements are necessary because without them, statements in switch blocksfall through:All statements after the matching case label are executed in sequence, regardless of the expression of subsequent case labels, until a break statement is encountered.

 

 

QUESTION 140

Give:

 

clip_image010

 

What is the result?

 

A.

1525

B.

13

C.

Compilation fails

D.

An exception is thrown at runtime

E.

The program fails to execute due to runtime error

 

Correct Answer: D

Free VCE & PDF File for Oracle 1Z0-803 Real Exam

Instant Access to Free VCE Files: CompTIA | VMware | SAP …
Instant Access to Free PDF Files: CompTIA | VMware | SAP …

 

Comments are closed.