Showing posts with label Core Java Faq's. Show all posts
Showing posts with label Core Java Faq's. Show all posts

Thursday 29 August 2013

Top Most Goldman Sachs Java Interview Questions

Interview Questions >> Core Java Interview Questions >> Company wise


Goldman Sachs

Technical round questions
1.       Is it possible to force JVM to run garbage collector?
2.       What are the differences between LinkedList and ArrayList?
3.       What are the differences between HashMap and Hashtable?
4.       What is the difference between List and Map?
5.       Explain Hashing concept.
6.       Write an implementation for equals() and hashCode() method for Employee class. This class has String name and integer age as instance variables.
7.       What is the contract between hashCode() and equals() method?
8.       What is compile time and run time polymorphism? How do we achieve it in Java?
9.       Write a program to swap two integer numbers.
10.   Write a program to find missing element in an array provided elements are randomly stored and they are in some range say, 1 to 10. For example: array was initially having 1 to 10 elements randomly stored. In between we deleted one element. Now we have to find that missing element.
11.   Write a program to find Fibonacci series number indexed at the position entered by user.
12.    What is method overloading and overriding?
13.   Project related discussion
14.   What is Singleton pattern? In which scenario, we go for it? Write how to implement it?
15.   What is class lock and object lock?

Written test questions
16.   True/false questions on Core Java concepts
17.   Objective type questions on Core Java concepts
18.   Object oriented analysis and design based objective type questions
19.   SQL queries objective type questions
Interview Questions:
20.    Tell me about yourself and regarding project.
21.   Difference between interface and abstract class.
22.   Singleton/observer/factory pattern.
23.   Cloning (shallow and deep cloning).
24.   Difference between comparator and comparable.
25.    Difference between servlets and JSP.
26.    Difference between <jsp:include> and include file directive.
27.    Index ( Clustered and non-clustered index).
28.    Employee table is there
1: Display the employee name and corresponding manager name.
2: Display the manager name and number of employees working under him.
29.    Build Queue using 2 stacks.
30.   Questions on Generics and Multi Threading.
31.   Give one example for SingleTon class.
32.    Infinite length Line is there in between one stone is there. 2 Robots are placed at equal distance from stone (one is on left side and other is on right side). You have to write a program in such a way that both the Robots meet at  one point. ( The Same program is loaded into chip and given to Both the Robots).
Writtern Test Questions:
1st part : true or false questions:
33.    void is the return type for default constructor.
34.    Transient and volatile are java modifiers.
35.    Collection is an interface.
36.   Array elemets are set to default value.
37.   We can suggest the JVM to do garbage collection but we can’t force.
38.   Question on instanceof keyword.
39.   Question on this, super keyword.
40.   one question on Set, List.
41.   try{
s.o.p(“in try “);
                return ;
                }catch(){
                s.o.p(“in catch”);
                } finally {
                s.o.p (“in finally”);
}
42.    Find out “V” from “JAVA”.
43.    String s1 = “java”;
String s2 = “Java”;
If(s1.equalsIgnoreCase(s2))
                s.o.p(“equal”);
else
                s.o.p(“not Equal”);
44.    Question on normal forms.
16th June, 2010
45.   Architecture of current project.
46.   Access modifiers in java.
47.   Questions on == and equals
48.   Questions on map, given two objects as Employee e1 = new Employee (“First”, “Last”); Employee e2 = new Employee (“First”, “Last”); what will happen if we try to put these two objects in map and why?
49.   What is spring dependency injection?
50.   How spring dependency injection happens internally?
51.   During the submission of a jsp, what are the tasks performed by the web container and how the request is handled by the action in case of struts.
52.   How can we create the instance of a class through Reflection?
53.   Code snippet of singleton pattern.
54.   Life cycle of servlet.
55.   When the destroy method is called in case of servlet.
56.   Implementation of arraylist. How the size of arraylist grows automatically?
57.   Questions on hashcode and hashcode generation.
58.   Difference between struts 2.0 and Struts 1.x
59.   Questions on JQuery and Dozer mapping (Project specific).
Dated 22 Jun’09

1.       OOPS concepts
2.       Interface vs. Abstract class
3.       Inner Classes
4.       Threads – synchronized blocks
5.       Synchronization – Can one thread enter/ or hold locks to two synchronized methods at the same time? Can two different threads hold locks to two synchronized methods at the same time/concurrently?
Sol:  Answer varies from case to case.  The above question doesn’t have full details.
In general, to answer the above question,  person needs to have good understanding on how Synchronization works in java. Pls go through the below link.


General Points:
# A thread can acquire more than one lock. For example, a thread can enter a synchronized method, thus acquiring a lock, and then immediately invoke a synchronized method on a different object, thus acquiring that lock as well. As the stack unwinds, locks are released again.

