Vous êtes sur la page 1sur 90

2.

Which of the following is odd man out

a) Statement

b) Connection

c) Driver

d) DriverManager

3. Which of the following is a proper declaration a final method is java?

a) public final method();

b) public abstract final method();

c) public final void method(){}

d) public void method(){}

4. Which Class is the superclass of all Java classes

a) Class

b) Object...............

c) String

d) Super

5.__________ is the modifier is used to avoid a class to be inherited

a) abstract

b) final

c) static

d) none of the above

6. Which of the following statements is true ?

(i) Constructor can be overloaded.

(ii) Constructor can return a value.


(iii) Constructor name should be the same as the class name.

(iv) Constructor can take input parameters.

a) (i),(ii),(iii) and (iv)

b) (i), (iii) and (iv) only

c) (i) and (ii) only

d) (ii),(iii) and (iv) only

7. A function can be abstract and final at the same time.

a) True

b) False....

c) Ignore this option

d) Ignore this option

8.Which of the following is the operator used to generate an exception programmatically

a) throws

b) throw.................

c) catch

d) try

9. The default thread model used by most of the web server for servlets is

a) Multithread model

b) single thread model

c) no thread model

d) process model

10."Which of these array declarations and initialization are legal

(i) int arr[4] = new int[4];


(ii) int[4] arr = new int[4];

(iii)int arr[] = new int[4];

(iv) int[] arr = new int[4];

a) all of the above

b) (i), (ii)

c) (iii)

d) (iii) and (iv)

11. The synchronized modifier is used to control access to critical code in multithreaded

programs.

a) False

b) True

c) Ignore

d) Ignore

12. JNDI is

a) Naming service

b) directory interface

c) both of the above**************************

d) none of the above

13. a head request is just like a get request except that

a) it asks server to return response headers only and not the complete resource.

b) is used to check characteristics of a resource without downloading it

c) is used when you don't need actual file contents

d) all of the above


14.The web browser and the web sever talk to each other using

a) File Transfer protocol

b) HyperText Transfer protocol

c) HTML

d) None of the above

15. java.io.Serializable is

a) Marker interface in Java

b) contains functionality required for serialization of objects

c) a class containing the serialize function

d) all of the above

16. The process of writing the state of an object to a byte stream, To save the state of your
program to a persistent storage area such as a file is called as _________.

The process of restoring these objects by using the process of ___________.

a) Serialization, deserialization

b) deserialization, Serialization

c) Serialization, Externalization

d) none of the above

17. Which of the following type of driver was widely used when JDBC was very new.

a)JDBC-ODBC bridge plus ODBC driver

b)Native-API partly-Java driver

c)JDBC-Net pure Java driver

d)Native protocol-pure Java driver

18. The JDBC API consists of some classes and some interfaces. Identify which out of the

following is/are class/classes


a) DriverManager

b) CallableStatement

C) Connection

d) All of the above

19. The advantages of RMI are

a) Built in JDK1.3

b) free of cost

c) easy to use

d) all of the above

20. Which of the following will read a set of words from the command line?

a) System.in.read()

b) System.in.readLine()

c) new BufferedReader(new InputStreamReader(System.in)).readLine()

d) none of the above

21. execute(" ") method of a Statement is used when

a) The query to be executed is dynamic and it is not known whether it is select or update
statement.

b) The query to be executed is very complex

c) The query to be executed is not a DML statement

d) None of the above

22. In a pure java class the method is Static block is called before the main() method

a) True...

b) False

c) Ignore
d) Ignore

23. Method Overloading can be done using

a) Number of Parameters

b) Number and type of Parameters......

c) Return Type

d) None of the above

24. Constructor (Methods) have Return Type

a) True

b) False..............

c) NA

d) NA

25. __________ is the Root Class of all Exception classes

a) Exception

b) Error

c) Throws

d) Throwable

26. ______________ is the "Block of code" that is always executed (normal execution)

a) Catch (Exception Ex)

b) Destructor

c) Finally

d) None of the above

27. What is the modifier that for a method, so that only one thread can access it at a time, in a
multi-threading context

a) Final
b) Synchronized

c) Abstract

d) Static

28. To implement Runnable, a class needs to implement the method

a) run()

b) CreateThread()

c) main()

d) None of the above

29. Transient variables can be serialized

a) True

b) False

c) Ignore this operation

d) Ignore this operation

30. Compound names in JNDI is composed of one or more atomic names.

a) True

b) False

c) Ignore this option

d) Ignore this option

31. In a try-catch-finally construct, the finally block is executed

a) Only when an exception Is caught

b) Only when no exception is caught

c) Always

d) Only when the catch block has a "return" statement.


32.Which of the following statements is not correct?

a)Java is based on object oriented concepts

b)Java is platform dependent

c)Java is portable

d)None of the above

33. Which of the following code snippet is wrong:

(i) public class Myclass implements IA, IB, IC // IA, IB, IC are different interfaces

MyClass mc = new Myclass();

….

...

(ii) public class Myclass extends A, B, C // A, B, C are classes (may be abstract)

MyClass mc = new Myclass();

...

...

a) i

b)ii

c)both i and ii..............

d)NA

34. Which of these is the valid declarations for the main method?
a) public void main();

b) public static void main (String args[])

c) public static void main(String);

d) public static int main(String args[])

35. Who maintains the life cycle of the servlet?

a) Servlet container

b) the client

c) Both a and b

d) none of the above

36. Threading in Java can be implemented by

a) Subclassing Thread and overriding "run"

b) Implementing "Runnable" Interface

c) Either a or b

d) None of the above

37.Thread are synchronized by

a) sleep and wakeup

b) wait and notify

c) synchronize and desynchronize

d) sleep and notify

38. Which of the following is true about DSN

a) It's a data source name used to identify which database is to connected

from the program

b) created using control panel of windows OS and hence platform dependant


c) created while using JdbcOdbc bridge driver from the java program

d) all of the above.

39. In Java, when two or more threads need access to a shared resource,

_____is a way to ensure that the resource will be used by only one thread at a time.

a) creating a semaphore

b) Using mutex

c) Synchronization

d) none of the above.

40. Which of the following statements is true?

a) Abstract modifier can be applied to classes and methods.

b) The abstact class cannot be instantiated.

c) An abstract class can have all or more abstract methods

d) All of the above

41. Which of these is the valid declaration for the main method?

a) public void main();

b) public static void main (String args[])

c) public static void main(String);

d) public static int main(String args[])

42. If no access modifier is specified in Java the default access modifier assumed is

a) private

b) public

c) protected

d) package level
43. In a try-catch-finally construct, the finally block is executed

a) Only when an exception is caught

b) Only when no exception is caught

c) Always

d) Only when the catch block has a "return" statement.

44. The Synchronized keyword is used in Java to implement the concept of

a) Thread Priority

b) Thread Running

c) Both of the above

d) None of the above

45. To implement JDBC in your program, you must import

a) java.awt package

b) java.applet package

c) java.sql package

d) java.net package

46. You can set a thread's priority

a) when you first create the thread

b) at any time after you create the thread

c) both a and b

d) Priority cannot be changed at all

47. Which of the following is NOT a package in Java?

a) awt

b) lang
c) util

d) jfc

48. Which of the following method is called when the Servlet is first loaded?

a) initialize() method

b) init() method****************************

c) Both of the above

d) None of the above

49. Which of the following is a feature of Servlet?

a) Supports Multithreading

b) Platform independent

c) Protocol independent

d) All of the above **********************************8

50. We can extend from __________ number of classes

a) Zero

b) One

c) Two

d) Three

51. Abstract class is a class which _____________________________

a) Inherits Abstract Methods/interface but doesn't Implement it

b) Implements Abstract Methods

c) Does not have Abstract methods (but is denoted abstract )

d) Implements an abstract Interface

52. Integer is a ______________


a) Keyword

b) Wrapper Class

c) Data Type

d) Constructor

53. The main interfaces that every Driver layer must implement are

a) Driver

b) Connection

c) Resultset

