SCJP刷题笔记(Part ten)

QUESTION 91
Given the content of the employee.txt file:
Every worker is a master.
Given that the employee.txt file is accessible and the file allemp.txt does NOT exist, and the code
fragment:
SCJP刷题笔记(Part ten)
What is the result?
A. Exception 1
B. Exception 2
C. The program executes, does NOT affect the system, and produces NO output.
D. allemp.txt is created and the content of employee.txt is copied to it.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
 
 
 
QUESTION 92
Given:
SCJP刷题笔记(Part ten)
What is the result?
A. IT:null
B. A NullPointerException is thrown at run time.
C. A compilation error occurs.
D. IT:0.0
Correct Answer: D
Section: (none)
ExplanationExplanation/Reference:
 
 
 
QUESTION 93
Given the code fragment:
SCJP刷题笔记(Part ten)
What is the result?
A. A compilation error occurs.
B. [Java, J2EE, J2ME, JSTL, JSP]
C. null
D. [Java, J2EE, J2ME, JSTL]
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
 
 
 
QUESTION 94
Given:
SCJP刷题笔记(Part ten)
and the code fragment:
SCJP刷题笔记(Part ten)
What is the result?
A. true
true
B. false
true
C. false
false
D. true
false
Correct Answer: DSection: (none)
Explanation
Explanation/Reference:
 
 
 
QUESTION 95
Given:
SCJP刷题笔记(Part ten)
and the code fragment:
SCJP刷题笔记(Part ten)
What is the result?
A. A compilation error occurs at line n2.
B. A compilation error occurs because the try block doesn’t have a catch or finally block.
C. A compilation error occurs at line n1.
D. The program compiles successfully.
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
 
 
 
QUESTION 96
Given the code fragment:
SCJP刷题笔记(Part ten)
and the information:
The required database driver is configured in the classpath.The appropriate database is accessible with the dbURL, username, and passWord exists.
What is the result?
A. A ClassNotFoundException is thrown at runtime.
B. The program prints nothing.
C. The program prints Connection Established.
D. A SQLException is thrown at runtime.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
 
 
 
QUESTION 97
In 2015, daylight saving time in New York, USA, begins on March 8th at 2:00 AM. As a result, 2:00 AM
becomes 3:00 AM.
Given the code fragment:
SCJP刷题笔记(Part ten)
Which is the result?
A. 3:00 – difference: 2
B. 2:00 – difference: 1
C. 4:00 – difference: 3
D. 4:00 – difference: 2
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
 
 
 
QUESTION 98
 
Given the code fragment:
SCJP刷题笔记(Part ten)
Which is the valid definition of the Course enum?
SCJP刷题笔记(Part ten)
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
 
 
 
QUESTION 99
Given:
SCJP刷题笔记(Part ten)
and this code fragment:
SCJP刷题笔记(Part ten)
What is the result?
A. Open-Close–
Exception – 1
Open–Close–
B. Open–Close–Open–Close–
C. A compilation error occurs at line n1.
D. Open–Close–Open–
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
 
 
 
QUESTION 100
Given the code fragment:
SCJP刷题笔记(Part ten)
Which code fragment, when inserted at line n1, ensures false is printed?
A. boolean b = cs.stream() .findAny() .get() .equals(“Java”);
B. boolean b = cs.stream() .anyMatch (w -> w.equals (“Java”));
C. boolean b = cs.stream() .findFirst() .get() .equals(“Java”);
D. boolean b = cs.stream() .allMatch(w -> w.equals(“Java”));
Correct Answer: BSection: (none)
Explanation
Explanation/Reference: