interviewquestions (2)

33
SQL: 1. Sql query:::::::: Sum of the sale for particular date? 1. Product => name, prod_id, 2. Invoice => prod_id, rate, invoice date select sum(amount) from sales where time_id between to_date('2006-02-01', 'YYYY-MM-DD') and to_date('2006-02-28', 'YYYY-MM-DD'); 2. $session? 3. Hint? 4. stored procedure? 5. Function? 6. Trigger? 7. Cursor type? JAVA: 1. What are the collections using? 2. How do avoid duplicate in collection? 3. Print the key and Value in Hashmap?????? 4. How to make arraylist as sync? 5. How do invoke stored proc in java? JSP: 1. Implict objects? 2. How load data XML/XSLs? 3. JSP pre compile? Servlet: 1.Servlet chinning Web services: 1. How you implement the webservices.in you project 2. Explain the Axis and spring based web services. UNIX: 1. Basic UNIX commands 2. How set the class path

Upload: ojhaanilkumar

Post on 09-Nov-2014

108 views

Category:

Documents


1 download

DESCRIPTION

it cover java interview q

TRANSCRIPT

Page 1: InterviewQuestions (2)

SQL:

1. Sql query::::::::Sum of the sale for particular date?1. Product => name, prod_id, 2. Invoice => prod_id, rate, invoice date select sum(amount)   from sales   where time_id between to_date('2006-02-01', 'YYYY-MM-DD') and to_date('2006-02-28', 'YYYY-MM-DD');

2. $session?3. Hint?4. stored procedure?5. Function?6. Trigger?7. Cursor type?JAVA:

1. What are the collections using?2. How do avoid duplicate in collection?3. Print the key and Value in Hashmap??????4. How to make arraylist as sync?5. How do invoke stored proc in java?

JSP:1. Implict objects?2. How load data XML/XSLs?3. JSP pre compile?

Servlet:1. Servlet chinning

Web services:1. How you implement the webservices.in you project2. Explain the Axis and spring based web services.

UNIX:1. Basic UNIX commands2. How set the class path3. How find the jar file missing?

Project :-----------Explain Project .And its Process Flow Java-------

Page 2: InterviewQuestions (2)

Oops Concept.What ways are using Thread.Which Collection framework are you used.ArrayList and HashMap.Exception and Errors.Exception types with examples.How you handling exception in your application.Write code - arraylist for adding integer value 1.How you handle nullpointer exception . Jsp and Servlet:----------------------1) Three files are used .How to files are included in jsp .    How you get dynamic values. (Static and Dynamic Includes ).2)  Difference between jsp and servlet.3)  Custom tags in jsp 

Struts:---------1)  Did you written user-defined ActionController2)  Struts Flow3) Dispatch and Lookup Dispatch Action4) Tiles and Validator framework5) Bean Write usage6) What are the taglibs in struts.7) Condition type which taglibs we can use.8) Prepared Statment and Callable Statement9) How you call the Procedure and how you set anf get the values. SQL:-------1) What type of joins available.2) Explain self join.And what condition it will use.3) Difference of Inner join and self join.4) Explain Left outer join.5) Write query for this condition.    Two tables(dept,employee) having empid,empname, dept(dept table) and dept ='X'.6) Explain Procedure and Functions.7) Write prototype for Procedure and Functions.

1) About Current project with Roles & Responsibilities2) How implementation phases are carried out at on-site?3) How support phases are carried out at off-shore?4) How to get Hibernate Session instance?5) What is the difference between openSession and getCurrentSession?6) What is the difference between get/load and createCriteria?7) Why motivation for Struts and why not only Servlets/JSP?8) What is the Life Cycle of a Servlet?9) When destroy method gets called?10) How to call destroy method explicitly?

Page 3: InterviewQuestions (2)

11) Any challenges faced in your experience?

1. Roles in current project 2. Difference between Interface & Abstract Class3. Reflection4. Design Patterns used in your projects5. Major Components of Struts6. Web services project done in Ford, told about it. 7. How to generate data in XML file8. In a web application , how the performance is ?9. Outer Joins in Oracle10. DECODE in Oracle11. Locks in Oracle12. Explain Deadlock13. Have you seen log files.14. How will you resolve Null pointer Exception

1. What classes have you used in Struts recently? Dispatch action class explained. 2. Can you explain request response workflow in struts. Explained in detail.3. How did you do validation in your project? Validation framework explained.4. Have you used the validate method in struts?Explained.5. Can you name some abstract classes in java? If you don't remember just explain the concept of abstract classes.Explained.6. What is an interface?Explained7. Explain the concept of polymorphism and encapsulation.Explained in detail.8. Do you know about optimistic locking in databases?I have come across the term but not used it in projects.9. What is lazy loading?Explained.10. Have you used ajax in your projects?Explained.

