Oracle Java SE 8 Programmer I - 1z1-808 模擬練習

Given the code fragment:

And given the requirements:
- If the value of the qty variable is greater than or equal to 90,
discount = 0.5
- If the value of the qty variable is between 80 and 90, discount = 0.2 Which two code fragments can be independently placed at line n1 to meet the requirements?

正解: A,B
Given:

What is the result?

正解: D
Given the code fragment:

Which modification enables the code fragment to print TrueDone?

正解: B
解説: (PassTest メンバーにのみ表示されます)
Given:

and the code fragment:

What is the result?

正解: D
Given the code fragment:
for (int ii = 0; ii < 3;ii++) {
int count = 0;
for (int jj = 3; jj > 0; jj--) {
if (ii == jj) {
++count;
break;
}
}
System.out.print(count);
continue;
}
What is the result?

正解: B
Which statement best describes encapsulation?

正解: C
解説: (PassTest メンバーにのみ表示されます)
Given:

What is the result?

正解: C
解説: (PassTest メンバーにのみ表示されます)
Given:

What is the result?

正解: C
解説: (PassTest メンバーにのみ表示されます)
Given:

The class is poorly encapsulated.
You need to change the circle class to compute and return the area instead.
Which three modifications are necessary to ensure that the class is being properly encapsulated?
(Choose 3)

正解: A,B,C
A method is declared to take three arguments.
A program calls this method and passes only two arguments.
What is the results?

正解: A
Given the code fragment:

What is the result?

正解: D
解説: (PassTest メンバーにのみ表示されます)
Given:
public class String1 {
public static void main(String[] args) {
String s = "123";
if (s.length() >2)
s.concat("456");
for(int x = 0; x <3; x++)
s += "x";
System.out.println(s);
}
}
What is the result?

正解: A
解説: (PassTest メンバーにのみ表示されます)
Given:

What is the result?

正解: C
Given:

What is the result?

正解: A