d) All of the above

54. Commit() and RollBack() are methods belonging to which of the following classes?

a) Driver

b) Connection

c) Statement

d) ResultSet

******************************************************************************
******************************************************************************
************************************************************

55. The procees of ensuring that any shared resource is accessed by a single thread at a time is
called as

a) Multi-threading

b) Synchronization

c) Cloning

d) Serialization

56. The serialization process can be controlled using the _______________ interface

a) Externalizable
b) Serializable

c) ActionListener

d) Runnable

57. Any Java class can be a servlet provided

[i] It implements the javax.servlet.Servlet Interface.

[ii] Extends from any class that implements the same.

a) Only i is true, ii cannot be used

b) Only ii is true, i cannot be used

c) Either of i or ii can be used

d) Both i and ii cannot be used

62. Servlets can run using

a) Any web server

b) Any web server with built in Servlet engine / add on for the servlet
engine**********************

c) Any server that has JVM inside it.

d) all of the above

63.__________ is the modifier is used to avoid a class to be inherited

a) abstract

b) final

c) static

d) none of the above

80. _________________ is the concept by which one class is inherited from more than one super
class

a) Multiple inheritance.....................
b) Mutilevel inheritance

c)Single inheritance

d)None of the above

81. Class C is inherited from class A and class B,class D is inherited from class C; Which of the
following is true?

i> class C inherits class A attributes

ii> class C inherits class B attributes

iii> class D inherits class B attributes only

iv> class D inherits class A attributes only

v> class D inherits class A & class B attributes

a)i, ii, v

b)i, ii, iii, iv, v

c)ii, iii

d)i, iv

82. Will the following class compile? If yes what is the output?

class Envy

static int i;

Envy()

++i;

public static void main(String args[])

{
System.out.println(i);

a) Yes , it compiles but NullPointerException thrown at runtime

b) Compiler error , System.out.println ( i ) : variable i may not have been initialized

c) Yes it compiles & output = 0

d) Compiler error , ++ i : can't make a nonstatic reference to a static variable , i

83. To make salary in the following class definition read-only:

class Employee

double salary;

a good approach would be to

a) Make the employee class private

b) Make salary protected

c) Make salary private and define a method called getSalary()

d) Make salary private and define methods called getSalary() and setSalary()

84.

public class Compare

public static void main(String args[])

int x = 10, y;
if (x < 10) y =1 ;

if (x >=10) y =2 ;

System.out.println("Y is " + y);

a) Program compiles and prints Y is 0

b) Program throws a runtime exception

c) Program does not compile saying Y is not initialized

d) Program prints one of the following

Y is 1

Y is 2

85. What gets printed on the standard output when the class below is compiled and executed by
entering "java test This is a test"

public class test

public static void main(String args[])

System.out.println(args[0]+ " " + args[args.length]);

a) Program will print "java this"

b) Program will print "java test"

c) program will print "this test"


d) Will throw ArrayIndexOutOfBoundsException

86. Garbage Collector can be invoked to immediately recover unused memory

a) TRUE...................

b) FALSE

c) Ignore this choice

d) Ignore this choice

87. Which Class is the superclass of all Java classes

a) Class

b) Object

c) Interface

d) Container

88. An abstract class can have static methods that are not abstract.

a) TRUE

b) FALSE

c) Ignore this choice

d) Ignore this choice

89. A java application should not try to catch an "Error"

a) TRUE

b) FALSE

c) Ignore this choice

d) Ignore this choice

90. What will happen if the code below is executed?

Assume that Dept table exists and is empty


import java.sql.*;

class JDBCDemo

public static void main(String[] args)

String url = "jdbc:oracle:thin:@192.168.121.13:1521:enr";

String user = "scott";

String password = "tiger";

try

Class.forName("oracle.jdbc.driver.OracleDriver");

Connection con = DriverManager.getConnection(url,user,password);

String sqlInsert = "INSERT INTO DEPT VALUES" +

"( 12 , 'WENA', 'BLR')";

Statement si = con.createStatement();

int rowsInserted = si.executeUpdate(sqlInsert);

con.rollback();

con.close();

catch (Exception e)

System.err.println("Error!!");

}
}

a) One row will be inserted and committed

b) One row will be inserted and then will be rolledback when program terminates normally

c) Insertion will not happen

d) Will throw an error because executeUpdate() method cannot be used for inserts

91. In case an error occurs in the execution of a Oracle stored procedure from a Java program

a) SQLException is thrown and the oracle error code returned

b) SQLException is thrown and the JDBC error code is returned

c) IOException is generated as the database connection is lost

d) No exception is returned but the program hangs

92. You can make an object that reads and writes records from a database safe for multiple
clients by

a) declaring its methods to be synchronized

b) declaring the method as throwing a RemoteException

c) implementing the remote interface

d) closing the file on finalize()

93. You can set a thread's priority

a) when you first create the thread

b) at any time after you create the thread

c) Thread priority can be changed only for main thead

d) Priority cannot be changed at all

94. Usually, Server Socket waits on a port for requests, and upon receiving a request, gives a
socket connection on the
a) same port

b) different port

c) a port number which matches that on the client end

d) None of the above

95. Socket communication is an example of

a) Connectionless

b) Connection oriented

c) Either 1 or 2

d) Neither

96. Pre-requisites for running Servlets are

a) Web Server that is Java Enabled

b) Servlet API Class library

C) Java Runtime Environment

d) All the above

96. HTTP header fields include

a) Content-length

b) Cookies

c) Type of request - POST or GET

d) All the above

97. What will happen when the code is compiled and executed?

import javax. servlet.*;

import javax.servlet.http.*;

import java.io.*;
class TestServlet extends HttpServlet

public void doGet(HttpServletRequest request, HttpServletResponse response) throws


ServletException, IOException

response.setContentType("text/html");

PrintWriter out=response.getWriter();

out.println(" Servlet Exam");

out.close();

public void doPost(HttpServletRequest request, HttpServletResponse response)


throws ServletException, IOException

doGet(request, response);

a) Compilation Error

b) Compiles fine but will not be executed. Displays error.

c) Displays output as Servlet Exam in HTML bold text

d) Displays output as Servlet Exam

98. Method that is used to retrieve value from a session variable is (assuming session is an
object of HttpSession)

a) session.getValue("sessionvarname");

b) session.getAttribute("sessionvarname");***********************8

c) session.getDetails("sessionvarname");
d) Options a and b

99. init method of a servlet is called only once in its lifetime

a) False

b) True****************************

c) Invalid option

d) Invalid option

100. If the user opens two instances of browsers separately and accesses the same ASP
page, how many session objects will be created on the Application Server?

a)1

b)2

c)3

d)4

******************************************************************************
******************************************************************************
************************************************************

9. What is the default access specifier in Java

a) Private

b) Protected

c) Final

d) Don't use any keyword at all (Make’s it default package level)

10. You can implement the selected methods of interface. This can be achieved by

a) inner class

b) Anonymous inner class

c) Adapter class

d) Static inner class


11. Pointer facility is available in Java as

a) No such facility in Java

b) Object References

c) Pointer itself

d) Classes

12. When we have a ‘catch’ block in Java, it is mandatory to have

a) Finally block

b) Throws block

c) Try block

d) No need to have any mandatory block

13. Panel is a container

a) from which you inherit the Applet class

b) that helps you add multimedia elements

c) that helps you add event handling for your applications

d) that helps you to create windows for your applications

14. System.in can be used to directly read lines from the console

a) true

b) false

c) Ignore this option

d) Ignore this option

15. From OO point of view which of the following is better option for creating a thread

a) extending Thread class

b) extending Runnable interface


c) implementing Runnable interface

d) none of the above

16. Invoking Start on a Thread instance starts a new

a) derived class of Thread class

b) separately scheduled thread in the Java Virtual Machine, which then executes the code

specified in the run method of that Thread subclass

c) separately scheduled thread in the operating system, which then executes the code

specified in the run method of that Thread subclass.

d) separately scheduled thread in the Java Virtual Machine, which then executes the code

