Tuesday, February 17, 2015

Morgan Stanley Java Interview Questions

  1. What are type of indexes in Sybase Database ? What is difference between these different types ?
  2. What is a stored procedure. How will you performance tune a query in sybase database ?  
  3. What is difference between Left Outer Join and Right Outer Join ?
  4. How will you find nth highest salary of an employee from Salary table ?
  5. What is database normalization ?
  6. How will you express ManyTomany relationship in database ? Give any practical usecase for ManyToMany relationship.
  7. How does Lazy loading works in Hibernate ? How will load a lazily loaded item in hibernate to avoid LazyLoadingException ?
  8. How will you handle concurrent updates to a shared row in database ? Let's say bank account table, where two or more requests are coming in parallel ?
Java (Core, Design Patterns, Concurrency, Algorithms and Data Structure)
  1. What is polymorphism ? When does a method override in Java ?
  2. What are Immutable Objects ? What are their advantages ? Design an Immutable Class that has a java.util.Date member ? (consider that Date itself is mutable)
  3. What all Design Patterns you are aware of ? What is Singleton Design Pattern ? How will you make Singleton Thread-safe ?
  4. Given a String find the first non-repeatable character in the String. Example: str="zzzzzbbbccccddehhhhiii"; Answer is : e
    Solution -
    click here
  5. What is time complexity of HashMap insertion and retrieval in Java ?
  6. Discuss internals of a Hashmap's get and put method. What is role of hashcode and equals method in get and put operation ?
  7. Data (volume, price etc.) for various stocks in coming up in the Exchange, how will you design a thread-safe class that maintains the total volume traded in the exchange at any given point in time ? It should be very high throughput design.
  8. How to sort data that can't fit into main memory ?
  9. How to sort 1 million numbers (all positive integers), considering that only 0.1 million numbers can be accommodated into main memory ?
  10. How Garbage Collection Works in Java ? Name few garbage collection algorithms ?
  11. What is use of StringBuilder class ?
  12.  What is difference between sleep() and wait() ?
  13. How will you reverse a singly linked list in Java ?
  14. How will you create an artificial OutOfMemory Error in java ?
  15. What is difference between Synchronized Map and ConcurrentHashMap ?
  16. Explain the proper use of hashcode() and equals() method.
  17. What is Queue ? How will you implement a Queue using a ArrayList ?
  18. There is a file containing large numbers, you need to print numbers and their corresponding count in the file for 2 scenarios - 1) No memory constraints 2) limited memory available and not the entire data can fit into main memory.
  19. Given a dictionary, find all the words that are anagram to each other ?
  20. Remove duplicate numbers from a sorted Array ?
  21. How will you increment each element of a huge array using all the available cpu cores  of machine ?
    Solution - Click here
Unix and Operating Systems 
  1. How to find and kill a process in Unix ?
  2. How will you figure out free available space in Unix ?
  3. How will you find files recursively that contains specific words in their filename ?
  4. How will you find files recursively that contains specific words in their contents ?
  5. How to sort a file using unix command ?
  6. How to count number of lines in a file in unix terminal ?
  7. What is piping of commands in unix ? any example ?
  8. How will you list nth column of a flat file in Unix ?
  9. How will you find a process using specific port in Unix and Windows ?
  10. How password less authentication works in Unix ?
  11. How will you copy a file from one Unix host to another Unix host ?
Aptitude & Puzzles
  1.  You are given 2 eggs. You have access to a 100-storey building. Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are identical. You need to figure out the highest floor of a 100-storey building an egg can be dropped without breaking. Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process.

No comments:

Post a Comment

Your comment will be published after review from moderator