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

Viewing page 2 out of 3 pages
Viewing questions 11-20 out of questions
Questions # 11:

Identify two Java reserved words.

Options:

A.

array


B.

true


C.

this


D.

exception


E.

string


Questions # 12:

Given:

Question # 12

What is the result?

Options:

A.

The program compiles and nothing is printed.


B.

Iteration plus an increasing number is printed 100 times.


C.

Iteration plus an increasing number is printed 99 times.


D.

An error occurs during compilation.


Questions # 13:

Given the code fragment:

Question # 13

Which two code fragments are valid at line 2?

Options:

A.

for (int count = 0; count < 5; count++) {

System.out.print(count);

}


B.

package p1;


C.

import java.util.*;

public void display() {

List nums = new ArrayList<> ();

}


D.

{

private int num;

}


E.

private String name = “John”;

public void display() {

System.out.print(name);

}


Questions # 14:

Given:

Question # 14

What is the result?

Options:

A.

The code fails to compile. To make it compile, at line n1 insert:

this () { }


B.

The code fails to compile. To make it compile, at line n2 insert:

this ();


C.

The code fails to compile. To make it compile, at line n1 insert:

Bus () { }


D.

The code compiles and prints:

default

luxury


Questions # 15:

Given:

Question # 15

Which statement, when inserted at line n1, enables the Course class to compile?

Options:

A.

int newFee;


B.

double newFee;


C.

long newFee;


D.

float newFee;


Questions # 16:

Given the code:

Question # 16

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) {


Questions # 17:

Given the code fragment:

Question # 17

What is the result?

Options:

A.

A compilation error occurs at line n1.


B.

Jack


C.

The program prints either Jack or Queen.


D.

Queen


Questions # 18:

Given the code fragment:

Question # 18

What is the result?

Options:

A.

1


B.

3


C.

5


D.

Nothing is printed.


Questions # 19:

Given the code

Question # 19

What is the result?

Options:

A.

The program executes indefinitely.


B.

num = 100


C.

num = 99


D.

num = 0


Questions # 20:

Identify three advantages of object-oriented programming.

Options:

A.

separation of state and behavior


B.

modularity


C.

information sharing


D.

code reuse


E.

information hiding


Viewing page 2 out of 3 pages
Viewing questions 11-20 out of questions