Pass the Oracle Java SE 1z0-811 Questions and answers with CertsForce

Viewing page 1 out of 3 pages
Viewing questions 1-10 out of questions
Questions # 1:

Which statement is true about a mutator method?

Options:

A.

It replaces the default constructor.


B.

It returns mutated instance members.


C.

It must be declared private.


D.

It can be used to assign data to instance members.


Questions # 2:

What is the meaning of “write once, run anywhere” in Java?

Options:

A.

Java programs are designed to run only in web browsers and, thus, can run wherever there is a browser.


B.

It is a marketing statement because Java programs must be compiled for a specific platform in order to run.


C.

Java programs can run on any Java Virtual Machine without being recompiled.


D.

Java programs, after being compiled, can run on any platform or device even without a Java Virtual Machine.


Questions # 3:

Given the code fragment:

Question # 3

What is the result?

Options:

A.

[jasmine, rose, lily]


B.

A runtime exception is thrown.


C.

[jasmine, lily, lotus]


D.

[jasmine, rose, lotus, lily]


Questions # 4:

Which statement is true about exception handling?

Options:

A.

At least one catch block must accompany a try statement.


B.

All statements in a try block are executed, even if an exception occurs in the middle of the try block.


C.

At least one statement in a try block must throw an exception.


D.

All catch blocks must be ordered from general to most specific.


Questions # 5:

Which two components can class declarations include?

Options:

A.

A list of instance methods


B.

The main method


C.

Interfaces implemented by the class


D.

The public modifier


Questions # 6:

Given:

Question # 6

What is the output?

Options:

A.

1 2 3 aaaa


B.

1 2 aaa


C.

Compilation fails


D.

a


Questions # 7:

Given:

Question # 7

What is the result?

Options:

A.

Compilation fails. To make it compile, replace line n1 with var1 = 0;


B.

Compilation fails. To make it compile, replace line n2 with var2 = 0;


C.

0


D.

Nothing is printed.


Questions # 8:

Given the classes:

Question # 8

Which two modifications, independently, enable the Salad.java file to compile?

Options:

A.

Replace line n1 with import fruits.Apple.getApple();


B.

Replace line n1 with import fruits.Apple;


C.

Replace line n1 with import fruits;


D.

Replace line n2 with fruits.Apple apple = new Apple ();


E.

Replace line n2 with fruits.Apple apple = new fruits.Apple ();


Questions # 9:

Which statement is true about primitive variables?

Options:

A.

They can be compared with the == operator.


B.

They can be compared with the equals method only.


C.

They cannot be compared.


D.

They can be compared with the compareTo method only.


Questions # 10:

Given the code fragment:

Question # 10

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]);

}


Viewing page 1 out of 3 pages
Viewing questions 1-10 out of questions