Given:
and the code fragment:
Which two code fragments, when inserted at line n1 independently, enable the code to print TruckCarBike?
Correct Answer:B
Given the code fragments:
interface CourseFilter extends Predicate
return str.equals (“Java”);
}
}
and
List
Predicate cf2 = new CourseFilter() { //line n1 public boolean test (String s) {
return s.contains (“Java”);
}
};
long c = strs.stream()
.filter(cf1)
.f ilter(cf2 //line n2
.count(); System.out.println(c); What is the result?
Correct Answer:B
Given the content of Operator.java, EngineOperator.java, and Engine.java files:
and the code fragment:
What is the result?
Correct Answer:A
Given the records from the Employee table:
and given the code fragment: try {
Connection conn = DriverManager.getConnection (URL, userName, passWord); Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
st.execute(“SELECT*FROM Employee”); ResultSet rs = st.getResultSet();
while (rs.next()) {
if (rs.getInt(1) ==112) { rs.updateString(2, “Jack”);
}
}
rs.absolute(2);
System.out.println(rs.getInt(1) + “ “ + rs.getString(2));
} catch (SQLException ex) { System.out.println(“Exception is raised”);
}
Assume that:
The required database driver is configured in the classpath.
The appropriate database accessible with the URL, userName, and passWord exists. What is the result?
Correct Answer:A
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:
What is the result?
Correct Answer:A
Given the Greetings.properties file, containing:
and given:
What is the result?
Correct Answer:A