specified in the start() method of that Thread subclass

17. For writing transactions, the Autocommit mode of the Connection object should be
made as true

a) True

b) False

c) Ignore this option

d) Ignore this option

19. ..

Statement stmt = con.createStatement();

String s = "INSERT INTO COFFEE " +

"VALUES('Frensh_Roast', 49, 8.99, 0, 0)";

what will be the next statement

a) executeQuery()

b) executeUpdate()
c) execute()

d) getResultSet()

20. getLocalPort() method of ServerSocket class will give

a) port on which Server socket is created.

b)port on which client socket is created on the server machine.

c)port on which client socket is created on client machine.

d) none of the above

21. GET method of HTTP is more secure than POST method

a) true

b) false*****************

c) can't say

d) none of the above

22. 'this' is used for referring

a) current object.....................

b) any object used in the application

c) super class object

d) none of the above

23. In an Object-Oriented system, objects interact with each other by sending and receiving
____________________

a) arguments

b) messages

c) methods

d) None of these
24. Name the class that includes the getSession method that is used to get the HttpSession
object.

a) HttpServletResponse

b) HttpServletRequest

c) SessionContext

d) SessionConfig

25. The method getWriter returns an object of type PrintWriter. This class has println
methods to generate output. Which of these classes define the getWriter method? Choose
the correct option

a) HttpServletRequest

b) HttpServletResponse

c) ServletConfig

d) ServletContext

26. To send text output in a response, the following method of HttpServletResponse may be
used to get the appropriate Writer/Stream object. Choose the correct option.

a) getStream

b) getOutputStream

c) getBinaryStream

d) getWriter

27. Which method returns names of the request parameters as Enumeration of String
objects

a) getParameter

b) getParameterNames

c) getParameterValues

d) None of the above


28. Servlets classes specific to your application are placed in which directory on the
TOMCAT Server?

a) /lib/

b) /WEB-INF/classes/

c) /classes

d) /WEB-INF/lib/

29. A programmer wants to develop different types of windows like SpreadSheetWindows,


GraphWindows etc. The contents of the windows need to be redrawn using a function
called paint.Which of the following is the best OO design?

a) A virtual function "paint" is defined in a base class called windows and each derived
classes SpreadSheetWindows, GraphWindows overrides the method paint

b) The operation paint is implemented in the base class windows and


SpreadSheetWindows, GraphWindows are derived from the base classes

c) Code two classes SpreadSheetWindows, GraphWindows which take care of different


types of repainting for different windows

d) A single class called windows and operations called SpreadSheetWindows,


GraphWindows, paintWindows

30. If I create and load all the dialogs (say 50 dialog) in an UI Application at the start up
into a dialog array and show and hide one dialog on a need basis, what do I achieve?

a) Good Performance and Bad Memory usage

b) Bad Performance and Good Memory usage

c) Good Performance and Good Memory usage

d) Bad Performance and Bad Memory usage

31. If I want to use JDBC code in my Java program what all I need to do

a) Include the jdbc class files in the CLASSPATH and import the relevant packages in the
program*****************

b) Just have the jdbc class files in the CLASSPATH and run the java program with the
classpath option
c) Just import the relevant JDBC packages in the program

d) Both 1 and 2

32. Given these class definitions

class Superclass{}

class Subclass1 extends Superclass{}

and these objects

Superclass a = new SuperClass();

Subclass1 b = new Subclass1();

Which of the following explains the result of the statement a=b?

a) Compile time Error

b) Only run time Error

c) No error at all

d) Ignore this option

33. Given these code snippets,

Boolean b1 = new Boolean(true);

Boolean b2 = new Boolean (true);

Which expression is legal java expression that returns true?

a) b1==b2

b) b1.equals(b2)

c) both a & b

d) b1 | b2

34. Can a method in java be private and static?

a) Yes
b) No

c) Ignore this choice

d) Ignore this choice

35. How do you implement pass-by-reference in Java?

a) Using classes

b) Using Objects.....................

c) Using pointers

d) Using Wrapper Classes

36. What exception will be thrown from the code given below:

class Arr

public static void main(String[] args)

int[] ia = new int[2];

ia[2] = 2;

System.out.println(ia[2]);

a) NullPointerException

b) ArrayIndexOutOfBoundsException....................

c) IllegalAccessException

d) No exception will be thrown

37. What will happen when you attempt to compile and run the following code
public class Bground extends Thread

public static void main(String argv[])

Bground b = new Bground();

b.run();

public void start()

for (int i = 0; i< 10;i++)

System.out.println("Value of i =" +i);

a) A compile time error indicating that no run method is defined for the Thread class

b) A run time error indicating that no run method is defined for the Thread class

c) the programs compiles and runs correctly with values 0 to 9 printed out

d) No output in the run time************************

38. Threading in Java can be implemented by

a) Subclassing Thread and overriding run() method

b) Implementing the Runnable Interface

c) Either 1 or 2***************************

d) None of the above

39. If there are two threads with different priority, does that mean that higher-priority
thread will run faster than the lower priority thread
a) True

b) False******************************

c) Ignore this option

d) Ignore this option

40. If a thread has entered a synchronized method of an instance, another thread cannot
call any other methods (synchronized or non-synchronised) of the same instance.

a) True

b) False***********************

c) Ignore this option

d) Ignore this option

41. Panel is a container

a) from which you inherit the Applet class

b) that helps you add multimedia elements

c) that helps you add event handling for your applications

d) that helps you to create windows for your applications

42. If a frame uses a grid layout manager and does not contain any panels,

a) then all the components within the frame are of different width and height

b) then all the components within the frame are the same width and height.

c) then all the components within the frame are smaller

d) then all the components within the frame are not completely visible

43. A thread's run() method includes the following lines:

1. try{

2. sleep(100);

3. } catch(InterruptedException e) { }
Assuming the thread is not interrupted, which one of the following statements is correct?

a) The code will not compile, because exceptions may not be caught in a threads run()
method.

b) At line 2, the thread will stop running. Execution will resume in atmost 100 milliseconds

c) At line 2, the thread will stop running. Execution will resume in exactly 100 milliseconds

d) At line 2, the thread will stop running. Execution will resume in some time after 100
milliseconds have elapsed.

44. A package is a collection of

a) Classes and Interfaces only

b) Classes ,Interfaces, and packages...............

C) Interfaces and packages only

d) Only Interfaces and Abstract classes

45. What is true with the following statement is java

super();

[ i] calls the super class constructor.......................

[ ii] is optional because there is default call to the super

class constructor

[iii] has to be the first executable statement in the subclass

constructor

[ iv] fails if there is neither implicit nor explicit zero parameter

constructor in the super class.

a) all of the above

b) [i], [ii],[iii]

c) [i], [ii]
d) [i], [ii],[iv]

46. Ture or False?

There are methods, System.gc() and Runtime.gc() that look as of they run

tehthe garbage collector but even these methods do not have any control on

the garbage collection process.

a) False

b) True

c) Ignore this option

d) Ignore this option

47. What are the advantages of wrapper classes in Java?

a) Java contains many subsystems that work only with objects and not

with primitive types

b) They are more object oriented than primitive data types

c) They can encapsulate the power of the functions related with something

that they wrap which primitives cannot do.

d) all of the above..................

48. The Vector class in Java

a) provides methods for working with dynamic( growing) arrays

b) allows varies element types

c) is Serializable b

d) all of the above........................

49. If one needs to find out what are the methods of one object/class

by reading a .class file(without having .java file) what way/API can help
a) API cannot do this work, you must have a specialized software for this.

b) Reflection API can do this

c) Util package has the API to do this

d) You cannot do this by any way

50. What happens when object of the file class is garbage collected

a) file is permanently deleted from the hard disk

b) file is deleted but can be retrieved using some utilities

c) file is not deleted but the reference to the file is not available

anymore.

d) file is closed and made inaccessible.

51. Which of the following statements are correct regarding the Object

class in Java

[i] this is super class of all other classes in Java.