11. How comfortable are you with SQL?Comfortable in writing simple queries and also queries with joins.

Page 4: InterviewQuestions (2)

SUPER-G

1. Whar are the Changes we need to make for making n application struts enabled.

We need to make changes to web.xml

inlude struts config xml etc

2. explain the struts flow

3. whats the difference between action and Lookup dispatch action

4. what are the ways in which you can create an object

5. how write a code, which will should be called when ever an object is created

6. what are the call beck methods in Struts form

7. explain singleton pattern

8. how to include i18n in struts

9. where to mention the resource bundle file name in struts

10. what is the default scope of the form bean in struts, how to change it

11. how do u write java code in JSP

12. is it possible to write java method in JSP

13. how to include a custom tag in to ur jsp

14. how to set buffer size of a jsp, what is the significance of this

1. Can I have more than one struts-config.xml file for a single Struts application? Yes we can.. for example..

<init-param> <param-name>config</param-name>

Page 5: InterviewQuestions (2)

<param-value>/WEB-INF/struts-fndt-config.xml,/WEB-INF/struts-plugin-config.xml,/WEB-INF/struts-app-config.xml</param-value>

</init-param>

2.Have you used Display Tag?

3.How Can you change the Value of a Certain Column(like Formatting Et...) in a Display table, on the Fly?

We need to use a Table decorator.

4.What is difference between LookupDispatchAction and DispatchAction?

The difference between LookupDispatchAction and DispatchAction is that the actual method that gets called in LookupDispatchAction is based on a loookup of a key value instead of specifying the method name directly.

5.What is the difference between ForwardAction and IncludeAction?

The difference is that you need to use the IncludeAction only if the action is going to be included by another action or jsp. Use ForwardAction to forward a request to another resource in your application, such as a Servlet that already does business logic processing or even another JSP page.

6. Explain about token feature in Struts

Tokens are used to check for invalid path by the user:

1) if the user processes back button and submits the same page

2) or if the user refreshes the page which will result to the resubmit of the previous action and might lead to unstability..

To solve the abv probs we use tokens

1) in previous action type saveTokens(HttpServletRequest)

2) in current action check for duplication bu

if(!isValidToken())

7. Default FormBean Scope in Struts and How to change the Scope?

Default Scope is Session we can Change it in struts Config 8. How do you Configure Validator framework

<Descriptive Answer>

Page 6: InterviewQuestions (2)

9.how do you perform javascript validations struts 10. how to use i18n in struts 11. what the custom tags you have used

SQL:

1. Explain Joins, type of join

2. purpose of Sub querys

3. Explain what is ORM (any not specifically toplink)

4. what are the aggregate Function you have used?

min, max, sum,avg etc

5. what is the use of NVL decode functions

1) When a user submitted a jsp page. that page having (attribute of )action="login.do". the container will call to WEB.XML. in that web.xml thert is two section servlet And servlet mapping

2) In servlet mapping it find *.do in the url-pattern. if it found to take the name of servlet. and check the corresponding class. in the servlet section. that class is ActionServlet.3) ActionServlet is the controller of Struts module architecture. in Action servlet having the service method. in that method we create RequestPrecessor class instance4) Service(req,res)RequestPrecessor rp = new RequestPrecessor();5) We call a process method of RequestProcessor class through the instance rp.process(req,res)6) In the request processor class have the process method with the parameter of req,res. then it has 1 if condition in this class. that condition return always true. because that is dummy method.7)Inside that condition ther is 6 steps are processing

Page 7: InterviewQuestions (2)

a)Create a action mapping instance in the "Struts-Config.xml". it will kept all details of the action mapping path, value, type forward, validation=true/false, input ="*.jsp" etc these r created instance b)Then it will create Form class instance before it check the name of action mapping and form name are coincidence or not if it same it will create form instancec)Then it will go to ActionMapping instace the ris mention or not the validate =true/fale if false it will not execute the this step else it will execute this step.d) Then it will create action instance e) Next it will take four parameters of execute Method it will return ActionErrors instance. if it is not empty. it will go to error page other wise it will got to corresponding page. else if it is empty if will go further and display corresponding value of page in jsp view.This is struts flow.

1. Roles in current project 2. Difference between Interface & Abstract Class3. Difference between implements & Extends4. What ways we can use Thread and which is the best one?5. Difference between request processor and request dispatcher6. Explain about internatiolization concept in struts and how do we achieve this concept in

