1. The java.nio.file package has improved exception handling.
True or false?
_______________________
true
2. The java.io package has problems with no support for symbolic links.
True or false?
___________________
true
3. An absolute path always starts from the drive letter or mount point.
_______________
true
4. The Files class can perform which of the following functions?
____________________
Creates files
5. Which of the following files are not required to be uploaded to a web server to
deploy a JWS java application/applet?
_______________________
.java files
6. The method for connecting a java application to a database is JNLP.
True or false?
___________________
false
7. To deploy java applications you may use Java Web Start.
True or false?
__________________
true
8. The method for connecting a Java application to a database is by using:
___________________
JDBC
9. If a class is in a package, the system's CLASSPATH must be altered to access the
class.
True or false?
_________________
false
11. The Paths class provides a static get() method to find a valid Path.
True or false?
________________
true
12. Which statement determine that "java" is a directory?
___________________
Boolean isDir=(new Directory("java")).exists();
13. File permissions are the same across all of the different operating systems.
__________________
false
15. Which of the following is a valid JDBC URL?
____________________
jdbc:oracle:thin:dfot/dfot@localhost:1521/xepdb1
16. Which of the following classes or interfaces are included in the database
vendor driver library? (Choose two)
(Choose all correct answers)
_________________________
Statement interface implementation
Javax.sql.DataSource implementation
17. The java.sql.DriverManager class will typically be registered with a naming
service based on the Java Naming Directory (JNDI) API.
__________________________
false
18. You must explicitly close ResultSet and Statement objects once they are no
longer in use.
_________________________
true
19. Which of the following can fill in the //INSERT HERE correctly? (Choose Two)
ResultSet rset = stmt.executeQuery(sqlQuery);
if(rs.next()){
//INSERT HERE
}
_____________________
Object s = rs.getObject(1);
20. Which type of Statement can execute parameterized queries?
_______________________
PreparedStatement
21. Which the following statements is NOT TRUE about DataSource?
_____________________
DataSource can manage a set of JDBC Drivers registered in the system.
22. JDBC has a type system that can control the conversion between Oracle database
types and Java types.
____________________________
true
23. Which of the following is the correct statement be inserted at //INSERT CODE
location that calls the database-stored procedure sayHello?
class Test{
public static void main(String[] args) {
try {
Connection conn = getConnection();
//INSERT CODE
cstat.setString(1, "Hello");
cstat.registerOutParameter(2, Types.NUMERIC);
cstat.setInt(2, 10);
}
catch(SQLException e){}
}
}
_________________________
CallableStatement cstat = con.prepareCall("{call sayHello(?, ?)}");
24. Given the java snippet below:
public class Foo{
int x;
public void testFoo(){
int y=100;
}
}
Which of the following statements is TRUE?
________________________
Variable x resides in the heap area, and variable y resides in the stack of the JVM
25. Java allows the same Java program to be executed on multiple operating systems.
_______________________________
true
26. Where does an object of a class get stored?
________________________
Heap area
27. During runtime, the Java platform loads classes dynamically as required.
_____________________________
true
28. Which of the following statements describe the Java programming language?
_______________________________
All of the above
29. Which of following statements describes Parallel and Serial Garbage collection?
________________________________
A Parallel garbage collector uses multiple threads to manage heap space.
30. Given the following output from the Minor GC:
[GC [DefNew: 4032K->64K(4032K), 0.0429742 secs] 9350K->7748K(32704K), 0.0431096
secs]
What estimated percentage of the Java objects will be promoted from Young space to
Tenured space?
__________________________
0.6
31. Which of the following allows the programmer to destroy an object referenced by
x?
______________________________
Only the garbage collection system can destroy an object.
32. Given the following output from the Minor GC:
[GC [DefNew: 4032K->64K(4032K), 0.0429742 secs] 9350K->7748K(32704K), 0.0431096
secs]
Which of the following statements is TRUE?
_____________________________
Young Generation usage decreased by 3968k.
33. The bytecode for a Java method is located in which structure in the Java class
file?
_______________________________
method_info
34. In a valid Java class file, the magic number is always:
___________________________
CAFEBABE
35. Given the following class structure:
public class Shape{
void foo(){}
}
public class Circle extends Shape{
void draw(){}
}
Which of the following statements is TRUE?
_______________________________
The foo method definition is only contained in the Shape class.
36. Given the following declaration of the method test:
public static void test(String s, int i);
Which of the following is the descriptor of the test method in the class file?
_________________________________
(Ljava/lang/String;I)V
37. Given the following information in the jdb tool, jdb paused at line 11:
9 public static void method1(){
10 x=100;
11 }
public static void method1();
Code:
0: bipush 100
2: putstatic #7 //Field x:I
5: return
Which statement is true?
Step completed: "thread-main", Example.method1(), line=11 bci=5
________________________________
The bci=5 means the jdb executed the last bytecode instruction in the method1
method.
38. Which of the following commands can be used to monitor the Java Virtual Machine
statistics?
_________________________________
jstat
39. Before we can use the jsat tool we first have to use the jps tool to obtain JVM
process id numbers.
________________________________
true
40. Which of the following commands can be used to translate Java source code into
bytecode?
_____________________________
javac
41. Which of the following statements is NOT TRUE for the jdb command?
____________________________________
jdb can track the GC activity of the program.
42. The Java developer can define a number of additional or custom classloaders.
______________________________________
true
43. The same class cannot be loaded by the JVM more than one time.
____________________________
true
44. .class files are loaded into memory all at once, when a Java application is
launched.
__________________________
false
45. In the ClassLoader hierarchy, which of the following is the only class loader
that does NOT have a parent?
_____________________________
bootstrap class loader
46. Which of the following is NOT a java class loader?
_______________________________
verification class loader
47. Choose which opcode is used to fetch a field from object.
_______________________________
getfield
48. Choose which opcode is used to push an int constant 5 onto the operand stack.
_____________________________
iconst_5
49. Bytecode is an intermediate representation of a program, somewhere between
source code and machine code.
______________________
true
50. opcode invokespecial is used to invoke an instance initialization method.
_____________________________
true