[ii] when you want to write a generic method which needs to accept any

kind of object you can use this class

[iii] Object o=new Emp();

[iv] Emp e=new Object();

a) all of the above

b) [i], [ii], [iii]

c) [i], [ii]

d) [i], [iii]

52. Which of the following is true about the abstract classes and interface

a) Absract class may contain some implemented, some unimplemented methods.


Interface cannot have implemented ones.

b) Abstract classes can have instances and interfaces cannot.

c) Abstract classes are useful without inheritance and interfaces have to

be implemented to be usable.

d) Interfaces cannot contain anything other than method declarations

while as abstract classes can contain variables as well.

53. Which of the following class can be used to find out the ipaddress of

your machine?

a) IpAddress

b) InetAddress**********************

c) NetAddress

d) none of the above.

54. Which one of the following object contains the description of the

current resultset.

a) ResultSet Object.

b) MetaData Object.

c) ResultSetMetaData Object***************************

d) None of the above

55. Which of the following is correct definition of parameter marshalling.

a) conversion of basic data types to bytes

b) conversion of bytes to basic data types by stub

c) packaging of the parameters to be sent to the remote methods as block

of bytes
d) all of the above

56. In java, three tier architecture is usually( in most generic way)

implemented using

a) Front end in HTML, middle tier in pure java, odbc in backend

b) Front end in applets, middle tier in beans, odbc in backend

c) Front end on HTML/Swing, middle tier in Servlets/Beans/EJB and Database

server in the back end.************************

d) none of the above

57. Which of the following is true about DSN

a) It's a data source name used to identify which database is to connected

from the program

b) created using control panel of windows OS and hence platform dependant

c) created while using JdbcOdbc bridge driver from the java program

d) all of the above.***************************

58. In JNDI the context object contains

a) Common information like protocol, ipaddress which is required for

looking up most of the remote objects in one project

b) Common information like the object name, which is required for

looking up each of the remote objects in one project

c) Specific information like unique name required for each lookup

d) none of the above

59. We can synchronize

[i] block
[ii] method

[iii] object

[iv] class

a) only [ii]

b) [ii], [iii]*********************

c) [i], [ii], [iii], [iv]

d) none of the above

60. Choose best answer for the following question

Naming.rebind method

a) re-registers the same remote object again in the rmiregistry

b) registers the remote object in rmiregistry with the unique name

given as parameter to this method.

c) removes the registration of the remote object which is already

registered with the unique name given as parameter to this method.

d) both c and b

61. In Java, when two or more threads need access to a shared resource,

_____is a way to ensure that the resource will be used by only one

thread at a time.

a) creating a semaphore

b) Using mutex

c) Synchronization***********************

d) none of the above.

62. Why are programs needed on Server-side?


a) Dynamic Content generation

b) Database access

c) Transactions

d) All of the above********************

63. Any Java class can be a servlet provided

i] It implements the javax.servlet.Servlet Interface.

ii] Extends from any class that implements the same.

a) Only i is true, ii cannot be used

b) Only ii is true, i cannot be used

c) Either of i or ii can be used

d) Both i and ii cannot be used

64. Servlet becomes thread safe by implementing the javax.servlet.

SingleThreadModel interface

a) as every request is handled by separate instances of the servlet

b) as a single thread serves all the client requests

c) as all the requests are serialised

d) a first to-be loaded servlet and is loaded by the server during startup

65. You must ideally use Servlets for

i] Extending Server functionality and simple business logic

ii] Work flow management and presentation logic

iii] Work flow management and complex database queries

iv] NON-HTML data generation such as XML generation and parser

a) i only
b) i, ii, iii

c) i and ii only

d) All of i, ii, iii and iv

66. Some purposes for which servlets can be used are:

i] file access on the client side

ii] starting distributed transactions

iii] any purpose at the server end

iv] calling an enterprise bean

a) All of i, ii, iii and iv

b) ii, iii and iv only. File access is not possible.

c) iii only

d) None of i, ii, iii and iv

67. What access control keyword should you use to enable other classes to access a method
freely within its package,but to restrict classes outside of the package from accessing that
method?

a) private

b) public

c) protected

d) Do not supply an access control keyword

68. sqlj code finally gets converted to JDBC code.

a) True

b) False

c) Ignore this option

d) Ignore this option


69. You can set a thread's priority

a) when you first create the thread

b) at any time after you create the thread

c) both of these

d) Priority cannot be changed at all***********************

70. Which methods of a remote object a client object can call?

a) all methods

b) methods defined in remote interface

c) methods registered in rmiregistry

d) none of the above

71. Which of the following tools is used to generate the stubs and skeletons

for a remote service?

a) javac

b) rmic

c) java

d) rmiregistry

72. What interface must a class inherit from before an object of that type could be written
to a stream?

a) Serializable **********************

b) Remote

c) any one of the above

d) none of the above

73 Looking at the following piece of the code, Select the correct statement out of the given
options
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

a) This is exactly same as import statement

b) This is used to make a connection with database

c) Usually written in the init() method of Servlet to load the driver into
memory************* ????????????

d) None of the above

74.Servlets can follow

a) single thread model

b) multi thread model

c) both

d) none of the above

75. Multiple inheritance is achieved in Java with

a) Interfaces

b) classes

c) abstract classes

d) extends keyword

76. GarbageCollector can be forced to immediately recover unused memory

a) True

b) False

c) Ignore this option

d) Ignore this option

77. What is the main disadvantages of using Java vis-à-vis C/C++ language

a) Interpretation of the program before each execution makes it slow.

b) Objects can be garbage collected resulting in unstability of programs


c) The LOc (lines of code) required for a java program is more when compared to the
C/C++ counterpart

d) None of the above

78. In case an error occurs in the execution of a Oracle stored procedure from a Java
program

a) SQLException is thrown and the oracle error code returned

b) SQLException is thrown and the JDBC error code is returned

c) IOException is generated as the database connection is lost

d) No exception is returned but the program hangs

79. Inside the interface, while declaring a function that others can access remotely,you must
extend which interface?

a) Cloneable

b) Serializable

c) RemoteObject

d) Remote

80. In a try-catch-finally construct, the finally block is executed

a) Only when an exception Is caught

b) Only when no exception is caught

c) Always

d) Only when the catch block has a "return" statement

81. Threading in Java can be implemented by

a)By subclassing Thread class

b)By implementing Runnable

c)Any of the above**********************

d)None of the above


82. What variables are substitute in java for the global variables

a)Instance variables

b)static variables************************

c)public variables

d)final variables

83.Which of the following server can host servlets?

a)Apache server

b)IIs

c)Windows 2000 Server

d)Tomcat Server********************8

84. Select the odd man out of

a) JButton****************

b) Dialog

c) ScrollPane

d) Panel

85. class WhatHappens implements Runnable

{ public static void main(String[] args)

{ Thread tThrd = new Thread (this);

tThrd.start();}

public void run()

System.out.println("hi");

}
}

a) This program compiles and word ""hi"" appears in the standard output (once)."

b) This program compiles and word ""hi"" appears continuously in the standard output
until the user hits Ctrl+C to stop the program."

c) compilation error***********************

d) runtime error

86. The URL in the POST method can be used to find out the query parameters

a) true

b) false

c) Ignore this option

d) Ignore this option

87. What are the uses of an Interface?

a) It allows multiple interface inheritance

b) It helps to use the Polymorphism feature of OOP

c) It helps to follow a specific standard of functions among the similar classes.

d) All of the above

88. What is overriding?

a) Writing a function in the child class, which has the same name and same function
signature as that of the function in the parent class is called overriding.

b) Overriding is same as overloading but implemented in a parent child relationship


between classes.

c) Writing a function in the child class, which has the same name but different function

signature as that of the function in the parent class is called overriding.

d) None of the above

89. How to create your own exception class


a) You cannot create your own exception class

b) You have to inherit your class from Exception/Throwable

c) You have to implement the Serializable interface

d) You have to extend your class from Error class

90. Which of the following is a proper declaration an abstract methods is java?