struts7. How do you handle the exceptions in struts?8. Explain about Ajax framework9. Explain about validator plug in frame work in struts? How do you handle the validations in

struts?10. What are the design patterns’ you are familiar and explain one of the design pattern in

detail11. What is the sequence diagram and class diagram?12. How do you rate your self as a developer?13. What are your strengths14. Would like to learn any technologies?15. What was the toughest situation you have faced in your previous project?

1.Current project and roles and responsibilities you hold?2.difference between Overloading and Overriding?3.class diagrams and sequence diagrams?4. what is the tool you have used to create the class diagrams?5. How you handling exception in your application.6.handling exceptions in struts and jsp?7.how do u contact the webservices from ur application?8. How you implement the webservices.in you project9. what protocol you have used to call webservices? (Soap or wsdl)

Page 8: InterviewQuestions (2)

10. what is response you got from webservices and when you will get?11.where you will write the ajax code?12. Have you used ajax in your projects?13. can u give me some example where to use ajax?14. validations done using javascript?15.have u used the Junit? 16.How you have done the Junit testing for your application?17. what are the databases you have used?18.Have you done the class design? And architecture design?19. have u done database design?20.have you wrote the storedprocedures in your project? Do you know how to write?21. What is the Action Controller?22. How Action Controller know for the particular request which action it should send. where you will configure it in struts?23.How do u do the performance testing?24.Any tool used for doing performance testing?25.How you do the performance tuning? What are all the step you will check?26.what is the ORM tool you have used? Hibernate or JPA?27.How you have configured JPA to ur application?28.How you got the connection from JPA to fetch the data from the database?29.What is MVC Architecture?30. what are your strengths and weeknesses?31. Have you got any time recognition in the team for the exellent work at critical situation.32.What is your way of thinking to learn the new technologies in very short time?

1. What are oops concepts?2. Write a program to reverse the array? A[]={ 1,2,3,4,5,6,7} with less no of iteration.3. How can we define the capacity of arraylist? --- ensureCapacity().4. Overriding concept. Class A{

Int i=10; Public void test(){ System.out.println(“super class”);}}

Class B extends A{Int i=20; Public void test(){ System.out.println(“sub class overridden method”);}Public void ride(){

Page 9: InterviewQuestions (2)

System.out.println(“sub class method”);}}

Class c{Public static void main(String, args[]){ A a=new A(); B b=new B(); A c=new B(); B d=new A();

a.test();b.test();c.ride();

System.out.println(“a.i”+a.i);System.out.println(“b.i”+b.i);System.out.println(“c.i”+c.i);}}}

5. Difference between ArrayList Vs Vector?6. How do you handle the exceptions in struts?

7.Explain about Ajax framework8. Explain about validator plug in frame work in struts? How do you handle the validations in

struts?9. What are the design patterns’ you are familiar and explain one of the design pattern in detail10. What is struts flow?11. why string is made as immutable?12. String str=”shabarish”; String str1=”shabarish”; Str=”shabarish soore”;

Str==str1 ? true or falseStr is changed to “shabarish soore” then what will happen?

13. Explain about stack memory and heap memory?14. explain synchronization and serialization?15. what for transient and volatile keyword used?16. How you will synchronize the variable in a class?17. what is servletconfig and servletcontext?18. Struts Architectural flow?19. custom tags?20. comparator concept?

Ex: if you are having a class testing and variables f1,f2,f3 and objects a,b,c? how youe will sort the objects based on value of f2?21. It is possible to call a file in server2 from server1 ? ---NO22. javascripts concepts?

Page 10: InterviewQuestions (2)

23. whats the difference between dispatch action and Lookup dispatch action?24. How you will declare the size of the arraylist to be 1000? ---ensureCapacity();25. Why they made string class as immutable?Ans:

Why String is immutable or final in Java This is one of the most popular interview question on String in Java which starts with discussion of What is immutable object , what are the benefits of immutable object , why do you use it and which scenarios do you use it. This is some time also asked as "Why String is final in Java" .

It can also come once interviewee answers some preliminarily strings questions e.g. What is String pool , What is the difference between String and StringBuffer , What is the difference between StringBuffer and StringBuilder etc.

Though there could be many possible answer for this question and only designer of String class can answer this , I think below two does make sense

1)Imagine StringPool facility without making string immutable , its not possible at all because in case of string pool one string object/literal e.g. "Test" has referenced by many reference variables , so if any one of them change the value others will be automatically gets affected i.e. lets say

String A = "Test"String B = "Test"

Now String B called "Test".toUpperCase() which change the same object into "TEST" , so A will also be "TEST" which is not desirable.

