Wednesday, June 8, 2016

Java interview Questions(Ford India,Chenai- 2013)

SQL:

1. Sql query::::::::
Sum of the sale for particular date?
1. Product => name, prod_id,
2. Invoice => prod_id, rate, invoice date
2. $seeion?
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
  3. How find the jar file missing?

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

Java
-------
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 ActionController
2)  Struts Flow
3) Dispatch and Lookup Dispatch Action
4) Tiles and Validator framework
5) Bean Write usage
6) What are the taglibs in struts.
7) Condition type which taglibs we can use.
8) Prepared Statment and Callable Statement
9) 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 & Responsibilities
2) 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?
11) Any challenges faced in your experience?



1.     Roles in current project
2.     Difference between Interface & Abstract Class
3.     Reflection
4.     Design Patterns used in your projects
5.     Major  Components of Struts
6.     Web services project done in Ford,  told about it.
7.     How to  generate data in XML file
8.     In a web application , how  the performance is ?
9.     Outer Joins in Oracle
10.  DECODE in Oracle
11.  Locks in Oracle
12.  Explain  Deadlock
13.  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?
Explained
7. 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.







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 Srtuts 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 dou 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>

                                                <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 for by the uer:

                                1) if the user presses 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 unstabality.. 

      To solve the abv probs we use tokens 

                                1) in previous action type saveTokens(HttpServletreuest)

                                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 Request and we can Change it struts Config 8. How do you Configure Validaor framework

                <Descriptive Answer>

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 instance
4) 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 
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 instance
c)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 Class
3.     Difference between implements & Extends
4.     What ways we can use Thread and which is the best one?
5.     Difference between request processor and request dispatcher
6.     Explain about internatiolization concept in struts and how do we achieve this concept in struts
7.      How do you handle the exceptions in struts?
8.     Explain about Ajax framework
9.     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 detail
11.   What is the sequence diagram and class diagram?
12.  How do you rate your self as a developer?
13.  What are your strengths
14.  Would like to learn any technologies?
15.  What was the toughest switchwation you have faced in your previous project?















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(){
  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.test();
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 framework
8.         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 detail
10.       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 false
Str 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 ? ---NO
22.       javascripts concepts?
23.       whats the difference between action and Lookup dispatch action?



Feature
Struts 1
Struts 2
Action classes
Struts 1 requires Action classes to extend an abstract base class. A common problem in Struts 1 is programming to abstract classes instead of interfaces.
An Struts 2 Action may implement an Action interface, along with other interfaces to enable optional and custom services. Struts 2 provides a base ActionSupport class to implement commonly used interfaces. Albeit, the Action interface is not required. Any POJO object with a execute signature can be used as an Struts 2 Action object.
Threading Model
Struts 1 Actions are singletons and must be thread-safe since there will only be one instance of a class to handle all requests for that Action. The singleton strategy places restrictions on what can be done with Struts 1 Actions and requires extra care to develop. Action resources must be thread-safe or synchronized.
Struts 2 Action objects are instantiated for each request, so there are no thread-safety issues. (In practice, servlet containers generate many throw-away objects per request, and one more object does not impose a performance penalty or impact garbage collection.)
Servlet Dependency
Struts 1 Actions have dependencies on the servlet API since the HttpServletRequest and HttpServletResponse is passed to the executemethod when an Action is invoked.
Struts 2 Actions are not coupled to a container. Most often the servlet contexts are represented as simple Maps, allowing Actions to be tested in isolation. Struts 2 Actions can still access the original request and response, if required. However, other architectural elements reduce or eliminate the need to access the HttpServetRequest or HttpServletResponse directly.
Testability
A major hurdle to testing Struts 1 Actions is that theexecute method exposes the Servlet API. A third-party extension, Struts TestCase, offers a set of mock object for Struts 1.
Struts 2 Actions can be tested by instantiating the Action, setting properties, and invoking methods. Dependency Injection support also makes testing simpler.
Harvesting Input
Struts 1 uses an ActionForm object to capture input. Like Actions, all ActionForms must extend a base class. Since  other JavaBeans cannot be used as ActionForms, developers often create redundant classes to capture input. DynaBeans can used as an alternative to creating conventional ActionForm classes, but, here too, developers may be redescribing existing JavaBeans.
Struts 2 uses Action properties as input properties, eliminating the need for a second input object. Input properties may be rich object types which may have their own properties. The Action properties can be accessed from the web page via the taglibs. Struts 2 also supports the ActionForm pattern, as well as POJO form objects and POJO Actions. Rich object types, including business or domain objects, can be used as input/output objects. The ModelDriven feature simplifies taglb references to POJO input objects.
Expression Language
Struts 1 integrates with JSTL, so it uses the JSTL EL. The EL has basic object graph traversal, but relatively weak collection and indexed property support.
Struts 2 can use JSTL, but the framework also supports a more powerful and flexible expression language called "Object Graph Notation Language" (OGNL).
Binding values into views
Struts 1 uses the standard JSP mechanism for binding objects into the page context for access.
Struts 2 uses a "ValueStack" technology so that the taglibs can access values without coupling your view to the object type it is rendering. The ValueStack strategy allows reuse of views across a range of types which may have the same property name but different property types.
Type Conversion
Struts 1 ActionForm properties are usually all Strings. Struts 1 uses Commons-Beanutils for type conversion. Converters are per-class, and not configurable per instance.
Struts 2 uses OGNL for type conversion. The framework includes converters for basic and common object types and primitives.
Validation
Struts 1 supports manual validation via a validatemethod on the ActionForm, or through an extension to the Commons Validator. Classes can have different validation contexts for the same class, but cannot chain to validations on sub-objects.
Struts 2 supports manual validation via the validate method and the XWork Validation framework. The Xwork Validation Framework supports chaining validation into sub-properties using the validations defined for the properties class type and the validation context.
Control Of Action Execution
Struts 1 supports separate Request Processors (lifecycles) for each module, but all the Actions in the module must share the same lifecycle.
Struts 2 supports creating different lifecycles on a per Action basis via Interceptor Stacks. Custom stacks can be created and used with different Actions, as needed.





1. Exception handling. What is Error and Exception?
2. design pattern used in previous project.
3. What is Model in Struts.
4. Traceability matrix
5. 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 Servlet
12. 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 Cursors
22. 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?


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.       Tell me a case where you demonstrated excellent problem solving skills
2.       Tell me a few areas you have gained knowledge in the last six months
3.       How do you learn these skills?
4.        What do you do for technical inspection
5.       Explain how transaction is handled in struts
6.       Difference between actionservlet and request processor?
7.       Explain garbage collection in java?
8.       Do you have to manage memory specifically in java?
9.        How do you manage memory in java?
10.   Difference between extends and implement
11.   How do you create deployable components
12.   What is a join? Types of join?
13.   What is deadlock in db?
14.   What is ORM?
15.   Which UML diagrams have you created? Which project?
16.   Did you create all the diagrams or just a few of them?
17.   Design patterns?
18.   When do you use singleton class? – when we need only one instance
19.   JaxP? I want JaxP with reference to web services – not answered.
20.   What is synchronization in Java
Anuja – general questions:
22.   What are your personal strengths and weakness?
23.   Have you worked with business customers directly
24.   Do you think your business customer was tough or easy going?
25.   Do you have conflicts with your co-workers?


No comments:

Post a Comment