OCA_Java7_dump.pdf
(
412 KB
)
Pobierz
Oracle 1z0-803
Java SE 7 Programmer I
Version: 6.10
Oracle 1z0-803 Exam
QUESTION NO: 1
Given the code fragment:
int [] [] array2D = {{0, 1, 2}, {3, 4, 5, 6}};
system.out.print (array2D[0].length+ "" );
system.out.print(array2D[1].getClass(). isArray() + "");
system.out.println (array2D[0][1]);
What is the result?
A.
3false1
B.
2true3
C.
2false3
D.
3true1
E.
3false3
F.
2true1
G.
2false1
Answer: D
Explanation:
The length of the element with index 0, {0, 1, 2}, is 3. Output: 3
The element with index 1, {3, 4, 5, 6}, is of type array. Output: true
The element with index 0, {0, 1, 2} has the element with index 1: 1. Output: 1
QUESTION NO: 2
View the exhibit:
public class Student {
public String name = "";
public int age = 0;
public String major = "Undeclared";
public boolean fulltime = true;
"Pass Any Exam. Any Time." - www.actualtests.com
2
Oracle 1z0-803 Exam
public void display() {
System.out.println("Name: " + name + " Major: " + major);
}
public boolean isFullTime() {
return fulltime;
}
}
Given:
Public class TestStudent {
Public static void main(String[] args) {
Student bob = new Student ();
Student jian = new Student();
bob.name = "Bob";
bob.age = 19;
jian = bob; jian.name = "Jian";
System.out.println("Bob's Name: " + bob.name);
}
}
What is the result when this program is executed?
A.
Bob's Name: Bob
B.
Bob's Name: Jian
C.
Nothing prints
D.
Bob’s name
Answer: B
Explanation:
After the statement jian = bob; the jian will reference the same object as bob.
"Pass Any Exam. Any Time." - www.actualtests.com
3
Oracle 1z0-803 Exam
QUESTION NO: 3
Given the code fragment:
String valid = "true";
if (valid) System.out.println (“valid”);
else system.out.println ("not valid");
What is the result?
A.
Valid
B.
not valid
C.
Compilation fails
D.
An IllegalArgumentException is thrown at run time
Answer: C
Explanation:
In segment 'if (valid)' valid must be of type boolean, but it is a string.
This makes the compilation fail.
QUESTION NO: 4
Given:
public class ScopeTest {
int z;
public static void main(String[] args){
ScopeTest myScope = new ScopeTest();
int z = 6;
System.out.println(z);
myScope.doStuff();
System.out.println(z);
System.out.println(myScope.z);
}
"Pass Any Exam. Any Time." - www.actualtests.com
4
Oracle 1z0-803 Exam
void doStuff() {
int z = 5;
doStuff2();
System.out.println(z);
}
void doStuff2() {
z=4;
}
}
What is the result?
A.
6 5 6 4
B.
6 5 5 4
C.
6 5 6 6
D.
6 5 6 5
Answer: A
Explanation:
Within main z is assigned 6. z is printed. Output: 6
Within doStuff z is assigned 5.DoStuff2 locally sets z to 4 (but MyScope.z is set to 4), but in
Dostuff z is still 5. z is printed. Output: 5
Again z is printed within main (with local z set to 6). Output: 6
Finally MyScope.z is printed. MyScope.z has been set to 4 within doStuff2(). Output: 4
QUESTION NO: 5
Which two are valid instantiations and initializations of a multi dimensional array?
A.
int [] [] array 2D = { { 0, 1, 2, 4} {5, 6}};
B.
int [] [] array2D = new int [2] [2];
array2D[0] [0] = 1;
array2D[0] [1] = 2;
array2D[1] [0] = 3;
array2D[1] [1] = 4;
C.
int [] [] [] array3D = {{0, 1}, {2, 3}, {4, 5}};
"Pass Any Exam. Any Time." - www.actualtests.com
5
Plik z chomika:
riot000
Inne pliki z tego folderu:
OCAJP Oracle Certified Associate Java SE 7 Programmer Practice Exams.pdf
(43985 KB)
1354098917.pdf
(4608 KB)
DSDM.pdf
(3854 KB)
1Z0-545.rar
(94 KB)
Diagnoza_coaching1.pdf
(2571 KB)
Inne foldery tego chomika:
Lynda.com- Foundations of Programming Code Efficiency
MEAN
Project_manager
UML
wireshark
Zgłoś jeśli
naruszono regulamin