# If two threads wants to execute a synchronized method in a class, and both threads are using the same instance of the class to invoke the method then only one thread can execute the method at a time.

# If a class has both synchronized and non-synchronized methods, multiple threads can still access the class's non-synchronized methods. If you have methods that don't access the data you're trying to protect, then you don't need to synchronize them. Synchronization can cause a hit in some cases (or even deadlock if used incorrectly), so you should be careful not to overuse it.
6.       Collection Hierarchy – What are the basic interfaces in Collection, adv and disadv  of each
7.       If we have List<String> and HashSet<String>, in which one the retrieval would be faster and why?
Sol:  one should usually go for the construct with the best O() performance.
HashSet<T> has O(1) and List<T> has O(n) for looking up an element, so that's pretty clear.

In general, If you're sure you'll never have more than a certain number of elements in the set, go with a List. If the number is unbounded, use a HashSet.
However, sometimes cost of computing the hash also a mater.
8.       Hashing Algorithm – Linked List
Sol: Read about how Hash Collision degenerates to Linked list in the following links
9.       Garbage Collection – Mark and Sweep, Ref Counting
10.   Young Generation Old generation
11.   Exception hierarchy. Difference btw Checked and Unchecked, names of exceptions and their types. Catch hierarchy, throws, finally.
12.   Junits – how to design n implement them
13.   Generics – advantages and discussion
14.   Access modifiers – Protected, where would you apply it?
15.   Transient keyword, where would you apply it?
16.   Final Class? What is the Need? Example?
17.    What are Invariants?
18.   Previous project, questions about JSP, where the business logic resides, java beans etc.
19.   Access modifiers in detail
20.   How would you implement equals() for a class Animal with String _type? When I implemented they asked what is wrong with it? They directed me towards use of instanceOf() within equals()
Sol: Implement as per the  equals() contract given in the API document OR read attached Chapter3.pdf
21.   About GC.
22.   Difference between pass by value and pass by reference.
23.   Arrays
24.   To find a minimum in an Array of integers. If you suggest sort they say, without using the sort method. Suggested an algo.
Sol: Simplest solution is Implement linear search algorithm.
25.   What is deadlock? How does it happen? Give a scenario? How to prevent it?
26.   Discussion on synchronization. Will it prevent deadlock?
27.   Given classes Shape, Circle, Square and Rectangle, decide object model, what is wrong with the hierarchy if          Shape
               /      \
       
Rect      Circle
       /
                           Square
                Sol:  make Square subclass of Shape instead of Rect because there are differences w.r.to Rect  and  Sqaure characterstics. 
28.   Write a program such that given an array of interger literals eg. A[] = {3,2,1}
The output should be the complete number 321 (Three Hundred Twenty One). Without using ParseInt().
Sol: use string concatenation or Integer. valueOf(String s)

29.   Relationship between Hashcode and Equals
Sol: read the attached Chapter2.pdf
30.   Hashing Algorithm.
Sol:
http://en.wikipedia.org/wiki/Hash_table
Questions :-

1.       What is exception handling?
2.       What do you understand by final, finally and finalize?
3.       What are the features of Object Oriented Language?
4.       What are abstract classes and how they are different from interfaces?
5.       What is multithreading, with example?
6.       How do you create threads (extending Thread class or implementing Runnable interface), and why?
7.       What are different collections?
8.       What are key differences between HashMap and HashTable?
9.       Why and how HashCode/Equals method should be overridden?
10.   How would you store and fetch objects in a HashMap/HashTable (implementation of Comaparable and Comparator interface)?
11.   Describe Singleton/MVC/Factory Methods design pattern?
12.   How a Singleton can be created (in multithreaded environment also)?
13.   What are joins in SQL (with example)?
14.   Basic Unix commands (e.g. ps, kill, ftp, su).
15.   Case studies for Subqueries?
a.       There are 4 columns in a table and one of them is a telephone number. Write a query to retrieve the name of the employee whose age is less than 25 and does not have a phone number.
b.      You cannot utilize functions such as IS NULL, has to be done logically using a sub query.
16.   What are different types of Statements in JDBC, with usage?
17.   Multithreading with Static variables.
18.   What is Compile time and Runtime Polymorphism?
19.   Basics of Memory Management in JVM.
20.   Can a class be Final?
CABS
21.   What are some of the Implicit objects in a JSP?
22.   What are some of the design patterns that Struts uses?
23.   Which class in struts acts as a front controller?
24.   Are action classes in struts stateful or stateless? What is its implication?
25.   What is the difference between forward and redirect?
26.   Explain different attributes in struts config file? Relationship between form beans and action classes? One to one, one to many?
27.   Design an object model for message formatting and processing module. (Messages have header and footer, can be of different formats, processing depends on the content inside the header, processing may need to be done in multiple steps, again depending on the content)
28.   Design a multithreaded server which can handle messages in Q27 concurrently. (related to a specific project in the work exp)
29.   Explain the lifecycle of a thread.
30.   Explain left outer join. Write a query involving the use of subqueries.
31.   Explain the ACID properties of transactions.
32.   Explain the various isolation levels. (Dirty read, Phantom read, completely serializable). Explain the significance of each.
33.   Are you aware of end points in a transaction?
34.  How will you provide transactional support in a standalone java application? What are the issues to keep in mind? (The application depends on external IO systems). Specific to the project in work exp.