2)String has been widely used as parameter for many java classes e.g. for opening network connection you can pass hostname and port number as stirng , you can pass database URL as string for opening database connection, you can open any file by passing name of file as argument to File I/O classes.

In case if String is not immutable , this would lead serious security threat , I mean some one can access to any file for which he has authorization and then can change the file name either deliberately or accidentally and gain access of those file.

3)Since String is immutable it can safely shared between many threads ,which is very important for multithreaded programming and to avoid any synchronization issues in Java.

4) Another reason of Why String is immutable in Java is to allow String to cache its

Page 11: InterviewQuestions (2)

hashcode , being immutable String in Java caches its hashcode and do not calculate every time we call hashcode method of String, which makes it very fast as hashmap key to be used in hashmap in Java.  This one is also suggested by  Jaroslav Sedlacek in comments below.

5) Another good reason of Why String is immutable in Java suggested by Dan Bergh Johnsson on comments is: The absolutely most important reason that String is immutable is that it is used by the class loading mechanism, and thus have profound and fundamental security aspects. Had String been mutable, a request to load "java.io.Writer" could have been changed to load "mil.vogoon.DiskErasingWriter"

Deepthi interview questions with Ford(7+)1. Exception handling. What is Error and Exception?2. design pattern used in previous project.3. What is Model in Struts.4. Traceability matrix5. Threads - There are two synchronized method in a class. Can two seperate threads run the

two methods at the same time.(Thread 1 runs method 1 and thread 2 runs method 2?6. How will you display the message you are nth user to this website?7. Difference between forward and sendRedirect()?8. what are different type of locks in Threads?9. there is a static class variable in your class will it be affected by threading?10. how will you make your jsp implement singlethreadmodel?11. other than doGet and doPost what are other methods in Servlet12. how will you make a servlet single threaded?13. Explain about ORM tool used in your project? Hibernate or ibatis?14. Dispatch action and LookupDispatchAction difference?15. Joins 16. implicit objects in jsp 17. difference between page and pageContext.18. servlet life cycle? What does the destroy method do?19. what is the implicit object for servlet context.20. explain tiles taglib in struts. if in a template page when we use tiles and one of the jsp page is

missing will the page be rendered.21. Explain Cursors22. Have you done code review? Is there a standard code review document shared across

different projects or each project has its own code review checklist?23. Have you done performance tuning in code as well as SQL? How will you performance tune

your application?

Narasimha Interview questions with Ford:

Page 12: InterviewQuestions (2)

1)Explain final, finalize() and finally?

2)What is a static block and how should I use it?

3)Difference between statement and Prepared Statement?

4)Difference between forward and sendredirect?

5)Difference between dispatch action and lookup dispatch action?

6)How do you invoke servlet config?

7)Expalins joins in oracle?

8)Expalin the validatory framework in struts?

9)what is servlet chaining?

10)expalin Design patterns which you have worked ?

11)What is lazy loading and aggressive loading?

12)forcefully how do you invalidate a session object?

13)what is cloning? what are the ways of cloning?

14) In a simple application you are getting a 400 error to resolve what you will do?

15)Is it a advantage or burden to have a hibernate in a project

1) Have you involved problem solving in your previous projects2) How you are handled exception in your Project 3) How you Resolved Errors in your Project4) What is Synchronization 6) What is the difference between extends and Implements7) Performance Tuning 8) Design patterns9) Struts Flow10) How you are handling transaction in struts11) Dispatch Action12) Request Processor and Dispatcher13) Have you involved UML 14) Usage of ORM15) Jax16) How you are updating yourself with new technologies17) Which technology you have learned last18) Joins

Page 13: InterviewQuestions (2)

19) Deadlock errors20) Webservices21) what’s your strength and weakness22) How you had relationship with your previous clients

23) How you had relationship with your teammates

Java Generics Types of Exception Wildcard in Java AutoBoxing in Java Abstract & Interface Servlet Chaining Types of Forms in Struts LookupDispatch Action & Dispatch Action How you will ensure connection has closed properly in your code How you will map one-many mapping in hbm file What you have learned in your experience should follow the standards

Forward

a forward is performed internally by the servlet the browser is completely unaware that it has taken

place, so its original URL remains intact any browser reload of the resulting page will simple

repeat the original request, with the original URL

Redirect a redirect is a two step process, where the web

application instructs the browser to fetch a second URL, which differs from the original

a browser reload of the second URL will not repeat the original request, but will rather fetch the second URL

redirect is marginally slower than a forward, since it requires two browser requests, not one

objects placed in the original request scope are not available to the second request

