Вы находитесь на странице: 1из 34

POTHURAI

1 Important Interview Questions:Core java

1 What is Hand Shaking mechanism? A) Two computers establishing a connection, communicating with each other & finally disconnecting from each other is called hand shaking mechanism. 2 What is IP Address? A) IP Address is a unique ID number given to every computer in the network. ID address will have 4 numbers separated by dot (.) symbol. EX:-

3 What is the advantage of Network? A) Resource sharing is main advantage of network. This means Sharing memory Sharing processor Sharing data Sharing software Sharing hardware Dummy terminals means without C.P.U 4 What is Internet? A) Internet is a networking of computers existing in the world. It is global network of networks on the Earth. 5 What is the difference between .exe & .class file? A) .exe file contains machine language instructions which are executed by the micro processor. .exe files are system depended. .class files byte code instructions executed by the JVM. .class files are system independent. 6 Who developed the first virus in the world? A) A) America B) Afghanistan C) India D) Pakistan 7 Why pointers are not available on java? A) 1. Pointers lead to confusion for a programmer 2. Pointers easily crash a program. 3. Using pointers virus & hacking programs can be written. 8 What is Hot Spot? A) The block of code let to JIT compiler for the execution is called hot spot. www.hotspot.com is developed by JVM.

SUDHEER REDDY

POTHURAI

9 What is API document? A) API document is a HTML file that contains description of all the features of software, a product or a technology. It works has a heap file. API document like user documentation. To create API doc we need java doc compiler. Function code is available in header file. 10 What is the difference between #include and import? A) #include makes a C or C++ compiler to go to standard library and copy the entire header file code in to a C/C++ programs. So the program size increases unnecessarily wasting memory & processor time. Import statement makes the JVM to go to the java library, execute the code & substitute the result in to the java program. Thats JVM doesnt copy any code. So import is more efficient than #include 11What is JRE? A) JRE means java run time environment. JRE=JVM + java library JRE is available in JDK1.5. It represents entire software. 12 What are command line arguments? A) The values passed to main method at the time of running a program or called command line arguments. Its stores in array. 13 What is the distance between a float and double? A). Float represent up to 7 digits accurately after decimal point. Double represent up to 15 digits accurately after decimal point. 14 What is uni code? A) Uni code is a standard to include the alphabet from all human languages in java. Uni code system uses 2 bytes to represent a character. 15What is the value of the following expression? Given a=7? ++a * a++? A) A) 49 B) 64 C) 72 D) none of these 16 What is the difference between >> & >>>? A) >> shift the bits 2 words right & properties the sign bit (0 represent +ve 1 represent ve sign) >>> also shift the bits 2 words right bit. It does not protect sign bit. It always fills the sign bit with 0.That reason it is called zero-fill right shift. 17 Why goto statement are not available in java? A) 1) goto statements lead to confusion for a programmer. 2) goto statement from infinite loops which are draw backs in a program.

SUDHEER REDDY

POTHURAI

3) the documentation of the program will become difficult with more gotos are used. Documentation means preserving a copy of the program. Algorithm means a step of logic. 4) goto statements are not part of structured programming. Because of above reasons the goto statements are eliminates of java. 18What is the difference between System.exit(0) and System.exit(1)? A) System.exit(0) represents normal termination. System.exit(1) represents termination due to an error. 19 What is difference between System.out & Sytem.err? A) System.out is useful to display general messages. System.err is used to display error messages. Stream is one of the io device. 20 What are command line arguments? A) Command line arguments are values passed to main method from system prompt.

JVM allots memory in run time. args.length Size of arguments. 21 What is hash code? A) It is a unique identification number that is allotted by JVM to the objects. This number is also called reference number.

So the out put is not same. == is only compare reference numbers 22 What is the difference between == to and equals method while comparing the strings? A) == operator compares only the reference of string objects. Equals method compares the contents of the string objects. Hence the equals method gives reliable results. 23 What is string constant pool?

SUDHEER REDDY

POTHURAI

A) It is separate block of memory where the string objects are stored.

If(s1==s2) o/p: - equal. Because JVM does not waste memory. 24 What is the difference between the following statements? a) String s=Hello; b) String s=new String(Hello); A) When the first statement is executed JVM searches for the same object in the string constant pool. If the same object is found there then JVM will create another reference to the same object, if the same object not found JVM creates another object & stores it into string constant pool. When the second statement is executed JVM always create a new object without searching in the string constant pool. 25 What is the difference between a string & StringBuffer? A) String objects are immutable. StringBuffer objects are mutable. The methods which directly manipulate the data or not available in string class. Such methods are available in StringBuffer class. 26 What is software requirement specification (SRS)? A) SRS is a document that contains client requirements and strategies to fulfill those requirements. SRS is prepared by project leader. 27 What is software design specification(SDS)? A) SDS is a document that contains I/O screens, PSUDO code, DFDs dataflow diagrams, Black end data bases etc.., it is prepared by module leader. 28 What is the difference between object oriented programming language & object based programming language? A) Object oriented programming languages follow all the features of OOPs. EX: - C++, Java, Small Talk, Simula 67 Object based programming language follow all the features of OOPs, expect inheritance. EX: - Java script, VB script. 29 What is the default constructor & parameterized constructor? A) Default constructor is used to initialize every object with same data.

SUDHEER REDDY

POTHURAI

Parameterized constructor is used to initialize each object with different data. 30 What is constructor overloading? A) Writing 2 or more constructors with same name with difference in the parameter is called constructor overloading. 31 What is different between instance variables and static variables? A) 1) Instance variables are a variable whose separate copy is available to each object of the class. So any modification to the instance variable in one object will not modify the other objects. Static variables are variables whose single copy is shared by all the objects of the class. If the static variable value is modified. It affects the value in all the objects. 2) Where instance variables & static variables are stored Instance variables are created on heap. Static variables are stored on method area. 32 In how many ways can you create on object in java? A) Ways of creating on object: 1) Using new operator Employee obj=new Employee( ); 2) using factory method NumberFormat obj=new NumberFormat.getInstance( ); 3) using newInstance( ) method Class c=Class.forName(Employee); For name method will store employee that class name in an object This is represented by c. 4) Using cloning( ) Cloning means creating bitwise exact copy of an existing object. 33 What is object graph? A) A graph connecting several objects is called object graph.

34 What is the advantage of inheritance? A) In inheritance a programmer can re use already developed code. Because of these developing new programs will become easy. This increases productivity of programmer & hence the over all productivity of the company or organization will also increase.

SUDHEER REDDY

POTHURAI

