Most of these questions has been answered in my eBook "Cracking the Core Java Interview" updated on June 2018, that you can buy from this link:
Top 50 Java Interview Questions for Freshers
Upasana | May 05, 2019 | 3 min read | 153 views
Core OOP Concepts
-
Is Java pure Object Oriented Programming Language?
-
What is difference between String, StringBuilder and StringBuffer?
-
Is it possible for a Java method to inline swap two int or integer values? Discuss pass-by-reference vs pass-by-value?
-
What is difference between 32bit and 64bit JDK? Does size of primitive type changes between these two variants?
-
How Garbage Collection Works? What are different Space partitions inside JVM (PermGen, Eden Space, etc)
-
If a method throws NullPointer exception in super class, can subclass method override it to throw RuntimeException?
Answer: Solution discussed here
Collections Framework
-
What is the criteria for a class to be eligible for key in Hashmap ?
-
What are benefits of making a class Immutable? How will you make a class Immutable?
-
What is difference between ArrayList and Vector? Which one shall be preferred?
-
Write code to remove entries from hashmap while iterating over it?
-
What is difference between fail-safe and fail-fast iterators? Give example of each in Java Collections framework?
-
What is the difference between the size and capacity of a Vector? Answer : The size is the number of elements actually stored in the vector, while capacity is the maximum number of elements it can store at a given instance of time.
Concurrency & multi-threading
-
What is difference between Callable and Runnable interface?
Answer: Callable and Runnable
-
Explain visibility and atomicity problems faced in multi-threaded environment?
-
What is use of Volatile variables in Java ? Explain working of volatile with respect to register cache & main heap memory?
-
Can volatile keyword be used to make a non-atomic operation as atomic?
-
What is difference between wait() and sleep() method in Java?
-
How will you implement a thread-safe singleton in Java?
-
Which one of the following would be easy to write? thread-safe code for for 10 threads or 2 threads?
-
How do you call wait() method? using if block or loop? Why? Provide a example for your explanation.
-
How do you take thread dump in Java on Windows and Unix machine?
-
What is a thread local variable in Java? Give an example where you will you a ThreadLocal variable?
-
What is an immutable object? How and why do you create an Immutable object in Java?
Database
-
How will you join two Tables A and B where data in Table B is optional, i.e. even if no matching record exists in Table B, rows of Table A shall appear in the query result? Answer : Hint is Left Outer Join between A and B
-
How will you find nth highest salary from Employee Table using SQL?
-
What is difference between Cluster and non-cluster index in RDBMS?
-
How is ManyToMany relationship implemented in database? Give a practical example of ManyToMany relationship?
-
What is difference between inner join and outer join?
-
When will you choose a RDBMS over NoSql and vice versa?
Unix OS
-
How will you create a service in unix (ubuntu/centos) that automatically starts at reboot.
-
How will you kill a process in linux?
-
How to continuously check last 200 lines of a log file?
-
How to find remaining disk space in linux server?
-
How to make any script file executable?
-
How to schedule a repeating job in UNIX using crontab?
-
What is piping of commands in Unix? Any example?
Top articles in this category:
- Top 50 Spring Interview Questions
- Multi-threading Java Interview Questions for Investment Bank
- Sapient Global Market Java Interview Questions and Coding Exercise
- BlackRock Java Interview Questions
- Citibank Java developer interview questions
- UBS Java Interview Questions
- Morgan Stanley Java Interview Questions