In general, a forward should be used if the operation can be safely repeated upon a browser reload of the resulting web

Page 14: InterviewQuestions (2)

page; otherwise, redirect must be used. Typically, if the operation performs an edit on the datastore, then a redirect, not a forward, is required. This is simply to avoid the possibility of inadvertently duplicating an edit to the database.

More explicitly (in terms of common SQL operations) :

for SELECT operations, use a forward for INSERT, UPDATE, or DELETE operations, use a redirect

In HTML, a <FORM> tag can either GET   or   POST  its data. In this context, a GET corresponds to a SELECT-then-forward, and a POST corresponds to an edit-then-redirect.

It is strongly recommended that forms for the input 

Functions Vs Stored procedures:

A function is a subprogram written to perform certain computations

A scalar function returns only a single value (or NULL), whereas a table function returns a

(relational) table comprising zero or more rows, each row with one or more columns. Functions must return a value (using the RETURN keyword), but for stored procedures

this is not compulsory. Stored procedures can use RETURN keyword but without any value being passed.

Functions could be used in SELECT statements, provided they don’t do any data

manipulation. However, procedures cannot be included in SELECT statements.

A function can have only IN parameters, while stored procedures may

have OUT or INOUT parameters.

A stored procedure can return multiple values using the OUT parameter or return no value

at all.

Can we call stored procedure from function? Yes.  You have to create one Stored procedure ("Proc1") - You have to one Function. Calling the Stored procedure inside the Function using OPENROWSET - I use the function to execute/call the stored procedure...

But calling SP in Function is not encouraged. Exactly... that's because the servers needs to assume that the state of the DB and data will not change by calling the function (again, by design because the server would basically need to recompile the queries after each call to the function...

Page 15: InterviewQuestions (2)

which happens on every rows in the select). If you need to do such modifications, it needs to be done inside a proc.

COREJAVA:1. What is Synchronization in java?2. What are the major difference between String, StringBuffer and String Builder? 3. What are the jdk1.5.0 Features in java.4. What is Generic? How to write methods in generics?(from jdk1.5.0).5. What is covariant types?6. What are differences between comparable Comparator interfaces?8. What is usage of Static import?9. What is Singleton Class? Explain with Example?10. What is class loader subsystem?ORM1. How to configure the Hibernate in your project?2. Any Experience on Top Link,3. What are the advantages of hibernate.4. What is the use of pagination?5. What are the differences between HQL and native sql? When we go for Native sql?6. What are the differences between lazyloding and early loading?7. What is usage of sessions in hibernate? When we go for session?8. What is the usage of CriteriaAp1? 9. What are the advantage of joins in hibernate?10. How to use positional parameters in HQL? What are advantages?11. What are the differences between JDBC and hibernate and advantages of Hibernate?12. How many ways configure hibernate.cofig.xml file?13 what is Data Source what is the usage of data sources?14. How to configure data source at server level?15. What are the attributes of Native Sql?16. What is the difference between Session Factory and Session Object? 17. What is dialect in Hibernate mapping file?

JSP&SERVLET1. Can we cal init () method from service method? Y/N (YES MEANS HOW, WHAT HAPPEN) 2. How to prepare custom tags?3. When destroy method is invoked4. Where you call destroy method in your servlet5. How to destroy session object? Struts

1. Dispatch Action vs. LookupDispatchAction.2. What are the struts Jsp tags?3. What is Abstract Controller? What is the usage of abstract Controller?

Web Services1. Explain Web services types and WSDL attributes.

Page 16: InterviewQuestions (2)

Soft skills1. What are the documents you have prepared for your development projects? (in

Ford- 27 Tech. spec)

2. Your strength and weakness.

3. Rate yourself on java out of 10. (Always give 10/10 to show your confident level)

1. what is the difference between static keyword and singleton pattern?2. could  you please write Long wrapper class?3. explain sdlc life cycle?4.  how to implement date function in your project?5. how to write methods in jsp page? Where ?6. Jsp implicit objects7.Joins in Oracle8.string vs string buffer vs string builder9. how to write  immutable class?10.Roles in your previous  company?

SELECT supplier_name,decode(supplier_id,10000, 'IBM',

10001, 'Microsoft',10002, 'Hewlett Packard',

'Gateway') resultFROM suppliers;

The above decode statement is equivalent to the following IF-THEN-ELSE statement:

IF supplier_id = 10000 THEN     result := 'IBM';

ELSIF supplier_id = 10001 THEN    result := 'Microsoft';

ELSIF supplier_id = 10002 THEN    result := 'Hewlett Packard';

ELSE    result := 'Gateway';

END IF;