35 What is method signature? A) Method name & its parameters is called method signature. 36 What is the difference between method over loading & method overriding? A) Method over loading: - Writing 2 or more methods with the same name, but with a difference in the method signatures is called method over loading. In method over loading JVM understand in the method is called depending upon the difference in the method signature. Method overriding: - writing 2 or more methods in super & sub classes with same name & same signatures is called method overriding. In method overriding JVM executes a method depending on the data type of the object. Achieving method overloading & method overriding using instance methods is an example of dynamic polymorphism. 37 What is final? A) 1) final is used to declare Constance Ex: - final double PI 3.14159 2) final key word is used to prevent inheritance. Ex: - final class A class B extends A // invalid 38 What is difference between primitive & advanced data types? A) 1) Casting can be used to convert one primitive data type in to another primitive data type. 2) Casting can be used to convert one advanced data type into another advanced data type. 3) Casting can not be used to convert a primitive data type into an advanced data type and vice versa (means reverse also). For this purpose we can use wrapper classes. 39 What is generalization & specialization? A) Moving back from sub class to super class is called generalization. Casting a sub class type into a super class is called a up casting or widening. Coming down from super class to sub class is called specialization. Casting a super class type into sub class type is called narrowing or down casting. 40 What is widening & narrowing? A) Widening: - Casting a lower data type into a higher data type is called widening. In widening no digits or precision are lost. Casting a sub class type into a super class is called an up casting or widening. In widening we can access super class methods. In widening we can access sub class methods. In widening us can not access sub class methods unless the override super class methods. Narrowing: - Converting a higher data type into lower type is called narrowing. In narrowing precision or digits are lost. This is called explicit casting. Casting a super class type into sub class type is called narrowing or down casting. Narrowing using super class object can not access either super class methods or sub class methods.

SUDHEER REDDY

POTHURAI

Narrowing using sub class object will make the programmer to access are the members of super class as well as sub class. 41 How can enforce discipline in the programmers to implement only your class features? A) By writing an abstract class or an interface I can enforce. 42 What is the difference between an abstract class & interfaces? A) A programmer writes an abstract class when there are common features shared by the all the objects. A programmer creates an interface when every feature is implemented differently for different objects. A programmer prefers to create an interface when he wants to leave implementation for third party venders. 43 How much memory is taken by class twos object? 1) 4 b 2) 8 b 3) >8 b 4) <8 b A) Ans is >8 b because

44 Why multiple inheritances are not supported in java?

A)

1) Multiple inheritance leads to confusion for a programmer. Operator over loading, multiple inheritances are not available in java.

2) If the programmer wants we can achieve multiple inheritance using interfaces.

SUDHEER REDDY

POTHURAI

class D extends A,B,C // invalid class D implements A,B,C // valid Here A,B,C are not classes only interfaces. So it is not multiple inheritances. This is way of multiple inheritances indirectly. 3) A programmer can achieve multiple inheritances by using single inheritance repeatedly. Because the above reasons the direct multiple inheritances is not available in java. 45 What is java archair file? A) Jar file is a compressed version of several. Class or. Java files. A jar file created using jar utility provided by sun micro systems. 46 What is class path? A) Class path is an operating system variable. That stores active directory path. To sea the class path D:\ psr> echo %classpath% Display content of class path .\;C:\Program Files\Java\jdk1.5.0_07\jre\lib\rt.jar;d:\psr; To set the class path to the package directory. D:\psr> set classpath=d:\psr\pskr;.;%classpath% Compile the above program & run it. 47 What is checked exception? A) The exception will occur during compilation & are executed by the java compiler are called checked exception. The exception which are detected at runtime by the JVM are called unchecked exceptions or run time errors. 48 All exceptions are subclasses of which class? A) Exception class. 49 What is throwable? A) Throwable is a class that represents is errors & exceptions in java 50 What is Exception? A) Any abnormal event in the program is called an exception. 51 What is the difference between throws & throw? A) throws is used to throw out of an exception without handling it. throw is used to create an exception & throwing it & handle it. 52 Which of the wrapper classes does not a constructor with string parameter? (or) Which of the wrapper classes contains only one constructor? A) Character 53 What is collection framework? A) It is a class library to handle group of objects. It is implemented in java.util package.

SUDHEER REDDY

POTHURAI

Collection object does not store copies of other objects. It stores only references of other objects.

Advanced java
1 What is load factor? A) Load factor determines at what point the initial capacity of a hash table or a hash map will be double. Load factor is 0.75 of hash table. For a hash table initial capacity x load factor = 11x0.75=8 approximately. It means after storing 8th key value pair will be doubled=22. 2 What is the difference between Vector & array list? A) 1) From the API perspective, the two classes are same. 2) Vector is synchronized & array list is not synchronized. Note: - We can make array list also synchronized by using: Collections. synchronizedList(new ArrayList( )); 3) Internally both are hold onto their contents using an array. A vector by default increments its size by doubling it, & on array list increases its size by 50%. 4) Both are good for retrieving elements from a specific position in the container or for adding & removing elements from the end of the container. All of these operations can be performed in constant time---0(1), but adding & removing elements in the middle takes more time. So in this case a linked list is better. 3 What is the difference between hash table & hash map? A) 1) Hash table is a synchronized, where as hash map is not. Note: - We can make hash map also synchronized by using: Collections. synchronizedList(new HashMap( )); 2) Hash map allows null values as keys & values, where as hash table does not. 3) That iterator in the hash map is fail-safe, while enumerator for the hash table isnt. 4 What is the difference between a set & list? A) 1) Sets represent collection of elements. Lists represent ordered Collection of elements (also called sequence). 2) Sets will not allow duplicates values. Lists will allow. 3) Accessing elements by their index is possible in lists. 4) Sets will not allow null elements, lists allow null elements. 5 Which is the thread internally running in every java program? A) Main thread.

SUDHEER REDDY

POTHURAI

10

6 What is the difference between thread & process? A) Process is a heavy weight, means it takes more memory & more processor time. A thread is a light weight process, means it takes less memory & less processor time. 7 How can you stop in the thread in the middle? A) 1) Declare the boolean type of variable & initialize at false boolean x=flase; 2) If the variable value is true , x return from the method. If(x) return; 3) To stoop the thread store true in to the variable System.in.read( ); obj.x=true; 8 What is the difference between extends Thread & implements runnable? A) Functionally both are same. If we use extends Thread then there is no scope to extend another class. Multiple inheritances are not supported in java. class MyClass extends Thread,Frame // invalid But if we write implements Runnable then there is still scope to extends some other class. class MyClass implements Thread,Frame // valid So implements Runnable is more advantage of than extends. 9 What is thread life cycle? A) A thread is crated by creating on object to thread class. The thread is executed by using start method. When the thread is started it goes into runnable state. Yield method passes the thread but still the thread will be in runnable state. The thread wills coming to not runnable state, when sleep or wait methods are used or if it is blocked on I/O the thread is not runnable state. From this state, it comes into runnable state after some time. A thread will die when it comes out of run method. The above states from the birth of a thread till its death are called life cycle of a thread. 10 What is an adapter class? A) An adapter class is an implementation class of a listener interface where all the methods will have empty body. For example window adapter is an adapter class window listener class. class Myclass extends WindowAdapter { public void windowClosing(WindowEvent e) { System.exit(0); } } 11 What is anonymous (means 1) inner class? A) It is an inner class whose name is not maintained & for which only one object is created to MyClass f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {

