Weekend Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 70percent

Oracle 1z0-811 Java Foundations Exam Practice Test

Demo: 11 questions
Total 75 questions

Java Foundations Questions and Answers

Question 1

Given these class definitions:

Which class or classes compile?

Options:

A.

only MyClassB, MyClassC, and MyClassD

B.

only MyClassB

C.

MyClassA, MyClassB, MyClassC, and MyClassD

D.

only MyClassB and MyClassD

Question 2

Given the code fragment:

What is the result?

Options:

A.

1

B.

3

C.

5

D.

Nothing is printed.

Question 3

Given the code fragment:

Which statement is true?

Options:

A.

A compilation error occurs at line 5.

B.

A compilation error occurs at line 3.

C.

The code compiles without errors.

D.

A compilation error occurs at line 7.

Question 4

Given the contents of the Test.java file:

What is the result?

Options:

A.

200 : 400

B.

A compilation error occurs at line n1.

C.

A compilation error occurs at line n2.

D.

100 : 400

Question 5

Given the code fragment:

What is the result?

Options:

A.

2

B.

4

C.

The program executes an infinite number of times.

D.

3

Question 6

Given:

What is the result?

Options:

A.

[null:-]

B.

[ : ]

C.

[null:null]

D.

[:null]

Question 7

Given the code fragment:

Which code fragment can be inserted at line n1 to enable the code to print 0.0?

Options:

A.

Ball b = null;

B.

weight = 0.0;

C.

Ball.weight = 0.0;

D.

Ball b = new Ball(0.0);

E.

Ball b = new Ball();

Question 8

Given the code:

Which code fragment, when inserted at line n1, enables the code to print sum is 30?

Options:

A.

int sum(int a, b) {

B.

int sum(int a, int b) {

C.

int sum(int, int) {

D.

int sum(int[] a, b) {

Question 9

Given the code fragment:

Which for loop statement can be used to print 135?

Options:

A.

for(int idx = 1; idx < arr.length; idx+=2) {

System.out.print (arr[idx]);

}

B.

for(int idx = 1; idx < arr.length–1; idx++) {

System.out.print (arr[idx++]);

}

C.

for(int idx = 0; idx < arr.length; idx++) {

System.out.print (arr[idx]);

}

D.

for(int idx = 0; idx < arr.length; idx+=2) {

System.out.print (arr[idx]);

}

Question 10

Given the code fragment:

What is the result?

Options:

A.

[jasmine, rose, lily]

B.

A runtime exception is thrown.

C.

[jasmine, lily, lotus]

D.

[jasmine, rose, lotus, lily]

Question 11

Given the code fragment:

What is the result?

Options:

A.

[ BETATEST ]

B.

[betaTest]

C.

[ betaTest ]

D.

[BETATEST]

Demo: 11 questions
Total 75 questions