a) public method();

b) public abstract method();

c) public abstract void method(){}

d) public abstract void method();

91. In Java the bytecode is always contained in

a) .jar file

b) .class file

c) .java file

d) .exe file

92. Bytecode has to be

a) interpreted by the JVM

b) compiled by the JIT

c) either of the above

d) both a,b

93. Byte code verifier is used to check whether the code

a) Memory access violations

b) violates access rights on objects

c) attempt to change the object type illegaly


d) all of the above

94. A ______ is a part of JVM that loads all classes that are required for the execution of
the java program.

a) JRE

b) bytecode loader

c) class verifier

d) classloader

95. Which one of the following interface is used to call a stored procedure from java

a) StoredCall

b) CallProcedure

c) CallableStatement

d) None of the above

96. The lowest level synchronization which synchronizes the smallest unit is

a) synchronizing a method

b) synchronizing a object

c) synchronizing a block

d) synchronizing a class

97. Which of the following is true about rmiregistry ?

a) rmiregistry listenes on port 1099 by default for the incoming requests

b) rmiregistry is naming service used by RMI

c) rmiregistry has to be running for the client to get handle of the remote object

d) all of the above

98. The following code which is saved in c:\test.java. Choose the appropriate statement
which will compile it and do the placement of the bytecode accurately.
package mypackage;

public class test

a) c:\>javac -d . test.java

b) c:\> javac test.java

c) c:\mypackage> javac test.java

d) c:\mypackage> javac c:\test.java

99. The capability of an object to exist beyond the execution of the program that created it
its indicated by inherting from

a) Serializable interface

b) Remote interface

c) both of the above

d) this cannot be achieved without database or a file.

101. Select which of the following is the best place to close the connection in the simple java
code

a) try block

b) catch block

c) finally block

d) any of the above

102. What is the role of "RMI" in the "n" tier architecture?

a) RMI will always be the third tier of the architecture

b) RMI can be any tier of the architecture

c) RMI will be used between any 2 tiers for communication


d) all of the above

103. From OO point of view which of the following is better for creating a thread

a) Instantiate Thread class

b) extend from Thread class

c) extend from Runnable

d) implement Runnable**********************

104. forName() method of the class Class is

a) exactly like import statement

b) is used to load the class (dynamically)at runtime

c) finds the name of the class given the .class file

d) all of the above

105. _________ translates the standard JDBC calls into the specific calls required by the
database it supports.

a) JVM

b) Drivermanager

c) Driver

d) none of the above

106. If we have not created a DSN for the database, it is possible to access this database
from Java?

a) Yes

b) No

c) Ignore this option

d) Ignore this option

107. Select the odd man out


a) DCOM

b) EJB

c) CORBA objects

d) JNDI