Page 17: InterviewQuestions (2)

How do you prevent duplicate request submission?How to forward a request to different server in servlet?How to trace user visits in servlet? In case after restarting the server how will you do that?What is Sendredirect?Calling Destroy method in service method? Is that possible? What will happen?Servlet life cycle.What are the other methods available in servlet other than doget,dopost,init,destroy? What’s the use of it?What is finally method? When it will be called? If we return a values in catch block then finally method will be called? Exception in java? How to handle exception?

Explain MVC patternCan we have multiple struts-config files? Where will you configure?Validator framework in struts.How to make a JSP single threaded?How to make a servlet single thread model?Lookup dispatch action in struts

How to make performance tuning for the code that makes the application running slow? What are the possible thing, you can do  in a code to increase performance?Exceptions in Java. Difference between classnotfound exception and noclassdeffound error?How will you sort a collection?Collection framework.Reflection in java.How do you make, only three object should be created and used by the application?Singleton pattern in java. What the need of it?How will you sort an object by comparing the three attribute in a class (name, age, city)?What is daemon thread?

How will you remove duplicate rows in table?How to handle null in database?Cursors in stored procedure and how to get the cursor values in java?Join types in oracle? Is full outer join supported in oracle?

How to implement one to many mapping in top link?How to know if the cache is latest? Optimistic locking in top link? How to check for stale data in optimistic locking? If it is a stale data, will it throw errors?

Page 18: InterviewQuestions (2)

Amirthraj(5+)

1. Design patterns available within struts framework: talked about MVC, front controller, command pattern.

2. How many instance of action servlet?

3. Actionservlet configured in web.xml and application is not performing. One suggestion was to add one more instance of Actionservlet to enable multiple handling. Is this suggestion valid? we can customize the Actionservlet and configure in web.xml to handle specific requests

4. I want the global auditing to be enabled, i.e. logging info to be polled into a table all information like navigation information. Where can I plug this information? How do you approach? write a filter that intercepts the requests and generate

5. What about struts 1,x where there are no filters?

6. Any other way?

7. Lookup dispatch action, why?

8. How do you prevent the earlier data from being carried over when user presses the back button?

10. Web services

11. Hibernate

12. Rate? 5/5

13. Levels of caching in hibernate 1 level maintained by session; methods like save, update etc. 2nd level- maintained by session factory

14. Situation 1 jvm in each machine. One user trying to log in and edit. Data is cached. There is a cache available in other machine as well. How hibernate handles this scenario? using locking mechanism optimistic or pessimistic. Optimistic- if an update is made then optimistic, pessimistic, always lock irrespective of updated

15. What about insert? Do you know something about versioning of objects? each object has a version that compares with the last version. Based on this we can ensure that no two objects from the same user access the jvms at the same time.

Page 19: InterviewQuestions (2)

16. How do you call aggregate functions in hibernate HQL provides the aggregate functions in hibernate.

17. Difference between overloading and overriding?

18. Abstract class vs. interface when do you use abstract class or interface? Interface describes behavior and used always. Abstract class only when it has to be extended by just one class

19. Antipatterns?

20. Hashmap and treemap

21. Why treemap throws exception when I insert null and then add another element? there is an automatic sort that occurs in treemap in background which throws exception when another item is inserted against a null value, hashmap does not automatically sort in background hence it’s okay to accept null.

22. Explain a situation you had personal accomplishment

23. Personal strengths and weakness?

24. If you run a team and launched a brand new application running on multi-tier environment – customers say the customers say performance problems; tell me how do you approach to solve the problems. What do you ask customers.

25. HttpSession objects – pros and cons?

26. Any other distributed protocols you know like FTP, RMI, P2P

27.

finally in java?in which scenario the finally won't be called?collection list and set?comparator and comparable?why we need a comparator if we have the comparable?how to sort arrays ?interface and abstract class?synchronization?

Page 20: InterviewQuestions (2)

have u faced any out of memory issues?if i ask u to retrieve 1 lack records from db ?what would be your best suggestion?how to prevent dead lock?i am reading file and inserting into db in middle of it i am getting exceptionhow i can continue it?how to make immutable classes?why they have made the string immutable?

struts flow?if i have both validate() and validator framework what will happen?in which scenario the dyna action form will not work?look up dispatch action?internationalization in struts?how to configure message resource in struts?

jsp

servlet multithread?how to make it single thread?if i call destroy what will happen? normal flow work as expected?how to make jsp as single thread model?how to prevent dead lock?how to share information between two servlets resides in different server?how call the servlet from one ?

dbstored procedure? why we need to write stored procedure?function vs stored procedure?join ? outer join?

