
Introduction
This post will have most important interview questions which used to ask in most of the reputed companies like Google, Amazon, NetApp, Wells Fargo, Wipro, Infosys, TCS, SAP etc.
We are just adding Questions to this post and the technical reader will post the answers using comments sections.
We will provide all questions with a proper explanation later in the separate post and will link to this post.
Hope reader will enjoy the post and helps us to get the proper answers.
Please follow below section for the list of questions –
- ClassNotFoundException when thrown and is this runtime or compile time.
- Overriding and overloading
- What is Polymorphism?
- Difference between array list and a hash map.
- Static variable.
- How do you implement thread. write the code for the two ways.
- What would happen when you write Thread.run();
- Write down the JDBC code for any one of the statements.
- In JDBC Class.forname() how many time this statement executes in a program.They were trying to confuse me on this.
- How does DriverManager.getConnection works.
- Write exception hierarchy.
- What is left outer join and left join.Is both same or there is any difference.Write a query to join two table.
- Select * from TableA,TableB .what will be the output.Cartesian join.
- About Project
- Design pattern used in my project (Command Pattern)
- Code snippet of Command pattern
- Different ways of implementing thread. Why these different ways in Java spec?
- Directly calling run() method. What could be the significance
- How throws clause impacts in Function overriding?
- What collection frameworks I used in Project?
- Why do we need to override hashcode & equals method?
- Code snippet for above.
- Exceptional handlings, why try-catch , why not throw? Why throws?
- How can an object be checked at Runtime?
- Difference between instanceOf keyword & isInstance? Why both?
- Code snippet for Singleton
- Thread safe for singleton
- Joins – Just a ques do u know that?
- Tab1(EID,Ename,MgrId) with a record where mgr_id is null & few records where mgr_id is not present in eid .
- Ques is : Find the employees who have got managers
- Write code to override equals(), hascode().
- Write code to implement Comparable,Comparator for a given class e.g. Person
- Write code to create thread using Runnable
- What will happen if Thread.run() will be called
- How does DriverManager works? He asked me after initially telling me to write some JDBC code.
- Write code to implement a HashSet.
- Given a table with EmpId,EmpName and MgrId.Write a SQL query to give emp name and corresponding
- manager name.
- James Bond puzzle.
- Write code to implement Singleton pattern
- Write some code using Generics.
- Given a table with columns Number, SquareRoot. Write a query to return number, square root and square without usingany mathematical operator and functions.
- Give a Datamodel to implement a DentalNursingHome.
- Explain Serialization. Suppose i have a Connection object. I want to close this connection before serializing and then reopen it while deserializing.How will i do it?
- Consider following are two tables.
EMP Dept
Ecode ename mgrcode deptid deptnm mgrcode
The mgrcode from dept table is the dept manager(not emp manager as in emp table)
Now if we want to know dept details for an employe what changes it require to the table definitions.
One option is to add deptid in emp table. Another is add ecode to dept table. Which is better and why
- How to implement Generics in Java 1.4
- Singleton class implementation without creating the instance at class load time and without using the synchronized method. So if synchronized block is used then will it be a full proof singleton? If not what is the reason.
- If an abstract class doesn’t have any abstract method and only have implemented methods will it throw any error.
- How to implement a cache of Objects?
- Suppose we want write a cache class which will cache Employee objects. So we want that employee objects to be such that only the cache class can instantiate it and other classes can not. Though other classes should be able to use the Person class.
- Algorithm to traverse through B-Tree & Java code for the same.
- == & .equals difference. Why?
- Producer – Consumer Problem in Java
- Asked about previous project. Lots of questions based on previous project.
- What are various implicit objects in jsp.
- Include one jsp in another jsp. Will the page attributes be available in included jsp?
- What is the difference between page and request scope?
- How will you maintain session with the user?
- Can you change the request object when u are forwarding the request?
- There is a table with CategoryID, Category_details. There is another table with ProductID, CategoryID, Product_details. Display the number of products category wise. Also show the categories which do not have any products in them. Sort according to Category_ID.
- Program: There are numbers in a list 1-500. In this list, one number is occurring twice. Find that number.
- Simple questions on synchronization, synchronized collections.
- Can there be a try block without catch block?
- Question on order of catch block based on wider/narrower exception.