Oracle Java Standard Edition 5 and 6, Certified Associate - 1Z0-850 模擬練習

Which three are char literals? (Choose three.)

正解: B,C,D
Given:
1 . public abstract class Wow {
2 . private int wow;
3 . public Wow(int wow) {
4 . this.wow = wow;
5 . }
6 . public void wow() { }
7 . private void wowza() { }
8 . }
Which is true about the class Wow?

正解: C
Given:
1 . class Test {
2 . public static void main(String args[]) {
3 . int num1 = 10, num2 = 20, result;
4 . result = calc(num1, num2);
5 . System.out.println(result);
6 . }
7 .
8 . // insert code here
9 . }
Which, inserted at line 8, produces the output 30?

正解: A
Given:
1 8. String s = " abcdcba ";
1 9. int x = 2;
2 0. s = s.trim();
2 1. if (s.length() < 8) {
2 2. x = s.indexOf('c', 3);
2 3. }
2 4. System.out.println("x = " + x);
What is the result?

正解: A
Given:
1 . public class Bar {
2 . int size;
3 . public static void main(String[] args) {
4 . Bar b = new Bar();
5 . b.size = 27;
6 . int i = b.go(b.size);
7 . System.out.print(b.size + " : " + i);
8 . }
9 . public int go(int size) {
1 0. size++;
1 1. return size;
1 2. }
1 3. }
What is the result?

正解: B
Click the Exhibit button.
Which two are true? (Choose two.)

正解: B,C
Given:
2 . class Test {
3 . public static void main(String args[]) {
4 . for (int i = 1; i < 5; i++) {
5 . if (i == 2) {
6 . continue;
7 . }
8 . System.out.print(" i = " + i);
9 . }
1 0. }
1 1. }
What is the result?

正解: A
Given:
1 . class Test {
2 . public static void main(String[] args) {
3 . int num = 1;
4 . for (num = 0; num < 3; ++num ) {
5 . num *= 2;
6 . }
7 . System.out.println("num = " + (num++));
8 . }
9 . }
What is the result?

正解: B
Click the Exhibit button.
Which code correctly implements the association between A and B?

正解: F
What is the role of a JSP author?

正解: D
Given:
5 . // insert code here
6 . public void eat();
7 . }
8 .
9 . // insert code here
1 0. public void eat() {
1 1. System.out.println("eating dinner");
1 2. }
1 3. }
Which, inserted at lines 5 and 9, allows the file to compile?

正解: E
Which three are legal ways to declare and initialize an instance variable? (Choose three.)

正解: A,B,C
Which two classes make valid use of the ArrayList class in package java.util? (Choose two.)

正解: A,F
Given:
1 . abstract class A {}
2 . class B {}
3 . interface C {}
4 . interface D {}
5 . // insert code here
Which, inserted at line 5, results in a compilation failure?

正解: E
Which four are primitive integer types in Java? (Choose four.)

正解: B,D,F,G