SUDHEER REDDY

POTHURAI
}

11 System.exit(0);

}); 12 What is the default layout manager in a frame? A) Border layout 13 What is the default layout manager in applets? A) Flow layout 14 Repaint methods calls which method? A) Update method it will call internally. INET 1)What is a singleton class?How do you writer it? Tell examples? A class which must create only one object (ie. One instance) irrespective of any number of object creations based on that class. Steps to develop single ton class:1.Create a Private construcor, so that outside class can not access this constructor. And declare a private static reference of same class 2.Write a public Factory method which creates an object. Assign this object to private static Reference and return the object Sample Code:class SingleTon { private static SingleTon st=null; private SingleTon( ) { System.out.println(\nIn constructor); } public static SingleTon stfactory() { if(st==null) st=new SingleTon( );\ return st; } } 2) What is the difference between using HttpSeassion & a Stateful Session bean? Why can't HttpSessionn be used instead of of Session bean? HttpSession is used to maintain the state of a client in webservers which are based on Http protocol. Where as Stateful Session bean is a type of bean which can also maintain the state of the client in Application servers based on RMI-IIOP 3)Question on Seggregation in UML? 4)What is Temporary Servlet? When we sent a request to access a JSP, servlet container internally creates a 'servlet' & executes it. This servlet is called as 'Temporary servlet'. In general this

SUDHEER REDDY

POTHURAI

12

servlet will be deleted immediately to create & execute a servlet base on a JSP we can used following command. Java weblogic.jspckeepgenerated *.jsp 5) Generally Servlets are used for complete HTML generation. If you want to generate partial HTML's that include some static text (this should not be hard coded in servlets) as well as some dynamic text, what method do you use? Using 'RequestDispather.include(xx.html) in the servlet code we can mix the partial static HTDirectoryML page. Ex:- RequestDispatcher rd=ServletContext.getRequestDispatcher(xx.html); rd.include(request,response); 6)Difference between <jsp:forward> and <jsp:include> tags? <jsp:forward> action tag redirect the servlet Request and Servlet Response to another resource specified in the tag. The path of the resource is 'relative path'. The output generated by current JSP will be discarded. <jsp:include>action tag process the resource as part of the current jsp. It include the o/p generated by resource, which is specified in the Tag to the current JSP *) In both the cases single Request proceses multiple resources. 7) Purpose of <jsp:plugin> tag: It is used to generate client broser specified HTML tags which results in download of the java plugin sofware. And the execution of the applet or java Bean component that is specified in the tag. 8) The time between Command Execution and Response is called? 9)Which method is called first each time a Servlet is invoked? When the servlet obj is not created init( ) method will be called. It servlet obje is already exists 'service() method will be called. 10)Tell about EJB tranctions and how to manage them? 11) Why DB connections are not written directly in JSP's? The main purpose of JSP is to seperate the business logic & presentation logic. DB connections deal with pure java code. If write this kind of code in JSP, servlet container converts the JSP to servlet using JSP compiler which is the time consuming process so this is better to write code wich deals with DB connections, Authentication and Authorization etc. in the java bean and use the <jsp:bean> tag to perform the action 12)What is key diffrence between using a <jsp:forward> and HttpServletResponse.sendRedirect( )? Ans: The <jsp:forward> action allows the request to be forwarded to another resource (servlet/jsp/HTMl> which are available in the same web-application (context).

SUDHEER REDDY

POTHURAI

13

Where as in the case of Response.sendRedirect() the request to be forwarded/redirected to another resource in the same web-application or some other web-application in the same server, or to a resource on solme other web-server. The key difference is by using <jsp:forward> single request from a browser can process multiple resources. Where as by using SendRedirect( ) multiple requests take place in order to process multiple resources. 13)Why beans are used in J2EE architecture instead of writing all the code in jsp's? In order to seperate the business logic and presentation logic beans are used. We write the business logic in the Beans. Where there is a change in business process we have to modify only the bean code not jsp code and viceversa. 14)How can a servlet can call a JSP error page? By simply includeing an <error-page> tag in web.xml file < error-page> < exception-type> javax.servlet.ServletException </exception-type> <location> /errorjsp.jsp </location> </error-page> By using Response.sendRedirect(error.jsp); or by using RequestDispatches.forward(error.jsp); we can call jsp error page in servlet. 15)What exception is thrown when Servlet initalization fails? ServletException . since init( ) throws ServeletException . 16) Explain MVC (Model-View-Controller) architecture? MVC:- In model view controller design pattern, the software has split into 3 pieces. MODEL-> Responsible for Managing Data-> Ex. Java Beans VIEW-> Responsible for generating the views->Ex. Jsp's CONTROLLER-> Responsible for user interactions & co-ordinate with MODEL &VIEW 17)What are the design patterns? Explain FACADE Design Pattern? 18) How do you perform testing? Do you use any automated testing tools? If so, what are they? 19)Difference between Application Server & Web server? Web servers are used for running web applications, the features are very less to compare application server the application server is specific to application. And it can run all the application including web application. Ex:- weblogic,websphere, Jbose. All are providing the more features than websever like tomcat. Application servers used for enterprise solutions, webservers are used middle tier webapplications. We can

SUDHEER REDDY

POTHURAI

14

20)JSP implicit Objects:1)out: used to send the content to the browser ex: out.println(xx) 2)Response: Represent HttpServlet Reques 3) Response: Represent HttpServletResponse 4) Page Context: used to access the objects like session, servlet context, Request, Response etc... 5) Session: Points to HttpSession objects 6) Application: Points to servlet context objects 7)Page: Points to current servlet objects 8) Exception: Points to Exception 21)JSP Action Tags, Directive Tags & Scripting Tags? Action Tag: These tags effect the runtime behaviour of the jsp page and the response set back to client tags are : <jsp: usebean> instantiate a new jsp bean class < jsp: setProperty>: setting the properties at runtime <jsp:param>:used to sending parameters <jsp:include>include a resource at runtime <jsp:forward>forward the control to specific resource <jsp:plugin>:to plugin a web resource url applet Directives: These tags effect the overall structure of the servlet that result from translation. 3 types of directives are defiend. Page directive: used to define and manipulate the no of page dependent attributes that effect the whole jsp. <%@page.......%> include directive: This instructs the container to include the content of the resource in the current jsp .<%include file=-----/> this file is parsed once, when translation. Taglib directive: To use tag extendtions to define custom tags. Scriptlets: There are used to include javacode in jsp page these are of 3 types scriptlet: used to write pure java code <%----------%> declarations: used to declare java variables and methods <%!int num=3; public void hello(String str) { return str; } %> Expressions:

SUDHEER REDDY

POTHURAI

15