/******************************************************

1. Which of the following is the best answer

a)Although webservers can be configured to ports other than 80 for http requests, it is fine
to configure them to 8000 in production environments

b)Although webservers can be configured to ports other than 80 for http requests, it is not
fine to configure them to 8000 in production environments

c)Webservers do not allow you to configure to ports other than 80 and 443

d)Ignore this Option

2. The following method is used to create a PrintWriter object that can be used to write text
to the response

a) getWriter() ------

b) getOutputStream()

c) getBinaryStream()

d) getStream()

3. The service() method has objects of these classes as parameters - HttpServletRequest and
HttpServletResponse

a) True

b) False---------

c) Ignore this option

d) Ignore this option

4. Consider the following servlet


import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

public class MyServlet extends HttpServlet {

int var;

public void init() throws ServletException {

var=0;

....

For every browser request, a new instance of the servlet is created by the server

a) True

b) False

c) Ignore this option

d) Ignore this option

5. Name the class that can be used to get the cookies from the client browser

a) HttpServletResponse

b) HttpServletRequest---------

c) SessionContext

d) SessionConfig

6. Which of the following is not a server-side technology?

a) Servlets
b) Java Server Pages

c) DHTML---------

d) CGI

7. Which method returns an array of String objects containing all of the values the given
request parameter has

a) getParameter()

b) getParameterNames()

c) getParameterValues()------

d) None of the above

8. Which of the following statements are true?

1] Abstract class cannot be instantiated

2] We cannot declare abstract constructors

3] We may declare abstract static methods

a) 1 is true

b) 2 is true

c) 1 & 2 are true

d) All of the above are true

9. What is the default access specifier in Java

a) Private

b) Protected

c) Final

d) Don't use any keyword at all (Make’s it default package level)

10. You can implement the selected methods of interface. This can be achieved by

a) inner class
b) Anonymous inner class

c) Adapter class

d) Static inner class

11. Pointer facility is available in Java as

a) No such facility in Java

b) Object References

c) Pointer itself

d) Classes

12. When we have a ‘catch’ block in Java, it is mandatory to have

a) Finally block

b) Throws block

c) Try block

d) No need to have any mandatory block

13. Panel is a container

a) from which you inherit the Applet class

b) that helps you add multimedia elements

c) that helps you add event handling for your applications

d) that helps you to create windows for your applications

14. System.in can be used to directly read lines from the console

a) true

b) false

c) Ignore this option

d) Ignore this option


*******************************SERVLET********************************

1.Can cookies be retrieved from the Request Object?

--a) True

b) false

c) Ignore

d) Ignore

2. ASP Scripting

a) is browser dependent scripting

b) Can be copied and downloaded by the client browser

c) is built on COM based technologies

d) Can be coded only in VB Script

3. Choose the correct statement

a) To support ASP on a windows machine, ASP.dll must be present.

b) One can set client side cookies by using the request.Cookies indexed property

c) Data from multiple HTML forms can be selected by Request.Forms method

d) All of the above

4. Choose the incorrect statement

a) Cookies expire only when deleted by the client user.

b) Cookies cannot be made to expire programmatically.

c) AUTH_TYPE server variable is used to find out the type of author of the web page.

---d) All of the above

5. Choose the incorrect statement

a) Redirect method belongs to the Response object


b) ScriptTimeOut property belongs to the Request Object

c) Abandon method belongs to the Session object

d) CreateObject method belongs to the Server object

9.Which method is used to transfer the request from the client to another location?

a) Flush

--b) Redirect

c) End

d) Clear

17.Can cookies be retrieved from the Request Object?

--a) True

b) false

c) Ignore

d) Ignore

21. As far as Server side functionality is concerned, the GET method is more secure that
the POST method in the sense that form actions are not repeated for repeated invocations.

--a) TRUE

b) FALSE

c) Ignore this option

d) Ignore this option

25. Cookies can be written to in:

---a) Response Object

b) Request Object

c) Both the above

d) Ignore this option


26. Cookies stored by one web server are hidden from the other web servers

--a) TRUE

b) FALSE

c) Ignore this option

d) Ignore this option

27. How can a servlet can call a HTML document & pass data to it? Passing data is
important.

a) request.sendRedirect("something.html?required_parameters")

b) No way a servlet can make a call to an HTML document

--c) Servlet can write HTML to response object, but cannot pass parameters

d) Ignore this option

*************************************

ORACLE

View As Web Page

1. :new and :old cannot be used with statement level triggers in Oracle

a)True **

b)False

c)NA

d)NA

2. Whenever user issues insert,update or delete statement on the table Oracle implicitly
locks

the table in

a)Row share mode

b)Row Exclusive mode **


c)share row exclusive mode

d)No lock occurs implicitly.

3. Which one of the following is true with Object Types in Oracle?

a) Once the object is created we cannot modify the attributes and methods of a type

b) Once the object is created we cannot modify the attributes of a type but we can modify
the

methods of a type using alter type command. **

c)we can modify the attributes and methods of a type even if objects are created. .

d)we can modify the attributes but we cannot modify the methods of a type once the object
is

created.

4. Which of the following situation in a PL/SQL block leads to too_many_rows exception.

a)When any of the DML statement fetches more than one row from the table **

b) when select statement fetches more than one row from the table

c) when select statement fetches more than one row from the table or cannot fetch any row
from

the table.

d) a and c

5. Unique Index is implicitly created by oracle

a)whenever primary key constraint is imposed on a table column.

b)whenever unique key constraint is imposed on a table column.

c)both a) and b) **

d)Oracle does not create unique index implicitly.

6. Raise_application_error can have error code ranging from

a)-20000 to -20999 **
b)20000 to 20999

c)any integer number

d)Only positive integer number

7. PGA is created

a) whenever Oracle instance is created

b) whenever a user is connected to the oracle database **

c) at the mount stage of oracle database

d) none of the above

8. Each user has a separate SGA in the Oracle Server.

a)TRUE

b)FALSE **

c)NA

d)NA

9. if checkpoint is not enabled which of the following process does the job of a checkpoint.

a)DBWR

b)LGWR **

c)SMON

d)PMON

10. I want to store Employee number , Employee Photograph and Employee description
(having data

in MB's) in a table. Which of the following description is invalid

a)empno number(4),Photo LONGRAW, emp_descri CLOB

b)empno number(4),Photo LONGRAW, emp_descri LONG **

c)empno number(4),Photo BLOB, emp_descri CLOB


d)empno number(4),Photo BLOB, emp_descri LONG

11. What will be the output of the following program

Set Serveroutput on;

declare

X number := NULL;

Y number := NULL;

begin

if X=Y then

dbms_output.put_line('Both are equal');

elsif X<>Y then

dbms_output.put_line('Both are unequal');

else

dbms_output.put_line('Unknown result');

end if;

end;

a) Both are equal

b) Both are unequal

c) Unknown result **

d) Oracle throws the error message –

ORA-02258 duplicate or conflicting NULL and/or NOT NULL specifications

12. Which of the following statement(s) is true about triggers

a) Trigger can be associated with a specific database table

b) Row level triggers have access to the :new and :old records
c) Triggers are fired automatically

d) All of the above **

13. Following is the sequence of queries executed via SQL PLUS on an ORACLE 8i
database.

(i) SET AUTOCOMMIT OFF;

(ii) CREATE TABLE COUNTS (COL1 NUMBER);

(iii) INSERT INTO COUNTS VALUES (5);

(iv) ALTER TABLE COUNTS ADD (COL2 NUMBER);

(v) ROLLBACK;

(vi) COMMIT;

After executing the above statements in order, which of the following statement is true

a) After step (vi), the table COUNTS will have only COL1 and the value will be NULL

b) After step (vi), the table COUNTS will have only COL1 and the value will be 5

c) After step (vi), the table COUNTS will have NULL in both COL1 and COL2

d) After step (vi), the table COUNTS will have value ‘5’ in COL1 and NULL in COL2 **

14. What will be the output of the following statement

select last_day(sysdate) from dual;

a) Current day

b) Last day of the current week

c) Last day of the current month **

d) Last day of the current year

15. Which one of the below list is not a SQL *plus command

a) SPOOL

b) STOP **
c) EXIT

d) SAVE

16. Which of the following statement is false

a) PL/SQL table consists of homogeneous elements

b) PL/SQL table is indexed by integers

c) PL/SQL table is a multi-dimensional table **

d) None of the above

17. Which of the following stores character data

a) CLOB **

b) BLOB

c) BFILE

d) None of the above

18.Consider table Temp1(B NUMBER(6),C NUMBER(6))

Values for B and C

BC

66

77

88

What is the output of

select rownum

from Temp1

order by B desc;

a) 6 7 8
b) 8 7 6

c) 1 2 3

d) 3 2 1 **

19. Maximum what size of binary data can be stored in BLOB datatype?

a) 1 GB

b) 2 MB

c) 4 MB

d) 4 GB **

20. The memory structure that does not constitute the ORACLE instance is

a) System global Area

b) Dictionary Cache

c) Redo Log Buffer

d) None Of these **

21. Primary key is implicitly indexed

a) TRUE **

b) FALSE

c) NA

d) NA

22. Indexing

a) Speedens Inserts

b) Speedens updates

c) Reduces space requirements

d) Increases space requirements **


23. PGA is created

a) whenever Oracle instance is created

b) whenever a user is connected to the oracle database **

c) at the mount stage of oracle database

d) none of the above

24. if checkpoint is not enabled which of the following process does the job of a checkpoint.

a) DBWR

b) LGWR **

c) SMON

d) PMON

25. Which of the following statement is true?

a) An extent consists of contiguous data blocks

b) A segment may not consist of contiguous data blocks.

c) A data block is the smallest unit of I/O used by the database.

d) All of the above **

26. Oracle SELECT Query Performance can be enhanced by:

a) Indexes

b) Clusters

c) Both a and b **

d) None of the above

27. Stored Procedure cannot be called from :

a) DatabaseTrigger

b) Stored procedure
c) Function

d) None of the above **

28. What kind of objects can you place in a Oracle package

a) Procedures

b) Functions

c) Both a and b **

d) None of the above

29. When one user is waiting for data locked by another user,

the situation is known as ___________.

a) dirty read

b) phantom record

c) deadlock

d) None of the above **

30. The memory structure that does not constitute the ORACLE instance is

a) Database Buffer Cache

b) Dictionary Cache

c) Redo Log Buffer

d) None of the above **

31. Which of the following statement is true?

a) A table in Oracle 8i can have multiple LOB columns

b) A table in Oracle 8i can have only one LONG column

c) A table in Oracle 8i can have only one LOB column

d) Both a and b **
32. Which of the following query returns the current date

a) select sysdate from dual where rownum = 0;

b) select sysdate from dual where rownum = 1; **

c) select sysdate from dual where rownum < 1;

d) select sysdate from dual where rownum > 1;

33. An object table is a special kind of table that holds objects and provides a relational
view

of the

attributes of those objects

a) True **

b) False

c) Not Applicable

d) Not Applicable

34. Which Static data dictionary view describes the columns of tables, views and clusters
owned

by the current user?

a) COLS

b) USER_COLL_TYPES

c) USER_CONS_COLUMNS

d) USER_IND_COLUMNS

35. How do you drop a user (say Anil) from the database with all the objects/resources
owned by

him?

a) DROP USER ANIL

b) DROP USER ANIL CASCADE


c) First drop all the objects/resources individually owned by ANIL and then use ‘DROP
USER ANIL’

d) Both options (b) and (c) **

36. A Join condition involving an operator other than the equivalency is called

a) Non EquiJoin **

b) EquiJoin

c) OuterJoin

d) Inner Join

37. When an Oracle Database is started, memory is set aside and one or more processes are
started

in that memory, and that memory is called as System Global Area(SGA)

a) True **

b) False

c) Not Applicable

d) Not Applicable

38. Which of the following are background processes in an oracle instance?

a) DataBase Writer(DBWR)

b) Log Writer(LGWR)

c) System Monitor(SMON)

d) All the above **

39. EMPLOYEE table has the following data

EMP_ID EMP_SALARY EMP_COMM

------- --------- --------

8723 1230 200


4357 2390 null

9823 2000 100

2737 2030 120

What is the result of the following expression

select sum(EMP_SALARY)+sum(EMP_COMM) from EMPLOYEE

a) NULL

b) 8070

c) 420

d) 7650

40. When a transaction reads an uncommitted data of other transaction, this will lead to

a) Phantom read

b) Dirty read **

c) Lost update

d) None of the above

41. A foreign key whose values are required to match the values of candidate key in the
same

table are called

a) composite keys

b) self referencing keys **

c) overlapping keys

d) none of the above

42. Choose the correct answers to SELECT the list of values in column COL1 from 1 to 3
from a

table X ( the table contains values like 1.2,2.3 etc.)


a) select COL1 from X where COL1 between 1 and 3 **

b) select COL1 from X where COL1 > 1 and COL1 < 3

c) select COL1 from X where COL1 in (1,2,3)

d) select COL1 from X where COL1 not <= 1 and not >= 3

43. :new and :old cannot be used with statement level triggers in Oracle

a)True **

b)False

c)NA

d)NA

44. Whenever user issues insert,update or delete statement on the table Oracle implicitly
locks

the table in

a)Row share mode

b)Row Exclusive mode **

c)share row exclusive mode

d)No lock occurs implicitly.

45.In Oracle One control file is associated with only one database.

a)true **

b)false

c)NA

d)NA

46. Which of the following situation in a PL/SQL block leads to too_many_rows exception.

a)When any of the DML statement fetches more than one row from the table

b) when select statement fetches more than one row from the table **
c) when select statement fetches more than one row from the table or cannot fetch any row
from

the table.

d) a and c

47. Unique Index is implicitly created by oracle

a)whenever primary key constraint is imposed on a table column. **

b)whenever unique key constraint is imposed on a table column.

c)both a) and b)

d)Oracle does not create unique index implicitly.

48. Raise_application_error can have error code ranging from

a)-20000 to -20999 */*

