Oracle Upgrade to Java SE 7 Programmer - 1Z1-805 FREE EXAM DUMPS QUESTIONS & ANSWERS
Given the following code fragment:
public class Calc {
public static void main (String [] args) {
//* insert code here Line ** System.out.print("The decimal value is" + var);
}
}
Which three code fragments, when inserted independently at line **, enable the code to compile/
public class Calc {
public static void main (String [] args) {
//* insert code here Line ** System.out.print("The decimal value is" + var);
}
}
Which three code fragments, when inserted independently at line **, enable the code to compile/
Correct Answer: B,C,E
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Given the code fragment:
public static void main(String[] args) { Path dir = Paths.get("d:\\company");
// insert code here. Line **
for (Path entry: stream) {
System.out.println(entry.getFileName());
}
} catch (IOException e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
Which two try statements, when inserted at line 11, enable you to print files with the extensions.java, .htm, end and .jar.
public static void main(String[] args) { Path dir = Paths.get("d:\\company");
// insert code here. Line **
for (Path entry: stream) {
System.out.println(entry.getFileName());
}
} catch (IOException e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
Which two try statements, when inserted at line 11, enable you to print files with the extensions.java, .htm, end and .jar.
Correct Answer: A,B
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Given:

What two changes should you make to apply the DAO pattern to this class?

What two changes should you make to apply the DAO pattern to this class?
Correct Answer: A,B
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
The current working directory is named finance.
Which two code fragments allow you to write the salary.dat file if it does not exist under "finance\payroll"?
Which two code fragments allow you to write the salary.dat file if it does not exist under "finance\payroll"?
Correct Answer: A,E
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Given the code fragment:
public class TestString {
public static void main(String[] args) {
String str=null;
switch(str) {
case "":
System.out.println("blank"); break;
case "null":
System.out.println("NULL"); break;
default:
System.out.println("invalid"); break;
}
}
}
What is the result?
public class TestString {
public static void main(String[] args) {
String str=null;
switch(str) {
case "":
System.out.println("blank"); break;
case "null":
System.out.println("NULL"); break;
default:
System.out.println("invalid"); break;
}
}
}
What is the result?
Correct Answer: D
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Given the following incorrect program:
class MyTask extends RecursiveTask<Integer> {
final int low;
final int high;
static final int THRESHOLD = /* . . . */
MyTask (int low, int high) { this.low = low; this.high = high; }
Integer computeDirectly()/* . . . */
protected void compute() {
if (high - low <= THRESHOLD)
return computeDirectly();
int mid = (low + high) / 2;
invokeAll(new MyTask(low, mid), new MyTask(mid, high));
Which two changes make the program work correctly?
class MyTask extends RecursiveTask<Integer> {
final int low;
final int high;
static final int THRESHOLD = /* . . . */
MyTask (int low, int high) { this.low = low; this.high = high; }
Integer computeDirectly()/* . . . */
protected void compute() {
if (high - low <= THRESHOLD)
return computeDirectly();
int mid = (low + high) / 2;
invokeAll(new MyTask(low, mid), new MyTask(mid, high));
Which two changes make the program work correctly?
Correct Answer: B,C
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Given:
Person
public Person(int id)
public int getid()
public String getContactDetails()
public void setContactDetails(String contactDetails) public String getName()
public void setName(String name)
public Person getPerson(int id) throws Exception
public void createPerson(int id) throws Exception
public Person deletePerson(int id) throws Exception
public void updatePerson(Person p) throws Exception
Which group of methods is moved to a new class when implementing the DAO pattern?
Person
public Person(int id)
public int getid()
public String getContactDetails()
public void setContactDetails(String contactDetails) public String getName()
public void setName(String name)
public Person getPerson(int id) throws Exception
public void createPerson(int id) throws Exception
public Person deletePerson(int id) throws Exception
public void updatePerson(Person p) throws Exception
Which group of methods is moved to a new class when implementing the DAO pattern?
Correct Answer: D
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Given the code fragment:
SimpleDateFormat sdf;
Which code fragment displays the two-digit month number?
SimpleDateFormat sdf;
Which code fragment displays the two-digit month number?
Correct Answer: A
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Which two file attribute views support reading or updating the owner of a file?
Correct Answer: B,E
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).