This send the value of a java expression back to client. These results is converted to string and displayed at client. 22)<jsp:useBean> tag and it's properties? To saparate the code from the presentation it would be good idea to encapsulate the code in java object instantiate it and use it in our jsp. This instance is varaible is called 'id'. We can also specific life time of this object by using 'scope' attribute <jsp:useBean id='name' scope=scope class=beanclass/> Properties: id: a case sensitive name is used. Scope: The scope with in which the reference is available. page, request,session, application are possible values page is default class: the fully qulified classes name beanname: The name of the java beanclass type: This type must be super class of the beans classes 23)How do you implement Singe Thread Model in JSP? By simply include a page directives <%@page isThreadSafe=false %> 24)How do you declare a page as Erro Page. What tag you include in a JSP page so that it goes to specified error page in case of an exception? By includeing a page directive <%@ page isErrorPage=true%> then this page is including a page directive in our jsp pages <%@pase errorpage=url of the above jsp%> calling this page is including a page directive in our jsp page <%@page errorpage=url of the above jsp%>

25)Difference between Include Directive & Incude Tag? 26)Servlet is a java class. So, can there be a constructor in Servlet class or not? Why?

IncludeDirective <%@includefile=url%>

IncludeJas <jsp:includepage=urlflush=trueit hasanattributeusedtoflushthebuffer

SUDHEER REDDY

POTHURAI
IncludeDirective

16 IncludeJas beforeinclusionofresource

Thisincludetheresourceatcompilation Thisisdoneatrequestprocessingtime time Itincludesstaticcontent Itincludestaticordynamiccontent Thisisparsedbycontainer Thisisnotparsedbutincludedinplace

27)What is a servlet Context? How do you get it? ServletContext is also called as applicatin object . And this can be used for logging(stores some kind of information ) getting context parameters, getting the request dispatcher and storing the global data. We can get the serveletcontext using ServeletContext. i.e ServletContext sc = getServletContext( ); 28)What is Servlet Config? How do you get it? ServletConfig can be used to get the initiallization Parameters, to get the reference to the ServeletContext. There can be multiple serveletconfig objects in a webapplication. Each servelet has one Config object. The configration information is: servlet name, initalization parameters servlet context object. 29)What is Request Dispatcher? How do you get it? The name itself reveals that it is used todispatch the control to requesting resource. It is an interface used to include any resource with in our servlet or forward the controoler to any other resource. It contains two methods. Forward(---url); forward(---url); For getting this we have a method in servlet context interface. So we can get it by servlet context object sc.getRequestDispatcher( ); 30)Tag Libraries, their syntax, & usage? 31) Difference between JSP & Servlets? Both are webapplications used to produce web content that mean dynamic web pages. Bot are used to take the requests and service the clients. The main difference between them is, In servlets both the presentation and business logic are place it together. Where as in jsp both are saparated by defining by java beans . In jsp's the overall code is modulated so the developer who deesn't know about java can write jsp pages by simply knowing the additional tages and class names.

SUDHEER REDDY

POTHURAI

17

One more important to be considered is servlet take less time to compile. Jsp is a tool to simplify the process and make the process automate. 32)Difference between Hashtable & HashMap? Hash table is a Collection .To successfully store and retrieve objects from a hashtable, the objects used as keys must implement the hashCode method and the equals method. Hashtable is Sychronized and permit not null values only. Hashtable maps keys to values. Any non-null object can be used as a key or as a value. The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. 33) Question on Collections framework? The Collection API is set of classes and interfaces that support operations on Collections of Objects. 34) By default, Hastable is unordered. Then, how can you retrieve Hastable elements in the same order as they are put inside? we can retrieve hashtable elements in the same order by using the method elements which returns enumeration. 35) About Map data structures in Collections framework? A map cannot contain duplicate keys; each key can map to at most one value. The Map interface provides three collection views, which allow a map's contents to be viewed as a set of keys, collection of values, or set of key-value mappings. The order of a map is defined as the order in which the iterators on the map's collection views return their elements.The TreeMap class, make specific guarantees as to their order; others, like the HashMap class, do not. 36)Life Cycles of beans? 37)Isolation levels & Transaction levels? The isolation level measures concurrent transaction's capacity to view data that have been updated, but not yet committed, by another transaction if other transactions were allowed to read data that are as yet uncommitted, those transactions could end up with inconsistent data were the transaction to roll back, or end up waiting unnecessarily were the transaction to commit successfully. A higher isolation level means less concurrence and a greater likelihood of performance bottleneck, but alos adecreased chance of reading inconsistent data. A good rule of thumb is to use the highest isolation level that yields an acceptable performace level. The following are commin issilation levels, arranged from lowest to highest. 1) ReadUncommitted: Data that have been updated but not yet committed by a transaction my be read by other transactions 2) Readcommitted: Only data that have been committed by a transaction can be read by other transactions.

SUDHEER REDDY

POTHURAI

18

3) Repeatable Read: Only data that have been commited by a trasaction can be read by other transactions, and multiple reads will yield the same result as log as the data have been committed. 4) Serializable: This highest possible iosolation level, ensures a transaction's execlusive read-write access to data, it includes the conditions of ReadCommitted and Repeatable Read and stiplulates that all transactions run serially to achieve maximum data integrity. This yields the slowest performance and least concurrency. The term serializable in this context is absolutely unrelated to the database. 38)ejbActivate( ) Vs ejbPassivate(), ejbCreate() Vs ejbPostCreate(), ejbLoad() Vss ejbStore( ). Which type of EJB can use bean pooling? How can you call an EJB from a JSP/servlet? EjbCreate( ) is called before the state of the bean is written to the presistence storage. After this method is completed, a new record is created and written to the presistence storage. If you are developing an EJB following 2.0 specs, you can have overloading methods in the form of ejbcreatexxx( ). This will improve the development so you can have different behaviour for creating a bean, if the parameters differs. The only requirement is that for each ejbCreatexxx( ) you need to have corrisponding createxxx() methods in the home or local interface. EjbPostCreate( ) is called after the bean has been written to the database and the bean data has been assigned to an EJB object. So when the bean is available. In CMP, this method is normally used to manage the beans container-managed relationship file 39)How to configure Data Source in WebSphere server? 40)How you manage configuration control? 41) What is a singleton class? 42)How do you send data from an applet to Servlet? What are the steps involved in it? When ever we send a request to the JSP file it checks the servlet representing the JSP file. Then the web container runs the jsp compiler that generates the servlet code Directory 43)I have a file of very very large file size at client side, and i want to send the file to a servlet(this servlet will store it somewhere), what is the best method to do it? 44)What is the difference between normal beans and EJBs? JavaBeansmaybevisibleor nonvisibleat AnEJBisanonvisual,remoteobject runtime. For example, the visual GUI component may be a button, list box, graphic,orachart JavaBeansareintendedtobelocaltoa EJBsareremotelyexecutablecomponents

SUDHEER REDDY

POTHURAI

19

