Ensurepass

 

QUESTION 41

Given:

 

clip_image002

 

What is the reference type of myZ and what is the type of the object it references?

 

A.

Reference type is Z; object type is Z.

B.

Reference type is Y; object type is Y.

C.

Reference type is Z; object type is Y.

D.

Reference type is X; object type is Z.

 

Correct Answer: C

 

 

QUESTION 42

Given the code fragment:

 

clip_image004

What is the result?

 

A.

Found Red

Found Default

B.

Found Teal

C.

Found Red

Found Blue

Found Teal

D.

Found Red

Found Blue

Found Teal

Found Default

E.

Found Default

 

Correct Answer: B

 

 

QUESTION 43

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

 

A.

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

B.

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

C.

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

D.

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

 

Correct Answer: AD

 

 

QUESTION 44

Which two statements are true for a two-dimensional array of primitive data type?

 

A.

It cannot contain elements of different types.

B.

The length of each dimension must be the same.

C.

At the declaration time, the number of elements of the array in each dimension must be specified.

D.

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

 

Correct Answer: CD

Explanation:

http://stackoverflow.com/questions/12806739/is-an-array-a-primitive-type-or-an-object-or-something-else-entirely

 

 

QUESTION 45

Which two statements correctly describe checked exception?

 

A.

These are exceptional conditions that a well-written application should anticipate and recover from.

B.

These are exceptional conditions that are external to the application, and that the application usually cannot anticipate or recover from.

C.

These are exceptional conditions that are internal to the application, and that the application usually cannot anticipate or recover from.

D.

Every class that is a subclass of RuntimeException and Error is categorized as checked exception.

E.

Every class that is a subclass of Exception, excluding RuntimeException and its subclasses, is categorized as checked exception.

 

Correct Answer: AE

Explanation:

Reference: Checked versus unchecked exceptions

 

 

QUESTION 46

Given:

 

public class App {

 

// Insert code here

 

System.out.print(“Welcome to the world of Java”);

 

}

 

}

 

Which two code fragments, when inserted independently at line // Insert code here, enable the program to execute and print the welcome message on the screen?

 

A.

static public void main (String [] args) {

B.

static void main (String [] args) {

C.

public static void Main (String [] args) {

D.

public staticvoid main (String [] args) {

E.

public void main (String [] args) {

 

Correct Answer: AD

Explanation:

Incorrect:

Not B: No main class found.

Not C: Main method not found.

not E: Main method is not static.

 

 

QUESTION 47

Given the code fragment:

 

clip_image006

 

What values ofx,y,zwill produce the following result?

 

1 2 3 4

 

1 2 3 4

 

1 2 3 4

 

 

1 2 3 4

 

 

A.

X = 4, Y = 3, Z= 2

B.

X = 3, Y = 2, Z = 3

C.

X = 2, Y = 3, Z = 3

D.

X = 4, Y = 2, Z = 3

E.

X = 2, Y = 3, Z = 4

 

Correct Answer: E

Explanation:

Z is for the innermost loop. Should print 1 2 3 4. So Z must be 4.

Y is for the middle loop. Should print three lines of 1 2 3 4. So Ymust be set 3.

X is for the outmost loop. Should print 2 lines of. So X should be 2.

 

 

QUESTION 48

public class ForTest {

 

public static void main(String[] args) {

 

int[] arrar= {1,2,3};

 

for ( foo ) {

 

}

 

}

 

}

 

Which three are valid replacements for foo so that the program will compiled and run?

 

A.

int i: array

B.

int i = 0; i < 1; i++

C.

;;

D.

; i < 1; i++

E.

; i < 1;

 

Correct Answer: ABC

 

 

 

QUESTION 49

Given:

 

clip_image008

 

What is the result?

 

A.

6

5

6

4

B.

6

5

5

4

C.

6

5

6

6

D.

6

5

6

5

 

Correct Answer: A

Explanation:

Within main z is assigned 6. z is printed. Output: 6

Within doStuff z is assigned 5.DoStuff2 locally sets z to 4 (but MyScope.z is set to 4), but in Dostuff z is still 5. z is printed. Output: 5

Again z is printed within main (with local z set to 6). Output: 6

Finally MyScope.z is printed. MyScope.z has been set to 4 within doStuff2(). Output: 4

 

QUESTION 50

Given:

 

clip_image010

 

Which code fragment, when inserted at line 7, enables the code print true?

 

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 …

 

A.

Option A

B.

Option B

C.

Option C

D.

Option D

 

Correct Answer: A

 

 

Comments are closed.