問題1
Consider the following database table: Inventory Table
*Item_ID, Integer: PK
*Item_name, Varchar (20)
*Price, Numeric (10, 2)
*Quan, Integer
Consider the following method that updates the prices in the Inventory table:
public static void updatePrices{ // #1: missing line
Connection con) throws SQLException {
// #2: missing line
PreparedStatement updatePrices = con.prepareStatement (updatePricesString);
// #3: missing line { // #4: missing line updatePrices.executeUpdate(); } }
This method us missing four lines, which group of lines complete this method?
Consider the following database table: Inventory Table
*Item_ID, Integer: PK
*Item_name, Varchar (20)
*Price, Numeric (10, 2)
*Quan, Integer
Consider the following method that updates the prices in the Inventory table:
public static void updatePrices{ // #1: missing line
Connection con) throws SQLException {
// #2: missing line
PreparedStatement updatePrices = con.prepareStatement (updatePricesString);
// #3: missing line { // #4: missing line updatePrices.executeUpdate(); } }
This method us missing four lines, which group of lines complete this method?
正確答案: D
說明:(僅 NewDumps 成員可見)
問題2
Given:
public class StringApp {
public static void main(String[] args) {
String[] str="Java SE,java EE,Java ME,java FX".split(",");
int count=0;
for(int i=0;i<str.length;i++) {
switch(str[i]) {
case "Java SE":
count++; continue;
case "Java EE":
count++; break;
case "Java ME":
count++; break;
case "Java FX":
count++; break;
}
}
System.out.println("Total match found="+count);
}
}
What is the result?
Given:
public class StringApp {
public static void main(String[] args) {
String[] str="Java SE,java EE,Java ME,java FX".split(",");
int count=0;
for(int i=0;i<str.length;i++) {
switch(str[i]) {
case "Java SE":
count++; continue;
case "Java EE":
count++; break;
case "Java ME":
count++; break;
case "Java FX":
count++; break;
}
}
System.out.println("Total match found="+count);
}
}
What is the result?
正確答案: C
說明:(僅 NewDumps 成員可見)
問題3
What statement is true about thread starvation?
What statement is true about thread starvation?
正確答案: D
說明:(僅 NewDumps 成員可見)
問題4
Given the code fragment:
/* method declaration */ { try {
String className = "java.lang.String";
String fieldname = "somefield";
Class c = Class.forName(className);
Field f = c.getField(fieldname);
} catch(Exception e) {
e.printStackTrace();
throw e;
}
}
Which two method declarations are valid options to replace /* method declaration */?
Given the code fragment:
/* method declaration */ { try {
String className = "java.lang.String";
String fieldname = "somefield";
Class c = Class.forName(className);
Field f = c.getField(fieldname);
} catch(Exception e) {
e.printStackTrace();
throw e;
}
}
Which two method declarations are valid options to replace /* method declaration */?
正確答案: B,E
說明:(僅 NewDumps 成員可見)
問題5
Which two statements are true?
Which two statements are true?
正確答案: B,C
說明:(僅 NewDumps 成員可見)
問題6
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?
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?
正確答案: B,F
說明:(僅 NewDumps 成員可見)
問題7
Given the code fragment:
try {
String query = "SELECT * FROM Employee WHERE ID=110";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query); // Line 13
System.out.println("Employee ID: " + rs.getInt("ID")); // Line 14
} catch (Exception se) {
System.out.println("Error");
}
Assume that the SQL query matches one record. What is the result of compiling and executing this code?
Given the code fragment:
try {
String query = "SELECT * FROM Employee WHERE ID=110";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query); // Line 13
System.out.println("Employee ID: " + rs.getInt("ID")); // Line 14
} catch (Exception se) {
System.out.println("Error");
}
Assume that the SQL query matches one record. What is the result of compiling and executing this code?
正確答案: D
說明:(僅 NewDumps 成員可見)
問題8
Given the code fragment: public class Test {
public static void main (String [] args) {
Path path1 = Paths.get("D:\\sys\\asm\\.\\data\\..\\..\\mfg\\production.log");
System.out.println(path1.normalize());
System.out.println(path1.getNameCount());
}
}
What is the result?
Given the code fragment: public class Test {
public static void main (String [] args) {
Path path1 = Paths.get("D:\\sys\\asm\\.\\data\\..\\..\\mfg\\production.log");
System.out.println(path1.normalize());
System.out.println(path1.getNameCount());
}
}
What is the result?
正確答案: A
說明:(僅 NewDumps 成員可見)
問題9
Which two statements are true about RowSet subinterfaces?
Which two statements are true about RowSet subinterfaces?
正確答案: A,D
說明:(僅 NewDumps 成員可見)