JavaBeansmaybevisibleor nonvisibleat AnEJBisanonvisual,remoteobject runtime. For example, the visual GUI component may be a button, list box, graphic,orachart singleprocessandareprimarilyintended orbusinessobjectsthatcanbedeployed torunontheclientside.Althoughone onlyontheserver candeevelopserversideJavaBeans,itis fareasiertodevelopthemusintheEJB specificationinstead. JavaBeansisacomponenttechnologyto EventhoughEJBisacomponent creategenericjavacomponentthatcan technology,itneitherbuildsuponnor becomposedtogetherintoappletsand extendstheoriginaljavaBeans applications specification. JavaBeanhaveanexternalinterface calledthepropertiesinterface,which allowsabuildertooltointerpretthe functionalityofthebean EJBshaveadeploymentdescriptorthat describesitsfunctionalitytoanexteternal buildertoolorIDE

45)How system level services in EJBs are managed? And tell about Deployment Descriptor? 46)What are various types of EJBs? We have 3 types of EJB's 1) Seasion Beans: Stateless Seasion bean Stateful Seasion bean Session beans are mainly used to implement business process applications 2) Enatity Beans: Entity beans used to manage business entites Bean Managed Persistance beans(BMP):--we need to write jdbc code to manage business data Container Managed Persistance bean(CMP):--Tools supllied as part of the container generates the jdbc code for managing the data 3) Message Driven Beans: Used to implement business processing and Business Data 47)What is the purpose of ejbLoad( )? With CMP , the bean developer doesnot need to write any database access logic into the bean, but bean is notified by the container when its state is synchronized with the database. The container notifies the bean using the ejbLoad( ) and ejbStore( ) methods.

SUDHEER REDDY

POTHURAI

20

The ejbLoad( ) method alerts the bean that its container-managed fields have just been populated with data from the database. This gives the bean an opportunity to do any post processing before the data can be used by the business methods. The ejbStore( ) method alerts the bean that its data is about to be written to the database. This give the bean an opportunity to do any pre-processing to the fields before they are written to the database. The BMP bean manges its own persistance , but relies on the container to coordinate its reads and writes so that persistance is accomplished in a transactional safe manner. Coordination with the container is accomplished through two mechanisms: the persistance callback methods [ejbLoad() and ejbStore()] and the Environment Naming Context (EJB). The ejbLoad( ) and ejbStore( ) methods notify a bean that its time to read and write data to the database respectively. In a BMP entity bean the code for reading and writing data to the database is done with in these methods . The ejbLoad() is called at the beginning of transaction, just before any business methods are executed , and the ejbStore( ) is called at the end of a transaction just before its commited. This keeps the bean state in perfect synchronization with transactions being executed , without the bean developer having to explicitly manage the transactional operation. 48)What is the purpose of ejbStore( )? 49)What is the purpose of XML? When ever we send a request to the JSP file it checks the servlet representing the JSP file. Then the web container runs the jsp compiler that generates the servlet code 50) In webLogic clusters, what is the load balancing algorithm Load Balancing for servlets & jsps Load Balancing for EJB &RMI objects Load Balancing for JMS Load Balancing for JDBC connection Round Robin Load Balancing Weight based load Balancing Random Load Balancing Round Robin, weight based & Random affinity. 51)How many Queues does a MDB listen to? 52)Where is the Deployment Descriptor placed? Deployment Descriptors gives the information about our resources used in our application to the server. To avoid the hand coding we used these deployment descriptors. Which are placed under WEB-INF directory as an .xml file 53)Can a JSP be converted to SERVLET and the vice versa always?

SUDHEER REDDY

POTHURAI

21

We can convert a JSP to servlet but it is not possible in case of servlet to a jsp. Usually server takes the responsibility of converting a JSP to a servlet based on .tld files and taghandlers. But there is no server which takes servlet as input and gives jsp file as output. 54)About EJB types,CMP,BMP,session, Entity beans? Used for implementing business processing session beans are divided into two types 1) Stateful Session Bean 2) Stateless Session Bean In stateful Bean, state of the session is maintained. It takes more memory to maintain the state for each object. If there are 100 clients/requests. The server maintains 100 stateful beans each bean for a client. In stateless session Bean, no need to maintain the state of a bean. ii) Entity Beans: used to manage business data BMP: we need to write jdbc code for managing data CMP: code to manage the data will be generated by the tools. iii) Message Driven Bean: Used for implementing business process ( some as session beans use). This will be driven by message. 55)Can a client Context call ebjRemove( ) method? In ejbRemove( ) method will be called before removing the object, it is similar to destroy( ) method in servlets. In case of stateless session bean we cant call ejbRevove( ) method from client context. It depends upon the server when to remove on delete the object from the server In case of stateful session bean. The client can call ejbRemove( ) method by calling remove method to remove the object from the server. In case of entity beans, ejbRemove( ) method means deleting the data from two database. It can be called from the client context. 56)Which is faster in execution-JSP or SERVLET ? Why? Servlet is faster in execution as every jsp is changed on converted to servlet before starting the execution. Thus the server need to spend some time to convent a JSP file to servlet at its first time execution. But developing a jsp is very easy when compared to servlet. Every time before executing a jsp & server searches for related servlet file. If it existsWhen ever we send a request to the JSP file it checks the servlet representing the JSP file. Then the web container runs the jsp compiler that generates the servlet code then start the execution of that servlet otherwise server creates servlet files for those jsps first and then execution takes place 57) What is the difference between Callable Statement and Prepared Statement?

SUDHEER REDDY

POTHURAI

22

Callable statement are used to call the stored procedures in a database where as prepared statements are used to provide dynamic input for the statement. 58)Can we declare final method in abstract class? If a method is defined as final then we cant provide the reimplementation for that final method in its derived classes i.e overriding is not possible for that method. An abstract class constains one or mole abstract method. If all the methods ar of type abstract then use we can declare that class as abstract or interface. But in interface all the methods must be of type abstract. We can declare final method in abstract class suspose of it is abstract too, then there is no used to declare like that. Final abstract int test(String str); Here we cant provide the implementation for the test method as it is declared as final. But at the same time you declare it as abstract. [Abstract means it is responsibility of derived class to provide implementation for this] Here we cant provide the implementation for the test method. Even we descried to provide implementation totally our meaning for declaring it as abstract is spoiled. 59) Can we declare abstract method in final class? It indicates an error to declare abstract method in final class. Because of final class never allows any class to inherit it. 60)How can you pass an object of data from one JSP to anoter JSP? 61) Can the same object os Stateless Session bean be shared by multiple clients? Can the same object os Stateful Session bean be shared by multiple clients? It is possible to share the same object of stateless session bean by multiple clients. A Server maintains a pool of objects in case of stateless session bean. And every When ever we send a request to the JSP file it checks the servlet representing the JSP file. Then the web container runs the jsp compiler that generates the servlet code time for a request it uses one of the pool of objects which is free at that time. The server gets back that object in to the pool only after the client work on that object is Directoryover [ client says that by invoking ejbremove() method] After the client release that object, the server may used the same object to handle another client request, thus the same object to handle another client request. Thus the same object of stateless session can be shared by multiple clients But sharing the same object for multiple clients is not possible in case of state full session bean. Here server should maintain an object for every clients to handle / maintain the state of that object. 62)In java, which has more wider scope? Default or Private? Default has more scope than private

