Monday, February 23, 2015

Sapient Global Market Java Interview Questions

  1. How do we synchronize a static method to prevent data corruption in concurrent update ?
  2. How will you introduce multi-tasking in your java application ?
  3. Design a program to search files inside a directory using multi-threadig?
  4. How will you implement a LRU timed cache in Java ?
  5. There is a folder containing multiple SQL files. Each file's name contain a sequence number which determines the execution order of that particular SQL script file. Design an API that will take such folder and execute the SQL in correct order.
  6. Difference between wait() and sleep() method ?
  7. What is a deadlock situation ? How will you handle deadlock in development and production environment ?
  8. What is mechanism for inter-thread communication ?
  9. Would adding multi-threading to sorting algorithm improve its performance ?
  10. In what practical scenario's multi-threading actually improves the performance of Java application ?
  11. Do we need to synchronize getter and setter both to prevent concurrency related issues on a collection ?
  12. Explain the key classes in java.util.concurrent package ?
  13. What is purpose of ConcurrentHashMap ?
  14. What is purpose of a Future ? How will you use it ?
  15. How will you create your own custom Thread Pool ?
  16. What is a BlockingQueue ?
  17. There is three file contains flight data. File data has in csv format.
    1)Write a standalone program to search flight detail from all files depend on criteria
    2)Criteria would be departure location,arrival location, flight date.
    3)Program should follow\Oops principle. And right unit test case also.
    4)Result should be in Ascending or descending order.
    5)Data separated with pipe | .

    File A has data like below:
    FLIGHT_NUM|DEP_LOC|ARR_LOC|VALID_TILL|FLIGHT_TIME|FLIGHT_DURN|FARE
    AF299|FRA|LHR|20-11-2010|0600|4.10|480
    AF118|DUB|MUC|21-12-2010|1410|5.40|580
    AF371|AMS|MAD|30-11-2010|1210|3.45|320

    File B has data like below:
    FLIGHT_NUM|DEP_LOC|ARR_LOC_VALID_TILL|FLIGHT_TIME|FLIGHT_DURN|FARE
    BA123|DEL|AMS|12-10-2010|0050|8.00|950
    BA412|BOS|CDG|31-12-2010|0210|7.50|800
    BA413|BOS|AMS|30-11-2010|1530|7.00|750

    File C has data like below:
    FLIGHT_NUM|DEP_LOC|ARR_LOC_VALID_TILL|FLIGHT_TIME|FLIGHT_DURN|FARE
    LH348|DEL|AMS|30-11-2010|2325|11.00|1050
    LH201|LHR|MEL|21-11-2010|0230|15.30|1400
    LH342|VIE|JFK|20-10-2010|1130|14.20|980
Most of these questions has been answered in my eBook "Cracking the Core Java Interview"


No comments:

Post a Comment

Your comment will be published after review from moderator