Tuesday, April 29, 2008

Oracle job sample paper 3

Oracle job sample paper 3

1. java ExceptionClassesTest 10
2. java ExceptionClassesTest 20
3. java ExceptionClassesTest 30

(A) Cannot do the above because the program will give compilation error 'unreported exception java.lang.ExceptionClass1; declared to be thrown'
(B) ExceptionClass1( twice ), ExceptionClass2 ( twice ), No output
(C) ExceptionClass1( once ), ExceptionClass2( twice ), No output
(D) Cannot do the above because the program will give compilation error 'incompatible types found : ExceptionClass1, required: java.lang.Throwable'

2. When trying to establish a JDBC connection, it fails with the message "Driver not found".

This is due to

(A) The DriverManager class is not found
(B) The JDBC driver is not registered
(C) The JDBC driver does not exist in the CLASSPATH
(D) The Connection class is not found

3.

public class Select {

public static void main (String args[]) {
String url = "jdbc:oracle://Carthage.imaginary.com/ora";
Connection con = null;

try {
String driver = "com.imagiary.sql.oracle.OracleDriver";
Class.forName(driver).newInstance();
}
catch (Exception e) {
System.out.println("Failed to load Oracle Driver.");
return;
}

try {
con = DriverManager.getConnection(url, "borg", "");
Statement select = con.createStatement();
ResultSet result = select.executeQuery("SELECT DATE_OF_JOINING from EMP");

While (result.next()) {
System.out.println("The date of joining is " + result.getString(1));
}
}
}
}

Note: the column DATE OF JOINING is not null and it always has a value.

What would be the output of this code?

(A) This code does not compile
(B) "The date of joining is 01-JUN-1999″. (The sample date fetched by the SQL stmt)
(C) The code complies but results in run-time exception
(D) "The date of joining is ". ( The date is null)

4. As far as handling null values in JAVA and SQL is concerned which of the following statements is wrong?

(A) For Java Objects SQL NULL maps to JAVA NULL
(B) While using the method getInt( ), the JAVA NULL maps the SQL NULL
(C) a Java ResultSet has no way of representing a SQL NULL value for any numeric SQL column
(D) Call to getInt() could return some driver attempt at representing NULL, most likely 0.

5. As per the JDBC Specification for SQL to Java Datatype Mappings, which of the following statements is correct?

(A) The SQL datatype FLOAT maps to the Java datatype float
(B) The SQL datatype FLOAT maps to the Java datatype long
(C) The SQL datatype FLOAT maps to the Java datatype double
(D) The SQL datatype FLOAT maps to the Java datatype int

6. Which of the following is not valid array declarations/definitions?

(A) int iArray1[10];
(B) int iArray2[];
(C) int iArray3[] = new int[10];
(D) int []iArray5 = new int[10];

7. As per the JDBC Specification for Java to SQL Datatype Mappings, which of the following statements is correct?

(A) The Java datatype float maps to the SQL datatype REAL
(B) The Java datatype float maps to the SQL datatype DOUBLE
(C) The Java datatype float maps to the SQL datatype INTEGER
(D) The Java datatype float maps to the SQL datatype SMALLINT

8. Which of the following is a legal return type of a method overloading the following method:

public void add(int a) { …. }

(A) void
(B) int
(C) Can be anything
(D) short

9. Which of the following is not one of the methods for the class DriverManager?

(A) static public synchronized Connection getConnection ( String url, Properties info) throws SQLException
(B) static public synchronized Connection getConnection ( String url,Strng user, String password) throws SQLException
(C) static public synchronized Connection getConnection ( String url ) throws SQLException
(D) static public synchronized Connection getConnection ( String url, Strng user, String password, Properties info) throws SQLException

10. Which of the following is false with respect to updateable result sets

(A) The select should pertain to a single table and should include the primary key columns
(B) JDBC drivers are not required to support updateable result sets
(C) If the driver does not support updateable result set, it will always throw an exception
(D) If the driver does not support updateable result set, it will issue a SQLWarning and assigns the result set to a type it can support.

11. Which of the following is not true about jsp:forward

(A) This allows the request to be forwarded to another JSP, a servlet or a static resource.
(B) The resource to which the request is being forwarded should be in the same context as the JSP dispatching the request
(C) Execution in the current JSP stops when it encounters jsp:forward tag
(D) The output stream need not be buffered and it can contain some output written to it.

12. A session has been created by the client. If the client does not continue the session within a specified time, which of the following will not happen

(A) the server will expire the session and delete all data associated with the session
(B) the server will expire the session but the data associated with the session are retained
(C) The session key is invalidated
(D) The old session key is not associated with any session

13. What is the output of the following program

class getBoolValues {
public static void main (String args[]) {
boolean a = true;
boolean b = false;
boolean c = a ^ b;
boolean d = (!a & b) | (a & !b)
System.out.println(" a ^ b = " + c);
System.out.println(" !a&b|a&!b = " + d);
}
}

(A) The code does not compile.
(B) a ^ b = true
!a&b|a&!b = true
(C) The code compiles but raises an exception during runtime.
(D) a ^ b = true
!a&b|a&!b = false

14. What is the output of the following program

class questionA {
public static void main ( String args[] ) {
int i, k;
i = 10;
k = i 4) & 0xf ] + Que[ e & 0×0f ] );
}
}

(A) 0xf1
(B) 0xff
(C) 0xf0
(D) 0×0f

0 comments: