1.
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/
2.
Given the code fragment:
String query = "SELECT ID FROM Employee"; \\ Line 1
try (Statement stmt = conn.CreateStatement()) { \\ Line 2
ResultSet rs = stmt.executeQuery(query); \\ Line 3
stmt.executeQuery ("SELECT ID FROM Customer"); \\ Line 4
while (rs.next()) {
\\process the results
System.out.println ("Employee ID: " + rs.getInt("ID") );
}
} catch (Exception e) {
system.out.println ("Error");
}
Assume that the SQL queries return records. What is the result of compiling and executing this code fragment?
3.
Given a language code of fr and a country code of FR, while file name represents a resource bundle file name that is not the default?
4.
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?
5.
Given the code fragment:
SimpleDateFormat sdf = new SimpleDateFormat("zzzz", Locale.US); System.out.println ("Result: " + sdf.format(today) ) ;
What type of result is printed?
6.
The advantage of a CallableStatement over a PreparedStatement is that it:
7.
Given:
class Fibonacci extends RecursiveTask
return f1.join() + f2.compute(); // Line **

Assume that line ** is replaced with:
}
}
return f2.compute() + f1.join; // Line **
Fibonacci f2 = new Fibonacci (n 2);
f1.fork;
Fibonacci f1 = new Fibonacci (n 1);
return n;
if (n <= 1)
Integer compute () {
Fibonacci (int n) { this.n = n }
final int n;
{
What is the likely result?
8.
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?
9.
Given the code fragment:
Path path1 = Paths.get("D:\\sales\\.\\quarterly\\..\\report"); path1 = path1.normalize();
Path path2 = path1.relativize(Paths.get("d:\\empdetails.dat")); path2 = path2.resolve(path1);
System.out.println(path1);
System.out.println(path2);
}
What is the result?
10.
Given the code fragment:
public void processFile() throws IOException, ClassNotFoundException { try (FileReader fr = new FileReader ("logfilesrc.txt");
FileWriter fw = new FileWriter ("logfiledest.txt")) {
Class c = Class.forName ("java.lang.JString");
}
}
If exception occur when closing the FileWriter object and when retrieving the JString class object, which exception object is thrown to the caller of the processFile
method?