최신 Other Oracle Certification 1Z0-501 무료샘플문제:
1. Which gets the name of the parent directory file "file.txt"?
A) String name= (new File("file.txt")).getParentFile();
B) String name= File.getParentName("file.txt");
C) Directory dir=(new File ("file.txt")).getParentDir();
String name= dir.getName();
D) String name = (new File("file.txt")).getParentName();
E) String name= (new File("file.txt")).getParent();
2. Exhibit:
ClassOne.java
1. package com.abc.pkg1;
2. public class ClassOne {
3. private char var = 'a';
4. char getVar() {return var;}
5. } ClassTest.java
1 . package com.abc.pkg2;
2 . import com.abc.pkg1.ClassOne;
3 . public class ClassTest extends ClassOne {
4 . public static void main(String[]args){
5 .char a = new ClassOne().getVar();
6 .char b = new ClassTest().getVar();
7 .}
8 . }
What is the result?
A) Compilation will fail.
B) Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
C) Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
D) Compilation succeeds and no exceptions are thrown.
3. Exhibit:
1 . package foo;
2 .
3 . import java.util.Vector;
4 .
5 . private class MyVector extends Vector {
6 . int i = 1;
7 . public MyVector(){
8 . i = 2;
9 .}
1 0. }
1 1.
1 2. public class MyNewVector extends MyVector {
1 3. public MyNewVector (){
1 4. i = 4;
1 5. }
1 6. public static void main (String args []){
1 7. MyVector v = new MyNewVector();
1 8.}
1 9. }
The file MyNewVector.java is shown in the exhibit.
What is the result?
A) Compilation will succeed.
B) Compilation will fail at line 6.
C) Compilation will fail at line 14.
D) Compilation will fail at line 5.
E) Compilation will fail at line 17.
4. What is the numerical range of a char?
A) -256 . . . 255
B) Range is platform dependent.
C) 0 . . . 65535
D) -32768 . . . 32767
E) 0 . . . 32767
5. Given:
1 . public class ConstOver {
2 . public ConstOver (int x, int y, int z){
3 .}
4 . }
Which two overload the ConstOver constructor? (Choose Two)
A) Private ConstOver (int z, int y, byte x) { }
B) Public void ConstOver (byte x, byte y, byte z) { }
C) Protected int ConstOver ( ) { }
D) ConstOver ( ) { }
E) Public Object ConstOver (int x, int y, int z) { }
질문과 대답:
질문 # 1 정답: E | 질문 # 2 정답: D | 질문 # 3 정답: D | 질문 # 4 정답: C | 질문 # 5 정답: A,D |