b)20000 to 20999

c)any integer number

d)Only positive integer number

49. PGA is created

a) whenever Oracle instance is created **

b) whenever a user is connected to the oracle database

c) at the mount stage of oracle database

d) none of the above

50. Each user has a separate SGA in the Oracle Server.

a)TRUE

b)FALSE **

c)NA

d)NA
51. Indexing

a)Speedens Inserts

b)Speedens updates

c)Reduces space requirements

d)Increases space requirements **

52. Can the function MAX be used on columns having DataType as Char?

a)TRUE **

b)FALSE

c)NA

d)NA

53. Assume you have a Database Table, which is used for storing historical Data. This table
most

of the time is used for reading data from it and generating reports. Will higher level of

Normalization ( > 2 NF) would necessarily lead to better retrival of the data contained in
the

table?

a)YES

b)No **

c)Not a valid option

d)Not a valid option

54. Indexes are mandatory to be created for every table.

a)True

b)False **

c)Not a valid option


d)Not a valid option

55. which of the following is an aggregate function

a)SUM **

b)ORDER BY

c)HAVING

d)ASC

56.Which of the following options is correct?

a)All types of views are updatable views

b)A view is actually a stored query that is executed whenever

it is referred in a SQL command. **

c)A view cannot be created as a join on two or more tables

d)Views are updatable even when it uses aggregate functions

57. RDBMS is based upon

a)Predicate logic

b)Relational Set theory **

c)Object Oriented paradigm

d)Graph theory

58. CREATE PROCEDURE TEMP ( A IN NUMBER, B OUT NUMBER) AS

BEGIN

BEGIN

A:=1;

B:=2;

END;
dbms_output.put_line('A'||'A');

dbms_output.put_line('B'||'B');

END;

What are the values of A & B that will be displayed

a) 1 and 2

b) A is blank and B is 2

c) A is 1 and B is blank

d) Gives Error **

59. The output of the following query is:

SELECT to_date('25-SEP-2002','mm/dd/yyyy')

FROM dual;

a) 09/25/2002

b) 9/25/2002

c) 25/9/2002

d) Gives Error

60. Why are smaller size database transactions preferred as a design?

a) Because it is easy to maintain

b) Because the performance is better

c) Because there are less chance of hangs because of shortage of rollback segments

d) Because partial failure in the longer ones would result in inconsistent results

61. A view gets updated automatically when a table gets updated in Oracle.

a) True **

b) False
c) Ignore this option

d) Ignore this option

62. A table can contain more than one column having LONG data type

a) True

b) False **

c) Ignore this option

d) Ignore this option

63. The database object that is used to provide improved performance in the retrieval of
rows

from a table is

a) Synonym

b) Index **

c) Sequence

d) Trigger

64. If there is no exception handler for the raised exception in the current block then

1]The exception propagates to the enclosing block

2]If there is no enclosing block then it propagates to the environment

from where the PL/SQL block is invoked

a) only 1 is true

b) only 2 is true

c) both 1 & 2 are true **

d) both 1 & 2 are false

65. Consider the following PL/SQL block of code:

DECLARE
ex1 EXCEPTION;

...

BEGIN

...

DECLARE

...

...

BEGIN

...

RAISE ex1;

...

EXCEPTION

WHEN ex1 THEN

...

END;

...

...

EXCEPTION

...

...

END;

Supposed ex1 is raised, and handled. Then,

a) Execution will resume in the inner block from the statement after the error-causing
statement
b) Execution will resume from the next executable statement after the end of the inner
block **

c) The entire program execution will terminate

d) Control is transferred to the exception section of the enclosing outer block

66. declare

v_result boolean;

begin

delete from sales where sales_id in(15,25,35);

v_result:=SQL%ISOPEN;

commit;

end;

what will be the the value of v_result if 3 rows are deleted ?

a) 0

b) 3

c) true

d) false **

67. Consider the following situation:

Transaction1 has UPDATED row1 of table1 but has not committed as yet

Transaction 2 wants to read(SELECT) the same row

Which of the following statements is correct:

a) Transaction 2 will be asked to wait till Transaction 1 releases the lock on row1

b) Transaction 2 will be given an implicit Shared lock before it could SELECT row1

c) Transaction 2 will be allowed to SELECT row1 reflecting values which is a result of the

current update done by Transaction 1


d) Transaction 2 will be allowed to SELECT row1 reflecting values which is a

result of some previous committed Transaction from the rollback segment. **

68. The data dictionary view which maintains the constraints imposed on the objects
created

by a user:

a) constraints_users

b) constraint_name

c) users_constraint

d) user_constraints **

69. What is the error in the following code?

DECLARE

CURSOR empCursor IS

SELECT Empno, Ename FROM Emp;

BEGIN

FOR empCurRec IN empCursor LOOP

dbms_output.put_line(empCurRec.EmpNo);

END LOOP;

END;

a) Cursor is neither open nor closed, so there will be compilation error

b) There is no Fetching operation, so no record will be fetched, but the code will compile.

c) NO_DATA_FOUND Exception will be raised.

d) There is no error in the code. It will fetch all the records from the table and display the

empnos. **
70. With respect to execution of the DDL commands in PL/SQL, which one of the following
is true?

a) You can execute DDL with EXECUTE IMMEDIATE syntax **

b) You can execute DDL with EXECUTE DDL syntax

c) You can execute DDL with DYNAMIC EXECUTE syntax

d) You cannot use DDL in PL/SQL

71. Assume that there is a table called EMP with following columns - EMPNO, ENAME,
ESAL

without any primary key. What will be output if we execute the following SQL statement 5

times-

Insert into EMP(EMPNO,ENAME,ESAL) values (NULL, NULL)

a) The Query will return a error and wont execute

b) Only 1 record will be inserted with NULL stored in all the columns

c) Only 1 record is created and the system assigns some unique value to the EMPNO
column

automatically

d) None of the above

72. Indexing is needed for

a) Faster insertion of data

b) Faster updation of data

c) Faster retrieval of data **

d) Both a & b

73.Consider the statements below

I] IMS conforms to the Hierarchical model

II] IDMS confirms to Network model


III] DB2 confirms to Relational Model

a) Only III is true

b) Only I and III are true

c) Only II and III are true

d) I, II,III are true **

74. All candidate keys except primary key are foreign keys

a) True

b) False

c) May be true in some cases **

d) May be true if primary key is a composite key

75. Select Min(Sal) from

emp where sal >

(Select min(sal) from emp

where sal >

(select min(sal) from emp))

a) ERROR

b) Displays Third highest Sal from emp table

c) Displays Third lowest Sal from emp table **

d) Displays Second highest Sal from emp table

76. Find the odd statement out

a) A table may or may not have a primary key

b) A table can have at-most one primary key

c) A table must have at-least one foreign key **


d) A table might have more then one foreign key

77. In a relational table which of the following is mandatory

a) Foreign Key

b) Primary Key **

c) Candidate Key

d) None of the above

78. Identify the correct statement

a) A relationship in 3NF can have partial dependencies in it

b) A relationship in 3NF can have transitive dependencies in it

c) A relationship in 2NF can have transitive dependencies in it **

