JAVA-J2EE Sample Papers

Q.- Which of these can be used to fully abstract a class from its implementation?

    1. 1. Objects
    2. 2. Packages
    3. 3. Interfaces
    4. 4. None

3

Q.- What will be the output of the program?public class Test { public static void main (String args[]) { String str = NULL; System.out.println(str); } }

    1. 1. NULL
    2. 2. Compile Error
    3. 3. Code runs but no output
    4. 4. Runtime Exception

2

Q.- Which of these stream contains the classes which can work on character stream?

    1. 1. InputStream
    2. 2. OutputStream
    3. 3. Character Stream
    4. 4. All of the mentioned

3

Q.- What is the difference between a TextArea and a TextField?

    1. 1. A TextArea can handle multiple lines of text
    2. 2. A textarea can be used for output
    3. 3. TextArea is not a class
    4. 4. TextAreas are used for displaying graphics

1

Q.- Hibernate is an?

    1. 1. Open Source
    2. 2. Lightweight
    3. 3. ORM
    4. 4. All mentioned above

4

Q.- Applet works at client side so less response time.

    1. 1. TRUE
    2. 2. FALSE
    3. 3. 1
    4. 4.

Q.- Which object of HttpSession can be used to view and manipulate information about a session?

    1. 1. creation time
    2. 2. session identifier
    3. 3. last accessed time
    4. 4. All of the mentioned

4

Q.- When does Exceptions in Java arises in code sequence?

    1. 1. Run Time
    2. 2. Compilation Time
    3. 3. Can Occur Any Time
    4. 4. None of the mentioned

1

Q.- Which method is used to change the name of a thread?

    1. 1. public String getName()
    2. 2. public void setName(String name)
    3. 3. public void getName()
    4. 4. public String setName(String name)

2

Q.- What technique is used for the authentication mechanism in the servlet specification?

    1. 1. Role Based Authentication
    2. 2. Form Based Authentication
    3. 3. Both 1 & 2
    4. 4. None of the above

1

Q.- Which is true about an anonymous inner class?

    1. 1. It can extend exactly one class and implement exactly one interface.
    2. 2. It can extend exactly one class and can implement multiple interfaces.
    3. 3. It can extend exactly one class or implement exactly one interface.
    4. 4. It can implement multiple interfaces regardless of whether it also extends a class.

3

Q.- Which method returns the interrupted flag after that it sets the flag to false if it is true?

    1. 1. isInterrupted()
    2. 2. static interrupted()
    3. 3. non static interrupted()
    4. 4. Both 1 and 3

2

Q.- Servlets handle multiple simultaneous requests by using threads.

    1. 1. 1
    2. 2. 0
    3. 3. 1
    4. 4.

Q.- What does the Session object hold?

    1. 1. First Level Cache
    2. 2. Second Level Cache
    3. 3. Both 1 & 2
    4. 4. None of the above

1

Q.- Struts supports which of these model components?

    1. 1. JavaBeans
    2. 2. EJB
    3. 3. CORBA
    4. 4. JDO

All of the above

Q.- Which interface does java.util.Hashtable implement?

    1. 1. Java.util.Map
    2. 2. Java.util.List
    3. 3. Java.util.HashTable
    4. 4. Java.util.Collection

1

Q.- Which of the following package stores all the standard java classes?

    1. 1. lang
    2. 2. java
    3. 3. util
    4. 4. java.packages

2

Q.- Which methods returns a stream that simply provides the raw bytes from the database without any conversion?

    1. 1. getCharacterStream
    2. 2. getBinaryStream
    3. 3. getAsciiStream
    4. 4. getUnicodeStream

2

Q.- Which cannot directly cause a thread to stop executing?

    1. 1. Calling the SetPriority() method on a Thread object.
    2. 2. Calling the wait() method on an object.
    3. 3. Calling notify() method on an object.
    4. 4. Calling read() method on an InputStream object.

3

Q.- Which of these class can be used to implement input stream that uses a character array as the source?

    1. 1. BufferedReader
    2. 2. FileReader
    3. 3. CharArrayReader
    4. 4. FileArrayReader

3

Q.- Which of the following is part of Data Access layer in Spring framework?

    1. 1. Beans
    2. 2. Aspects
    3. 3. JMS
    4. 4. Context

3

Q.- Which of these method of String class is used to obtain character at specified index?

    1. 1. char()
    2. 2. Charat()
    3. 3. charat()
    4. 4. charAt()

4

Q.- Which type of ServletEngine is a server that includes built-in support for servlets?

    1. 1. Add-on ServletEngine
    2. 2. Embedded ServletEngine
    3. 3. Standalone ServletEngine
    4. 4. None of the above

3

Q.- What is the output of this program? class exception_handling { public static void main(String args[]) { try { System.out.print("Hello" + " " + 1 / 0); } catch(ArithmeticException e){ System.out.print("World"); } } }

    1. 1. Hello
    2. 2. World
    3. 3. HelloWorld
    4. 4. Hello World

2

Q.- In JSP Action tags which tags are used for bean development?

    1. 1. jsp:useBean
    2. 2. jsp:setPoperty
    3. 3. jsp:getProperty
    4. 4. All mentioned above

4

Q.- The Comparable interface contains which called?

    1. 1. toCompare
    2. 2. compare
    3. 3. compareTo
    4. 4. compareWith

3

Q.- Which constructor creates an empty string buffer with the specified capacity as length.

    1. 1. StringBuffer()
    2. 2. StringBuffer(String str)
    3. 3. StringBuffer(int capacity)
    4. 4. All of the mentioned

3

Q.- Which constructs an anonymous inner class instance?

    1. 1. Runnable r = new Runnable() { };
    2. 2. Runnable r = new Runnable(public void run() { });
    3. 3. Runnable r = new Runnable { public void run(){}};
    4. 4. System.out.println(new Runnable() {public void run() { }});

4

Q.- Which method is easy for a java programmer to add a criteria?

    1. 1. HCQL
    2. 2. HQL
    3. 3. SQL
    4. 4. None of the above

1

Q.- Which type of validation we must implement the Validateable interface (or extend ActionSupport class) and provide the implementation of validate method?

    1. 1. By Input Validation
    2. 2. By Ajax Validation
    3. 3. By Custom Validation
    4. 4. None of the above

3

Q.- Which is valid declaration of a float?

    1. 1. float f = 1F;
    2. 2. float f = 1.0;
    3. 3. float f = "1";
    4. 4. float f = 1.0d;

1

Q.- public void test(int x) { int odd = 1; if(odd) /* Line 4 */ { System.out.println("odd"); } else {System.out.println("even"); } } Which statement is true?

    1. 1. Compilation fails.
    2. 2. odd will always be output.
    3. 3. even will always be output.
    4. 4. odd will be output for odd values of x

Q.- What is the name of the method used to start a thread execution?

    1. 1. init();
    2. 2. start();
    3. 3. run();
    4. 4. resume();

2