SUDHEER REDDY

POTHURAI

23

Private: accessible only to the members of that class where it is defined. Default: We can access this from any class in the program/file 63)Design Pattern? Design pattern is a solution for recurring (reoccurring ) problems. Any one can provide best solution for a problem which is occurring repeatedly or often and we can give any name for that solution is known as design pattern. 64)Which Design Pattern hides the complexities of all sub-systems? 65)Which bean can be called as Multi-Threaded bean? Stateless session bean can be called as Multi-Threaded bean as for every request of users is handled by creating a new threaded for the same object. 66) In CMP bean, which method executes only once in life time? 67)What is the difference between Server and Container? A server provides many services to the clients, A server may contain one or more containers such as ejb containers, servlet/jsp containersetc. Here a container holds a set of objects. 68)How will u authentication a user? 69)Difference between SAX and DOM? SAXstandsforSimpleAPIforXML.Itisastandardinterfacefor eventbasedXMLparsing.Programmersprovidehandlerstodealwith differenteventsasthedocumentispassed. IfweuseSAXAPItopassXMLdocumentshavefullofcontrolover whathappenswhentheeventoccurasresult,customizingtheparsing processextensively.Forexampleaprogrammermightdecidetostop anXMLdocumentasassoonastheparserencountersanerrorthat indicatethatthedocumentisinvalidratherthanwaitinguntilthe documentisparsed.Thusimprovetheperformance. DOMstandsforDocumentObjectModel.DOMreadsanxml documentintomemoryandrepresentsasitastree.Eachnodeoftree representsaparticularpieceofdatafromtheoriginaldocument.The maindrawbackisthattheentirexmldocumenthastobereadinto memoryforDOMtocreatethetreewhichmightdecreasethe performanceofanapplicationasthexmldocumentgetlarger. 70)Have u ever used <xsl:include> how to include an xslt in another xslt?

SUDHEER REDDY

POTHURAI

24

TheextensivelyStylesheetLanguage(XSL)isaW3Cstandardfordescribinga presentationrulesthatappliedtoxmldocuments.XSLincludesbothtransformation languageandformattinglanguage.XSLTisanxmlbasedlanguageandW3C specificthatdescribeshowtotransformanxmldocumentintoanotherxml document. 71)Which loads driver classloader or JVM? 72)Types of Drivers in JDBC? TypesofdriversinJDBC Type1:JDBCODBCBridgeDriver Type2:NativeAPIPartlyJavaDriver Type3:JDBCNetpureJavaDriver Type4:NativeProtocolPureJavaDriver 73)How to implement connection pooling by ourself? 74) Will service all doget,dopost or the reverse? 75) How can u implement connection pooling by ourself? When ever we send a request to the JSP file it checks the servlet representing the JSP file. Then the web container runs the jsp compiler that generates the servlet code 76)How can u implement hasmap if u r not having it in java? 77)How will u declare a synchronized block? What does this represent in the Declaration of synchronized block? When two or more threads need to access to a shared resource they need some way to ensure that the resource will be used by only one thread at a time. The process by which this achieved is called synchronization. Thegeneralformofsynchronizestatement: Synchronized(object){ //statementtobesynchronized } heretheobjectisareferencetotheobjectbeingsynchronized.A synchronizedblockensuresthatacalltoamethodthatismemberofobject occursonlyafterthecurrentthreadhassuccessfullyenteredtheobjects moniter. 78) What is servlet chaining? One servlet output will give as a intput of another servlet in servlet chaining.

SUDHEER REDDY

POTHURAI

25

79)What is dynamic bindig? Can u explain with an example? When ever we send a request to the JSP file it checks the servlet representing the JSP file. Then the web container runs the jsp compiler that generates the servlet code 80)Can u read all elements from any array?

81)What is event delegtion model? Describe it with an example? The event Delegation model defines standard and consistant mechanisms to generate and process events. A source generates and event and sends it to one or more listeners. The listeners simply waits until it receives an event. The advantage of this design is that the application logic that processes events is cleanly separated from the uses interface logic that generates those events. 82)What is a tier? What is the difference between tier and system or computer? 83)What do u mean by portability? In c and c++ sizeof( ) operator tell us the number of bytes allocated for data items. Different data types might be different sizes on different machines, so the programmer must find out how big those types are when performaing operations that are sensitive to the size. For example one computer might store integer in 32 bites, where as another might store integers as 16bits. So the java does not need a sizeof () operator for this purpose because all the data types are the same size on all machines. We need not think about protability. 84)What is translation unit in jsp? When we create a source code file for java its commonly called a compilation unit or translation unit. 85) What is context in webapplication? 86)What are multiple and single processor servers? How session is handled when the server is multi processor server? When ever we send a request to the JSP file it checks the servlet representing the JSP file. Then the web container runs the jsp compiler that generates the servlet code 87)If server crashes the threads will continue running or will they stop? What happens to the servlet? 88)Explain MVC pattern by taking any one component ex JtextField or Jbutton? 89) What is pooling of servlet?

SUDHEER REDDY

POTHURAI

26

Whenever a request is called it picks up the instance of that servlet from a Container which contains the number of instances from it & this is maintained by the controls that is web.xml 90)Why cocoon? Why not struts? What is cocon? 91)How is u implementing session in ur applicatin? The web containers can create the session objects on behalf of client request. For accessing this session objects we need to use request.getSession(Boolean value); For every session object it is creating a sessionID to generate 92) What is serialization? What are the method in implementing serialization? When ever we send a request to the JSP file it checks the servlet representing the JSP file. ThDirectoryen the web container runs the jsp compiler that generates the servlet code 93) Why jsp is used if we have servlets? Java server pages are designed to simplify the process of developing a web application on the top of servlet technology 94)Is servlet threadsafe? Yes Servlet is a thread safe by implementing the single thread model we can fulfill this. 95) What happens when jsp is called? When ever we send a request to the JSP file it checks the servlet representing the JSP file. Then the web container runs the jsp compiler that generates the servlet code 96)When Jsp code changes, how the servlet is reloaded? When ever we send a request to the JSP file it checks the servlet representing the JSP file. Then the web container runs the jsp compiler that generates the servlet code 97)What is difference between StateFul and Satateless Session Bean? 98)What is difference between Bean ManagedPersistance and Container ManagedPersistance? IN the case of Bean Managed Persistant we need to write the manual coding but in the case of container managed persistant bean the tool itself will generate the code to satisfy our requirements 99) Difference between forware(request,response) and SendRedirect(url)inservlet? In the case of forward (req, res) the outputs generated by the first servlet will be discarded but only the output generated by the second servlet will be send to the client . But in the case of send redirect() will be setting the status code & pointing to the new url. 100)Draw & explain MVC Architectur?

SUDHEER REDDY

POTHURAI

27