d) A relationship in 2NF can have partial dependencies in it

79. The correct way to get the next value of a sequence into a PL/SQL variable (assuming
the

sequence is already created) is

a) iTest := seqTest.NEXTVAL

b) SELECT seqTest.NEXTVAL INTO iTest FROM DUAL **

c) both (a) and (b)

d) iTest := seqTest.CURRVAL

80. In the PL/SQL block given below, how many times will the loop be executed ?

BEGIN

FOR i in 1..50

LOOP

i:=i+1;

DBMS_OUTPUT.PUT_LINE(' Value of i is ' || i);


END LOOP;

END;

a) 10 times

b) 25 times

c) Once

d) There is an error in the code

81. Choose the correct answer with respect to the statements given below

I] Functions cannot have out parameter as they already have a return type

II] Functions cannot return more than one value by any means

a) Only I is true

b) Both are false **

c) only II is true

d) Both are true

82. What will the following statement do?

PRAGMA EXECEPTION_INIT(EX1,-20000)

a) will associate EX1 with -20000 **

b) will raise the exception when encounters -20000

c) can't assign -20000 as it is reserverd error code

d) none of the above

******************************************

SERVLETS

1. Who maintains the life cycle of the servlet?

a) Servlet container********************
b) the client

c) Both a and b

d) none of the above

2.Which of the following method is called when the Servlet is first loaded?

a) initialize() method

b) init() method****************************

c) Both of the above

d) None of the above

3.Which of the following is a feature of Servlet?

a) Supports Multithreading

b) Platform independent

c) Protocol independent

d) All of the above **********************************

4.Servlets can run using

a) Any web server

b) Any web server with built in Servlet engine / add on for the servlet
engine**********************8

c) Any server that has JVM inside it.

d) all of the above

5.a head request is just like a get request except that

a) it asks server to return response headers only and not the complete
resource.***********

b) is used to check characteristics of a resource without downloading it

c) is used when you don't need actual file contents


d) all of the above

6.Pre-requisites for running Servlets are

a) Web Server that is Java Enabled

b) Servlet API Class library

C) Java Runtime Environment

d) All the above*****************

7.HTTP header fields include

a) Content-length

b) Cookies

c) Type of request - POST or GET

d) All the above***************

8.What will happen when the code is compiled and executed?

import javax. servlet.*;

import javax.servlet.http.*;

import java.io.*;

class TestServlet extends HttpServlet

public void doGet(HttpServletRequest request, HttpServletResponse response)


throws ServletException, IOException

response.setContentType("text/html");

PrintWriter out=response.getWriter();

out.println(" Servlet Exam");

out.close();
}

public void doPost(HttpServletRequest request, HttpServletResponse response)


throws ServletException, IOException

doGet(request, response);

a) Compilation Error

b) Compiles fine but will not be executed. Displays error.***************

c) Displays output as Servlet Exam in HTML bold text

d) Displays output as Servlet Exam

9. Method that is used to retrieve value from a session variable is (assuming session is an
object of HttpSession)

a) session.getValue("sessionvarname");

b) session.getAttribute("sessionvarname");

c) session.getDetails("sessionvarname");

d) Options a and b****************

10.init method of a servlet is called only once in its lifetime

a) False

b) True****************************

c) Invalid option

d) Invalid option

11.If the user opens two instances of browsers separately and accesses the same ASP page,
how many session objects will be created on the Application Server?

a)1*************
b)2

c)3

d)4

12. Which of the following is the best answer

a)Although webservers can be configured to ports other than 80 for http requests, it is fine
to configure them to 8000 in production environments

b)Although webservers can be configured to ports other than 80 for http requests, it is not
fine to configure them to 8000 in production environments**************

c)Webservers do not allow you to configure to ports other than 80 and 443

d)Ignore this Option

13.The following method is used to create a PrintWriter object that can be used to write
text to the response

a) getWriter()***************************

b) getOutputStream()

c) getBinaryStream()

d) getStream()

14.The service() method has objects of these classes as parameters - HttpServletRequest


and HttpServletResponse

a) True*****************

b) False

c) Ignore this option

d) Ignore this option

15.Consider the following servlet

import javax.servlet.*;

import javax.servlet.http.*;
import java.io.*;

public class MyServlet extends HttpServlet {

int var;

public void init() throws ServletException {

var=0;

....

For every browser request, a new instance of the servlet is created by the server

a) True

b) False*****************

c) Ignore this option

d) Ignore this option

16.Name the class that can be used to get the cookies from the client browser

a) HttpServletResponse

b) HttpServletRequest************

c) SessionContext

d) SessionConfig

17.Which of the following is not a server-side technology?

a) Servlets

b) Java Server Pages

c) DHTML*************
d) CGI

18.Which method returns an array of String objects containing all of the values the given
request parameter has

a) getParameter()

b) getParameterNames()

c) getParameterValues()************

d) None of the above

19.Name the class that includes the getSession method that is used to get the HttpSession
object.

a) HttpServletResponse

b) HttpServletRequest***************

c) SessionContext

d) SessionConfig

20.The method getWriter returns an object of type PrintWriter. This class has println
methods to generate output. Which of these classes define the getWriter method? Choose
the correct option

a) HttpServletRequest

b) HttpServletResponse **************

c) ServletConfig

d) ServletContext

21.To send text output in a response, the following method of HttpServletResponse may be
used to get the appropriate Writer/Stream object. Choose the correct option.

a) getStream

b) getOutputStream

c) getBinaryStream

d) getWriter ****************
22. Which method returns names of the request parameters as Enumeration of String
objects

a) getParameter

b) getParameterNames

c) getParameterValues

d) None of the above

23.Servlets classes specific to your application are placed in which directory on the
TOMCAT Server?

a) /lib/

b) /WEB-INF/classes/****************

c) /classes

d) /WEB-INF/lib/

24.In java, three tier architecture is usually( in most generic way)

implemented using

a) Front end in HTML, middle tier in pure java, odbc in backend

b) Front end in applets, middle tier in beans, odbc in backend

c) Front end on HTML/Swing, middle tier in Servlets/Beans/EJB and Database

server in the back end.************************

d) none of the above

25.Why are programs needed on Server-side?

a) Dynamic Content generation

b) Database access

c) Transactions

d) All of the above********************


26.Any Java class can be a servlet provided

i] It implements the javax.servlet.Servlet Interface.

ii] Extends from any class that implements the same.

a) Only i is true, ii cannot be used

b) Only ii is true, i cannot be used

c) Either of i or ii can be used*****************

d) Both i and ii cannot be used

27.Servlet becomes thread safe by implementing the javax.servlet.

SingleThreadModel interface

a) as every request is handled by separate instances of the servlet*****************

b) as a single thread serves all the client requests

c) as all the requests are serialised

d) a first to-be loaded servlet and is loaded by the server during startup

28.You must ideally use Servlets for

i] Extending Server functionality and simple business logic

ii] Work flow management and presentation logic

iii] Work flow management and complex database queries

iv] NON-HTML data generation such as XML generation and parser

a) i only

b) i, ii, iii*****************

c) i and ii only

d) All of i, ii, iii and iv

29.Some purposes for which servlets can be used are:


i] file access on the client side

ii] starting distributed transactions

iii] any purpose at the server end

iv] calling an enterprise bean

a) All of i, ii, iii and iv

b) ii, iii and iv only. File access is not possible.******************

c) iii only

d) None of i, ii, iii and iv

30.Looking at the following piece of the code, Select the correct statement out of the given
options

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

a) This is exactly same as import statement

b) This is used to make a connection with database

c) Usually written in the init() method of Servlet to load the driver into
memory************

d) None of the above

31.Servlets can follow

a) single thread model

b) multi thread model

c) both**************

d) none of the above

32.Which of the following server can host servlets?

a)Apache server

b)IIs
c)Windows 2000 Server

d)Tomcat Server********************8

33.The URL in the POST method can be used to find out the query parameters

a) true

b) false

c) Ignore this option

d) Ignore this option

Vous aimerez peut-être aussi