soft skillsrecent technical issue u faced and how u addressed it?your development activities?have you prepared test cases for the requirement?apart from test cases how you verify your code works fine?talk about different stages of development? design, coding, testing  production supportdocuments prepared?have u done a peer review?

Optimistic Locking is a strategy where you read a record, take note of a version number and check that the version hasn't changed before you write the record back. When you write the record back you filter the update on the version to make sure it's atomic. (i.e. hasn't been updated between when you check the version and write the record to the disk) and update the version in one hit.

Page 21: InterviewQuestions (2)

If the record is dirty (i.e. different version to yours) you abort the transaction and the user can re-start it.

This strategy is most applicable to high-volume systems and three-tier architectures where you do not necessarily maintain a connection to the database for your session. In this situation the client cannot actually maintain database locks as the connections are taken from a pool and you may not be using the same connection from one access to the next.

In hibernate, it can be achieved by using<version name=”version” generated=”always”>(or) simply adding ‘version’ on pojo class.(or) using annotation @version(or) optimistic-lock="all" in class mapping.

Custom Request Processor:<controller><set-property property="processorClass" value="com.test.TestRequestProcessor"></set-property></controller>

Method to overrider: processPreprocess

Class or static variables:- Only one copy of a class variable exists across all the instances of the object belonging to the class for which it is declared.Class variables , or static variables, are shared among all instances of a servlet. NEVER thread-safe (No, not even if servlet implements SingleThreadModel.)

Request attributes :- Always thread-safe Session attributes:- NEVER thread-safe Context attributes :- NEVER thread-safe

http://www2.sys-con.com/ITSG/virtualcd/java/archives/0304/maso/index.html

5+

1. Do you have Ford experience? – 2. Explain the role your last project on ERP – gather requirements, POC, mock screens, design classes, design db, constraints, code development, validate, unit testing and demo output to customer.3. What about DB experience? – Oracle 10g, MySQL4. Experience with test cases – explained about assigning a task being broken down into packets, used Jira tool to track. Talked about RTM to ensure if the requirement is completed5. Unit testing – Junit6. Did you involve in other forms of testing – not much, did a few load testing and integration testing in the past and then UAT

Page 22: InterviewQuestions (2)

7. What methodology you have used? – we followed waterfall but we also involved client in intermittent stages. Talked about prioritizing, allocating the tasks and planning8. Can you tell me what is an iterator? – it’s like a pointer, using iterator is fast9. Iterator is an interface? – yes it is an interface.10. Enumeration and iterator differences – enumerator is slow and iterator is fast11. Can we modify elements with iterator / enum – iterator will throw concurrent modification exception when it is handling the elements of collection – 12. How is an arraylist implemented? – insertion order preserved, difference is array size is incremented gradually – tentative13. Why do you think the delete performance is poor with array list compared to linked list – 14. In emp class (id, name). I want to add employees into a set will it retain the 10 elements? – Hash set don’t allow duplicates but set allows so we have to override equals and equals to method15. String and stringbuffer – answered16. How is string maintaining immutability – 17. How can you make class immutable – define the class final, private constructor – related that to the defining the string class18. Static method or static block – 19. Singleton pattern? – constructor is made private and initialize a 20. Exception handling? – try catch21. Difference between error and runtime exception – error cannot be handled runtime exception can be handled22. Best practices used in coding – inheritance, group common variables to base class, define interface, follow design patterns23. Code reviews –24. Anything towards performance improvement? –25. Oracle SP? – 26. If you have to manipulate a large set of data how do you do in Oracle? – 27. Trigger – it’s kind of SP that gets triggered upon some events28. Constraints in DB – not null, primary key, check, foriegnkey29. Inline and sub queries ; sb – query inside a query; inline – executed concurrently with outer query30. Where or having clause – use having for aggregate functions, but where is for scalar comparison- use groupby with having31. Overview of struts flow? – 32. Validation framework in struts? – 33. JSP expression language? – 34. Display tag? –

Ranga(4+)

Page 23: InterviewQuestions (2)

1) Action Form is coming under which part in mvc?

2) How to call another web application from your current application?3) What is factory pattern?4) I have a JDBC connection in singleton pattern so if I try to call the method how many connections will created?5) What is Page context & page?6) We can call destroy() in service method?7) Have you use any sorting techniques other than collection framework?8) Have you worte any data manipulations in stored procedure other than DML operations?9) What is the disadvantage of cursors?10) can you write a query second highest salary in emp table?11) Have you worte your won aggregated funtions other than predefined func?12) Have you used having clause

