Sunday, February 23, 2014

Top 20 Java technical interview questions and answers for experienced Java developers

Q1. Can you describe the high level architecture of the application that you had worked on recently? or Can you give a 100 feet bird's eye view of the application you were involved in as a developer or designer?

A1. The purpose is to judge your overall experience. Here are a few links that will prepare for this most sought-after question, especially for the experienced professionals.

  • 3 to n-tier enterprise Java architecture, the MVC-2 design pattern, the distinction between physical and logical tiers, and the layered architecture.The logical tiers shown in the diagrams for the above link are basically layers, and the layers are used for organizing your code. Typical layers include Presentation, Business and Data – the same as the traditional 3-tier model. But when  talk about layers, we’re only talking about logical organization of code. Physical tiers however, are only about where the code gets deployed and run as war, ear or jar. Specifically, tiers are places where layers are deployed and where layers run. In other words, tiers are the physical deployment of layers.
  • high level architectural patterns and the pros and cons of each approach. Discusses a number different architectual styles like MVC, SOA, UI Component, RESTful data composition, HTML data composition, Plug-in architecture, and Event Driven Architecture (EDA). Also, covers a sample enterprise architecture, which is a hybrid of a number of architectural styles.
  • Single page web design. A single rich web page loading different sections (e.g tabs) of the page by making different ajax calls to relevant RESTful web services to get the JSON data to render the relevant sections.
  • Understanding of various types of application integration styles. Enterprise applications need to be integrated with other systems, and this post covers different integration styles like sharing the same database, feed based, RPC style (e.g. web services), and exchanging JMS messages.
Q2. How would you go about deciding between SOAP based web service and RESTful web service?
A2. Web services are very popular and widely used to integrate disparate systems. It is imperative to understand the differences, pros, and cons between each approach. Recently, I have been asked these questions very frequently, here is the answer that discusses the pros and cons of SOAP vs. RESTful web services in detail.  

Q3.How will you go about ensuring that you build a more robust application? or How do you improve quality of your application?
A3. This question is very popular with the interviewers because they want to hire candidates who write good quality application. Here are some useful links to prepare for this question.
  • Java interview questions and answers on code quality. Gives a high level over view as to things you can do and tools you can use to improve code quality. A common popular job interview question answered is -- What is the difference between fake objects, mock objects, and stubs?
  • Unit testing with mock objects interview questions and answers. Tutorial that explains how to write JUnit tests with mock objects using the Mockito and Power mock frameworks.
  • Java Interview Questions and Answers - performance testing your Java application. A high level overview as to how you can go about monitoring performance. Many applications face performance issues and this is a very popular question with the interviewers. 
Q4. What are some of the best practices regarding SDLC? Have you worked in an agile development environment? Did you use test driven development and continuous integration?
A4
  • Know the SDLC and the best practices. Gives a high level overview of SDLC.

Q5: Can you write code? How would you go about implementing .....?
A5:  You will be asked to write a small function or a program. The interviewer will be looking for things like
  • How well you analyze the requirements and the solution? Ask relevant questions if the requirements are not clear. Think out loud so that the interviewer knows that how you are approaching the problem.The approach is more important that arriving at the correct solution.
  • List all possible alternatives.
  • Write pseudo code.
  • Write unit tests.
  • Where required, brainstorm with the interviewer.
  • Find ways to improve your initial solution. Talk through thread safety and best practices where applicable.
Here are some links to popular coding questions and answers.
  • Java coding interview questions and answers:. Covers a number of coding questions with answers. These are some of the popular coding interview questions like reversing a string, calculating the Fibonacci number, recursion vs iteration, equals versus ==, etc.
Coding Questions and Answers worth brushing up on, especially before the screening written tests.
  • Printing 1 to 10 in order with 2 separate threads. One thread prints odd numbers and the other thread prints even numbers.
  • How will you flatten a pre-order tree structure in Java using both recursion and iteration?
  • Can you create a Tree class that can work with different types like String, File, Person, etc and supports the following methods
Q. Can you write Java code to compute a collection of numbers supplied to it? The computation could be addition, subtraction, etc. Use recursion to compute the numbers. Here are some requirements to take into considerations.

1. It should be flexible enough to convert from Recursion to iteration if required.
2. Computation will initially be "addition", but should be extendable to multiplication, subtraction, etc.
3. Should handle integers and floating point numbers.
4. Make use of generics.

A. Java coding with recursion and generics

Q. The SimpleDateFormatter and DecimalFormatter are not thread-safe. How will you use them in a thread-safe manner?
A. Using the ThreadLocal class as demonstrated in this tutorial.


Q. If Java did not have its own Map or Set implementation, how will you go about implementing your own?
A. Covered in detail with diagrams and code in "Core Java Career Essentials" book.

No comments:

Post a Comment