What all data structures you know? Given a Linked List write an algorithm to reverse the list
 What are Equals () and hashcode () methods

Given a string by the user, tell which character occurs max no of times and how many times
Code Snippet
What are Class loaders, what is there hierarchy and why would someone write his own class loader
 Singleton pattern : Code snippet on implementation.
What are Indexes? How they help in improving the performance.
 Types of indexes?
 Difference between Equals method and ==.
 Can we find out how may tables and there columns type in the database using JDBC.
Types of drivers
There is an array of length 1000 which has 1000 integers. All integers are in the sequence like 1,2,3, … about 999 integers and one more which is duplicate of any one existing. Write the algorithm to find that duplicate entry. The array is not in the sorted order
There is a table which has employee name and department name. Find the department which has employees more than 20
Explain the lifecycle of a thread
Explain the ACID properties of transactions
Explain the various isolation levels. (Dirty read, Phantom read, completely serializable). Explain the significance of each
Are you aware of end points in a transaction?
How will you provide transactional support in a standalone java application? What are the issues to keep in mind? (The application depends on external IO systems). Specific to the project in work exp.


LinkWithin

Related Posts Plugin for WordPress, Blogger...

Labels

Core Java programming core java interview question Core Java Faq's Servlets coding database jsp-servlet spring Java linux unix interview questions java investment bank Web Services Interview investment bank mysql Senior java developer interviews best practices java collection tutorial RMI SQL Eclipse FIX protocol tutorial tibco J2EE groovy java questions SCJP grails java 5 tutorial jdbc beginner error and exception Design Patterns Java Programming Tutorials fundamentals general object oriented programming xml Java Programs Hibernate Examples Flex JAMon Java xml tutorial logging Jsp Struts 2.0 Sybase and SQL Server debugging java interviews performance FIX Protocol interview questions JUnit testing WebSphere date and time tutorial experienced java IO tutorial java concurrency thread Ejb Freshers Papers IT Management Java Exapmle Java Script SQL and database tutorial examples Scwcd ant tutorials concurrency example and tutorial future state homework java changes java threading tricky Agile Business of IT Development JSTL Java JSON tutorial Java multithreading Tutorials PM Scrum data structure and algorithm java puzzles java tips testing tips windows 8 5 way to create Singleton Object Architect Interview Questions and Answers Architecture Architecure Bluetooth server as swing application that searches bluetooth device in 10 meter circle and show all devices. You can send file to any bluetooth device. C Programming CIO Callable Statement in Java Circular dependency of Objects in Java Comparable Example in Collection Custom annotation in Java Developer Interview Divide and rule example in java Drupal Example of Singleton Pattern FIX protocol ForkJoin Example in Java 7 Get data from dynamic table with Java Script Git HTML and JavaScript Health Hello World TCP Client Server Networking Program Hibernate Basics Hibernate Interview Question Answer J2EE Interview Question And Answers J2ME GUI Program JEE Interview QA JMS interview question Java J2EE Hibernate Spring Struts Interview Question Java System Property Java Threads Manager Portlets Provident Fund Read data from any file in same location and give the required result. Reading Properties File in Java Redpoint Rest WebService Client Rest Webservice Test SAL join with ven diagram SCP UNIX COMMAND SSL Singleton Pattern in Java Spring Bean Initialization methods and their order Spring Interview Questions Struts Struts 2.0 Basics Struts 2.0 Design Pattern Submit Html Form With Java Script On The Fly Unix executable For Java Program XOM DOM SAX XP books computers core java; core java; object oriented programming data structure; java investment bank; design pattern dtd duplicate rows in table get browser name with jquery grails podcast inner class java beginners tutorial java cache java networking tutorial java spring java util; java collections; java questions java.java1.5 linked list mailto function with all browser oracle database oracle duplicate rows orm schema social spring mvc questions struts transaction tricks tweet windows xslt