101) What is synchronizing? With respect to multithreading , synchronization is the capability to control the access of multipul threads to shared resources . Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often leads to significant errors. 102)How to prevent Dead Lock? We can prevent this Dead Lock by implementing synchronization proceder & improve the efficiency of the Application. 103)How Servlet Maintain Session and EJB Maintaine Session? 104)Difference between HasMap and Hash Table? In the case of Has Maps there is no synchronizable in the case of Has Table it is synchronizable and thread safe but it is slow in performance. 105)Difference between Swing and AWT? AWT is heavey weight , where as Swings are light weight. These two are using to implement GUI applicatins. 106) Types of Enterprise Bean? 1)Session Beans. 2)Entity Beans 3)Bean managed persistant Bean. 4)Containes Managed persistant Bean 5)Message Driven Bean. The above 5 are the Enterprise Entity Beans. 107)Service of EJB? The EJB provides the following services a)concurrency b)Transaction Management c)Persistancy d)Security e)Threading f)Synchronization g)Object cashing h)Object Naming i)Object activation j)Object serialization k)Object sharing l)Object communication m)Object Decision 108)Why not to use free J2EE servers? 109)Alternative:Tuxedo ?

SUDHEER REDDY

POTHURAI

28

110)J2EE server offeres? It offers servlets, JSP,JNDI,JDBC & structs. 111)Java Naming and the Directory Service? It is Noting but Java Native Device Interfaces where we can store our remote object inside the file & this is used to identify the Home object 112) XML deployment descriptor? It is nothing but web.xml where we can store all the resource information of all the objects inside this file 113) Entity Bean session Bean where to use which Bean? Container Types: 114) What is the Max amount of information that can be saved in a Session Object?
As such there is no limit on the amount of information that can be saved in a Session Object. Only the RAM available on the server machine is the limitation. The only limit is the Session ID length(Identifier) , which should not exceed more than 4K. If the data to be store is very huge, then it's preferred to save it to a temporary file onto hard disk, rather than saving it in session. Internally if the amount of data being saved in Session exceeds the predefined limit, most of the servers write it to a temporary cache on Hard disk.

115) How to confirm that user's browser accepted the Cookie?


There's no direct API to directly verify that user's browser accepted the cookie. But the quick alternative would be, after sending the required data tothe users browser, redirect the response to a different Servlet which would try to read back the cookie. If this Servlet is able to read back the cookie, then it was successfully saved, else user had disabled the option to accept cookies.

116) How do i get the name of the currently executing script?


Use req.getRequestURI() or req.getServletPath(). The former returns the path to the script including any extra path information following the name of the servlet; the latter strips the extra path info. For example: URL getRequestURI getServletPath getPathInfo getQueryString http://www.javasoft.com/servlets/HelloServlet/jdata/userinfo? pagetype=s3&pagenum=4 servlets/HelloServlet/jdata/userinfo servlets/HelloServlet/ /jdata/userinfo pagetype=s3&pagenum=4

117) What are Good Ways of Debugging a Servlet? Are IDE's which support Servlet Debugging? There are couple of Methods. Firstly servers like JRun and others provide separate logs where all your Print requests will print their data into. For example requests to System.out. and System.err go to different log files. If this features is not available or you want to maintain logs separately for each module then you can create a static class called "LogWriter" and call the method inside the try catch loop. The print method in Log Writer will be writing to a custom defined Log File.

SUDHEER REDDY

POTHURAI

29

try { .... } catch(Exception exp) { LogWriter.print("Debug : The following error occurred at function .... ') } Also Inprise JBuilder supports Servlet Debugging. Please refer to JBuilder documentation for details. Just as a Cautionary note, from your Servlets, never call System.exit(0). The results might be unpredictable. Might close down the entire Server. The Best way is to catch the Exception and either send resultant Error Page to the Browser or Write to a Log file and inform user about the Error.

118) How do I know when user Session has expired or removed? 119) How can i stress test my Servlets?
You can use one of the following products to stress test your Servlets. ServletKiller From Allaire Software (Free Product) E-Load from RSW Software Web Application Stress Tool From Microsoft JMeter from Apache

120) What is Server Side Push and how is it implemented and when is it useful?
Server Side push is useful when data needs to change regularly on the clients application or browser , without intervention from client. Standard examples might include apps like Stock's Tracker, Current News etc. As such server cannot connect to client's application automatically. The mechanism used is, when client first connects to Server, (Either through login etc..), then Server keeps the TCP/IP connection open. It's not always possible or feasible to keep the connection to Server open. So another method used is, to use the standard HTTP protocols ways of refreshing the page, which is normally supported by all browsers. <META HTTP-EQUIV="Refresh" CONTENT="5;URL=/servlet/stockquotes/"> This will refresh the page in the browser automatically and loads the new data every 5 seconds.

121) What is the difference between Multiple Instances of Browser and Multiple Windows? How does this affect Sessions?
From the current Browser window, if we open a new Window, then it referred to as Multiple Windows. Sessions properties are maintained across all these windows, even though they are operating in multiple windows. Instead, if we open a new Browser, by either double clicking on the Browser Shortcut icon or shortcut link, then we are creating a new Instance of the Browser. This is referred to as Multiple Instances of Browser. Here each Browser window is considered as different client. So Sessions are not

SUDHEER REDDY

POTHURAI
maintained across these windows.

30

123)Difference b/w jsp:forward and request.sendRedirect. 124)Using which obj we can call trasnsaction control statements. 125) Question on native with synchronized is it possible? 126) Can more than one will have his state in stateful session bean? 127) How u can database operations used in stateful session bean? 128) What do we use as path in xml? 129) What is struts? 130) Explain MVC Architecture? View : - The UI view involves the presentation layout(the actual HTML output), for the result of the interaction . For HTML clients, this can be done using JSP. Controller : - presentation logic (the logical connection between the user and EJB services), necessary to process the HTTP request , control the bussiness logic, and select an appropriate response . This can be provided by Java Servlets or Session Beans. Business logic (Model) :- The business logic ( the core business transactions and processing ), necessary to accomplish the goal of the interaction ( calculations, queries , and / or updates to a database ,etc). Business logic should be separated from UI logic. This makes it possible to have different clients( for ex browser and GUI) using the same beans . Separating the 2 also makes the business components easier to re-use , maintain, and update or change. 131) How you can create servlet objects at the time of web application starts? <Load-on-startup> 1 </Load-on-startup> a) if we use configure a servelet using Load-on-startup the webContainer creates our servlet object when we deploy the webapplication. b) when we undeploy the webapplication the webcontainer destroys ( removing the object from JVM destroys the servelet object ). 132) Suppose i created 5 servlet objects dynamically and i make a request to the container, the which object will give to me? 133)What is the difference between servlet config and servlet context? There will be only one ServletContext object for a webapplication. There can be multiple ServletConfig objects in a single webapplication. Servlet Config can used get Parameters 134) How you can create a connnection object in weblogic? And how you can access that object?

SUDHEER REDDY

POTHURAI

31