13) Any documents you prepared in your previous project?14) How the count will increased when users are accessing the web pages?

a) If same user is accessing once again the same website how to manipulate count value?b) If system is crashed unexpectedly once the application is up & how to maintain the same count value?

Servlets Performance tuning tips1. Use init() method to cache static data2. Use StringBuffer rather than using + operator when you

concatenate multiple strings3. Use print() method rather than println() method4. Use ServletOutputStream rather than PrintWriter to send binary

data5. Initialize the PrintWriter with proper size6. Flush the data partly7. Minimize code in the synchronized block8. Set the content length9. Release resources in destroy() method.10. Implement getLastModified() method to use browser cache

and server cache11. Use application server caching facility12. Use Mixed session mechanisms such as HttpSession with

hidden fields13. Remove HttpSession objects explicitly in your program

whenever you finish the task

Page 24: InterviewQuestions (2)

14. Reduce session time out value as much as possible15. Use 'transient' variables to reduce serialization overhead if

your HttpSession tracking mechanism uses serialization process.16. Disable servlet auto reloading feature.17. Use thread pool for your servlet engine and define the size

as per application requirement.

5+1. What is your role in the project?2. Design pattern other than MVC and how you have used in project? 3. Can a singleton pattern be duplicated? 4. How a request is processed in the flow of struts?5. What are the different scopes? 6. Where do you need request scope and where session? 7. How do you ensure security in struts using struts config file? 8. Exception handling9. Class cast exception 10. String and string buffer11. Difference between and generalization and realization? 12. Send direct and forward? 13. Security components 14. UML role of ? 15. Class diagrams, sequence diagrams 16. Persistence layer framework? 17. How does Hibernate work?http://viralpatel.net/blogs/introduction-to-hibernate-framework-architecture/

18. What is HQL? 19. Explain outer join? 20. SQL Server has the way to identify sequence numbers, what is it called? 21. PL/SQL tell me advantages / disadvantages? 22. What is optimistic lock? 23. Testing or development tell me a situation and the fix you suggested 24. Web services – JAXB –

GCBP-PROJECT

Page 25: InterviewQuestions (2)

Struts flow? – MVC2 architecture

How do you do validation? – Validator plugin, validator framework and programmatic validation

What is a dispatch action? What is the difference between request.requestdispatcher or context.requestdispatcher() – How do you include static page Difference between get and post? –When do you go for get and when for postWhat is servlet mapping What is marker interface? Immutable class? Difference String Stringbuffer and stringbuilder? Iterator and For each in Collections? LIstIterator and Iterator? Vector and arraylist –Public static void main Static keyword what does it mean? ORM tool? – HibernateHibernate flow HQL – Hibernate query languageWhat is cascade in Hibernate How do you process errors when you get How do you handle with respect to the flowWhat are the different types of action classes available in strutsWhat is the use of lookup Dispatch actionValidations in struts Validation framework JSP implicit objects Jsp scope? Exception handling in strutsIf output of jsp need not be cached how do you doString Stringbuffer and stringbuilderWhy is string builder faster than string bufferWhat is the difference between final, finally and finalize Collection – What is the role of Iterator?What is a list IteratorHash Map and Hash TableTo convert Hash Map to synchronized, how do you do thatHibernate xml fileHow is hibernate communicates with databaseDifference between Load vs get in hibernate How do you rate yourself as a Java developer Tell me a situation when you had a difference of opinion and how you resolved

1st Nov 2012 (Venkateswarlu Interview)Tell me about your self and experience related to Technology. What Technologies you are more expertise.What is Struts? Explain about flow.

Page 26: InterviewQuestions (2)

How to handle Exceptions in Struts Application.Validation frame work in strutsDifferent types of Actions in Struts.Difference between Dispatch Action and Lookup Dispatch Action. Where we can use lookup dispatch action.How to handle exception in Jsp pageWhat are the different types of Scopes.Where we can use Session Scope and Request ScopeWhat is Mutable and Immutable ClassesDifference between String Buffer and String Builder.What is CursorWhat is the Difference between Iterator and ListIteratorWhat is HashMap and HashTableWhat is the functionality of HashCodeWhat is ORM and HibernateHow to Configure HibernateHow Hibernate will works.What is the Difference between Get and LoadWhat are the interfaces available in HibernateWhat is Hibernate Criteria.

CascadeServlet mappingJsp exceptionOrm flowWhen we use triggers?Get and Post?Wht is HQL How u wil implement the HQL..AND structureAdv and dis Adv of hibernate ?Security in struts?Authentication and authorizationWhat authentication and authorization handled in the previous project ?Context dispatcher and request dispatcher