Practice Java SE 1z1-811 exam. Online Exam Practice Tests with detailed explanations! Pass 1z1-811 with confidence!
1z1-811 - Java Foundations Practice Tests 2023 | ExamcollectionPass
NEW QUESTION # 22
Given the code fragment:
What is the result?
- A. Selected null flavor.
- B. Selected Chocolate flavor.
- C. An ArrayIndexOutofBoundsException is thrown at run time.
- D. Selected Chocolate flavor.
Answer: C
NEW QUESTION # 23
Given these class definitions:
Which class or classes compile?
- A. only MyClassB, MyClassC, and MyClassD
- B. only MyClassB and MyClassD
- C. MyClassA, MyClassB, MyClassC, and MyClassD
- D. only MyClassB
Answer: B
NEW QUESTION # 24
Given the code fragment:
Which for loop statement can be used to print 135?
- A. for(int idx = 0; 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 = 1; idx < arr.length; idx+=2) {
System.out.print (arr[idx]);
}
Answer: A
NEW QUESTION # 25
Given the code fragment:
Which code fragment can be inserted at line n1 to enable the code to compile?
- A. int[] num;
- B. int num[10];
- C. new int num[];
- D. int[10] num;
Answer: A
NEW QUESTION # 26
Given the code fragment:
What is the result?
- A. Julia
Peter - B. A compilation error occurs.
- C. Peter
Julia - D. A runtime exception is thrown.
Answer: A
NEW QUESTION # 27
Given:
Which statement is true about the main method?
- A. It can be a non-static method.
- B. It cannot be defined in a non-public class.
- C. It cannot be invoked by its name.
- D. Its parameter can be of type Integer [].
Answer: C
NEW QUESTION # 28
Given the code fragment:
Which code fragment can be inserted at line n1 to enable the code to print 0.0?
- A. Ball b = new Ball(0.0);
- B. Ball b = null;
b.weight = 0.0; - C. Ball b = new Ball();
- D. Ball.weight = 0.0;
Answer: C
NEW QUESTION # 29
Given the code fragment:
Which code fragment, when inserted at line n1, enables the code to print one?
- A. String var = "1";
- B. char var = '1';
- C. int var = 1;
- D. String var = 1;
Answer: A
NEW QUESTION # 30
Given the code fragment:
What is the result?
- A. pen pencil erasers paper
- B. A runtime exception is thrown.
- C. paper pen pencil erasers
- D. A compilation error occurs.
Answer: B
NEW QUESTION # 31
Which statement is true about exception handling?
- 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.
Answer: D
NEW QUESTION # 32
Given the code fragment:
What is the result?
- A. true
false - B. true
true - C. false
true - D. false
false
Answer: B
NEW QUESTION # 33
Given the code fragment:
Which statement, when inserted at line n1, enables the code to print 0 2 4 6 8 10?
- A. count = (count++) +1;
- B. count =+ 2;
- C. count += 2;
- D. count = count++;
Answer: C
NEW QUESTION # 34
Identify two valid data types for the operands of the addition (+) operator?
- A. array
- B. boolean
- C. string
- D. numeric
Answer: A,C
NEW QUESTION # 35
Given the code fragment:
What is the result?
- A. true
true
true
false - B. false
false
false
false - C. true
true
true
true - D. true
false
false
false
Answer: C
NEW QUESTION # 36
Given the code fragment:
What is the result?
- A. 0
- B. Nothing is printed.
- C. 1
- D. 2
Answer: C
NEW QUESTION # 37
Given:
And the code fragment:
What is the result?
- A. White : null
- B. null: null
- C. A compilation error occurs at line n1.
- D. White : White
Answer: B
NEW QUESTION # 38
......
The best 1z1-811 exam study material and preparation tool is here: https://www.examcollectionpass.com/Oracle/1z1-811-practice-exam-dumps.html