135) What is difference between jsp:forward and Reqdisp.forward( )? 136) What is difference between Req.sendRedirect and reqdisp.forward( )? 137) How you can insert values into a table without writing the code( )? 138) How you can call a jsp from a servlet and vice versa? 139) What is the difference between jsp writer, printwriter? 140) What are the implicite variables in jsp? 141) How may ways you can use threadclass and in which situation you can be use runnableinterface? 142) What is the difference between string and String Buffer? 143) What is the difference between SAX and DOM? 144) If we can implement a constructor in a servlet? What will be happen? 145) What is difference between stateless and stateful session beans? Stateless: 1) Stateless session bean maintains across method and transction 2) The EJB server transparently reuses instances of the Bean to service different clients at the per-method level (access to the session bean is serialized and is 1 client per session bean per method. 3) Used mainly to provide a pool of beans to handle frequent but brief reuests. The EJB server transparently reuses instances of the bean to service different clients. 4) Do not retain client information from one method invocation to the next. So many requir the client tomaintain on the client side which can mean more complex client code. 5) Client passes needed information as parameters to the business methods.6) Performance can be improved due to fewer connections across the network. Stateful: 1) A stateful session bean holds the client session's state. 2) A stateful session bean is an extesion of the client that creates it. 3) Its fields contain a conversational state on behalf of the session object's client. This state describes the conversation represented by a specific client/session object pair. 4) Its lifetime is controlled by the client. 5) Cannot be shared between clients. 146) What are the disadvantatges of CMP? 147) Structs concept you are implementing on model1 or model2? 148)What in an interface? 149)What are the difference between interface and abstract class?

SUDHEER REDDY

POTHURAI

32

The key difference between an interface and the corresponding abstract class is that a class or interface can have unlimited number of immediate super interface but it can only hace one super class. There are two primary axes of inheritance an object-oriented language like java. Implementation inheritance is where the sub-class inherits the actual code implementation from the parent. Interface inhyeritance is where the sub-class adheres to the public interface of the parent. Also java actally mixes the two notions together a bi.... java interfaces are nice and clean. When you implement an interface, you are stipulating that your class adheres to the contract of the interface that you spefified. Java class inheritance isn't so clean when you sub-class in java you are getting both the code inheritance but you are also stipulating that you sub-class adheres to the contract of the interface of the parent class. Abstrct class in java are just like regular java classes but with the added constraint that you cannot instance then directly. In terms of that added constraint, they are basically classes which don't actually implement all lof the code specified by their contract. 150) How you can access the implementation from the database to JSP/Servlet? 151) How you can get connection object from weblogic? A checked exception is an exception that must be dealt with in the code, either by catching it or by specifying a throws clause. Checked exceptions are all exceptions that are subclassed from Exception except RuntimeException. An unchecked exception is an exception that need not be dealt with programmatically. It includes RuntimeExceptions (and its subclasses) and Error and its subclasses. ================================================================ ==== Checked vs. unchecked exceptions There are two kinds of exceptions in Java, checked and unchecked, and only checked exceptions need appear in throws clauses. The general rule is: Any checked exceptions that may be thrown in a method must either be caught or declared in the method's throws clause. Checked exceptions are so called because both the Java compiler and the Java virtual machine check to make sure this rule is obeyed. Whether or not an exception is "checked" is determined by its position in the hierarchy of throwable classes. Figure 4 shows that some parts of the Throwable family tree contain checked exceptions while other parts contain unchecked exceptions. To create a new checked exception, you simply extend another checked exception. All throwables that are subclasses of Exception, but not subclasses of RuntimeException are checked exceptions. 152) How you can send parameters to a servlet? 153) How you can create global parameters that is the parameters which are used by all the servlets? 154) How many types of transactions are supported by EJB? What are they txsupport,tx-no.supported what is the difference between tx-required,tx-not supported?

SUDHEER REDDY

POTHURAI

33

REQUIRED : Method calls require a transaction context. If one exists , it will be used ; if none exists, one will be created. Can use Existing Transaction. If not already in transaction will start new one , commit when method completes.This transaction attribute should be used when ever the bean is accessing any transactional resouce manager. ForEx: a bean accessing a database through JDBC should use the transaction attribute Required. You should use this if you want the operation to always run in a transaction. TX- NOT-SUPPORTED : The bean runs out side the context of a transaction. Existing transactions are suspended for the duration of method calls. Does not execute in a Transaction. Existing transaction is suspended. This transaction attribute can be used when the resource manager responsible for transaction is not integrated with the application server. ForEx, if the bean method is invoking an operation on a SAP System which is not integrated with the application server, the server has no control over the transactions happening at the SAP system. In such a case , it is best to set transaction attribute of the bean to be Not-Supported. 155) Explain about checked and unchecked exceptions? A checked exception is an exception that must be dealt with in the code, either by catching it or by specifying a throws clause. Checked exceptions are all exceptions that are subclassed from Exception except RuntimeException. An unchecked exception is an exception that need not be dealt with programmatically. It includes RuntimeExceptions (and its subclasses) and Error and its subclasses. ================================================================ ==== Checked vs. unchecked exceptions There are two kinds of exceptions in Java, checked and unchecked, and only checked exceptions need appear in throws clauses. The general rule is: Any checked exceptions that may be thrown in a method must either be caught or declared in the method's throws clause. Checked exceptions are so called because both the Java compiler and the Java virtual machine check to make sure this rule is obeyed. Whether or not an exception is "checked" is determined by its position in the hierarchy of throwable classes. Figure 4 shows that some parts of the Throwable family tree contain checked exceptions while other parts contain unchecked exceptions. To create a new checked exception, you simply extend another checked exception. All throwables that are subclasses of Exception, but not subclasses of RuntimeException are checked exceptions. 156) How you can create dynamically servlet objects at the time of webapplication deploying? 157) What is the difference between function and procedure in oracle? 158) What is the difference between drop and truncate?

SUDHEER REDDY

POTHURAI

34

159) What is the difference between truncate and delete? 160) Suppose you are doing any actions on database but you system will not doing any actions on database? How you can know about this thing?( By starting logging information in a file) 161) Servlet are by defaulty single threaded or multiple threaded? 162) What is the syntax of jsp:usebean? jspusebean syntax: <jsp:useBean id=beanvar class=ourpack.ourclass scope=session|| application||page||request/> 163) What is the difference between reqdis.forward(),jsp:forward? jsp:forward is a Action tag in jsp which is used to forward the request from one page to other page . This is similar to requestDespatcher.forward. In requestdespatcher forward ,only one request will be sent by the browser and it is processed by two servlets/jsps. 164)What is a view? View in a Mvc pattern is containing the presentation logic. We are using jsps as view in MVC architecture. 165) What is the difference between callable statements, prepare statements , createstatements? callable statements: callable statements are used to retrieve the stored procedures from the database. ie., these statements are used when two or more sql statements are retrived over and over. prepare statement: theser are precompiled statements which are stored in database. We are using these prepare statemnts if the same query is to be executed over and over. statement: statement is used to execute single sql statement.

SUDHEER REDDY