Share My interview questions with java
I am a Software Developer, and my primary programming language was Java. I also quite often interviewed people and also sometimes was an interviewee. Here, I share typical questions at a job interview for a Java Developer position. I hope it can still be useful for your interview preparation.
1. Java Core
- What access modifiers do you know in Java?
- What is the contract between
equals()andhashCode()? - Rules to implement the
equalsmethod (stability, transitivity, reflectivity etc)? - Why do we need nested classes?
- What is immutability? Why is it good?
- How to make a class immutable?
- Besides
Stringdo you know any other immutable classes from JDK? - Can a interface inherit from another interface?
- What is the difference between regular vs. static initialization blocks?
Exceptions
|
- Collection API. Can you list general collection API? (e.g.
Collection,Set,Map,List,Queue,SortedSet,SortedMap, etc) - Can you say how these interfaces are related?
- Does
Mapextend theCollectioninterface? - What is the difference between
ArrayListandLinkedList? - What is the difference between
StackandQueue? TreeSetvsLinkedHashSet- How
HashMapis implemented? How collisions are resolved there? - How to implement
hashCodeto achieve the best performance? - What is the difference between
HashtableandConcurrentHashMap? - Do you know how
ConcurrentHashMapis implemented? How is it different from usualHashMaporHashtable? - Special implementations. Why do we need
EnumSet,EnumMap? What aboutWeakHaskMaporIdentityHashMap? - What is
ConcurentModificationException? How can we get it? How to avoid getting it? - Collections with safe iterators (
CopyOnWriteArrayList/CopyOnWriteArraySet)
- What is a parameterized or generic type?
- Can we use parameterized types in exception handling?
- What is a wildcard parameterized type?
- What is autoboxing and what are its advantages/pitfalls?
- Can we add something to
List<?>?
- How to make multithreaded code?
- What’s the difference between extending
Threadvs implementingRunnable? - What is the difference between
Thread’s methodsrun()andstart()? - Synchronization of java blocks and methods
- How to use
waitandnotify? - What is the difference between
Thread.sleepandwait? - What is an atomic operation? Is
i++atomic? - What does the
volatilekeyword mean? - Have you used
java.util.concurrent.*? What have you used from there? - Why do we need
ThreadLocal? - What is a deadlock? Can you give an example? How to cause it?
- What is a livelock?
- What is starvation?
- What is the race condition?
- Atomicity of long and double assignment operations
- Lock-free operations. How to create lock-free implementation of field reassignment?
- How to interrupt a thread?
- Can you describe the standard Java IO API?
- What is the difference between
InputStreamandReader?OutputStreamandWriter? - How does
BufferedReaderwork? - What is NIO?
- What is
Channel? What isBuffer? - How to lock a file?
- What is NIO2?
- Memory model in JVM
- How does virtual space divided in Java? What is permgen? Is it still there in Java 8?
- What difference between float and BigDecimal? How they store the data?
- What is deep copy of a Java object?
- What are the disadvantages of setting heap size too high?
- What are utilities for JVM monitoring? What is Jconsole?
- How to force GC be executed?
- Garbage collection principles
- What is a memory leak? How and why it can be caused?
- What is variable shadowing?
- How would you monitor JVM?
- How would you monitor how GC behaves during program execution?
- Name few GC implementations (Serial, Parallel, ParallelOld, ConcarentMarkAndSweep, G1) and describe major differences
- What is unit testing?
- Libraries that help to writing unit tests
- Why do we need JUnit?
- What is a mock? Have you used EasyMock or Mockito?
2. Algorithms & Data structures
- Which data structures do you know? Tell me about one of them
- What is recursion? tail recursion, mutual recursion?
- Complexity of algorithms, big O notation
- Which sorting algorithms do you know?
- How to sort a linked list?
- Linear-time sorting (count sort)?
- Trees, graphs and ways to traverse graph
- What is a binary tree?
- How to search in binary tree?
- Self balanced trees (Red-black tree, AVL, Splay)
- Tries, prefix and suffix trees
- What is NP-completeness? What algorithms are NP-Complete?
- What is the divide and conquer approach?
- Tell me about Dynamic programming
- What is MapReduce?
3. Warm-up
- What programming languages do you know and use?
- What is your most hated technology or tool and why?
- Which technology do you consider yourself expert in?
- What was the biggest challenge you encountered? How did you deal with it?
- Tell me about your biggest professional achievement
- What was the last book you’ve read? What was the most important point you remembered from the book?
4. Database Questions
- Did you need to process XML? How and why?
- What is XPath? Have you used it?
- Experience with XSLT
- SAX vs DOM
- DTD vs XMLSchema
- What is the difference between HTML and XML?
- What is well formed HTML?
- What is XML namespace? Why is it useful?
- What characters are disallowed from XML without escaping?
Database Engines
|
- Aggregate functions with examples
- Given a schema, write some SQL query with group by / outer join / etc.
- What is a nested subquery?
5. Libraries
- What is Inversion of Control? Benefits?
- What is Spring configuration file? How does it look like?
- Out of the box bean scopes (singleton, prototype; request, session, global session)
- Types of autowiring.
- What modules does Spring Framework have?
- Describe AOP integration in Spring
6. Software Design
- What design patterns are in JDK? Can you give some examples? What about Java IO API?
- Which patterns do you use on a daily basis? Explain their principles.
- What is Façade/Proxy/Decorator/Strategy/Observer/etc? (selectively)
- Inheritance vs Composition. Which is better? Why?
- What is Coupling and Cohesion?
- What is SOLID? Do you know what each letter stands for?
- What is Single Responsibility Principle? Interface segregation principle? Dependency inversion principle?
- Can you tell me about the DRY principle?
- What is the Law of Demeter?
- What is Feature Envy?
- Do you know about CQRS (Command Query Responsibility Segregation)?
- Principle of Least Astonishment/Surprise
Share your own interview experience with us.You can write about the interview process, interview questions asked, how many rounds of interviews you have gone through, what you did well, where you could have improved or anything which you would like to share. So, If you like interviewquiz.net and would like to contribute, you can write an article and mail to ntp.interview@gmail.com. See your article appearing on interviewquiz.net.You can share any programming language, any topic, tips etc. As long as its helps people to learn and prepare well for their interviews.
No comments:
Post a Comment