This is a sample from my recent round of Java interviews:
I've found these resources helpful:
- String questions: Check if one string is a rotation of other string, check if a string is a palindrome, check if a string is a substring of other string, return the index of the first occurence of a substring in other string, reverse a string, Difference between StringBuilder, StringBuffer and String
- LinkedList questions: Reverse a linked list recursively(in-place) and iteratively, delete a node from linked list, find the nth node, find the nth node from the end, test if a linked list has a cycle, write test cases
- What is immutable, Implement an immutable class (e.g. myDateTime)
- What are volatile, synchronized, atomic
- What are some ways to implement a singleton in Java
- Implement a counting semaphore
- JVM/GC questions
- Checked vs unchecked exceptions, finalize
- What is a queue, stack, heap
- Level-order BFS on a binary tree
- What happens in the system during a recursive call
- Remove an item from an array of ints, print the second largest number in an array, remove a character from a string
- Write a method receiving a stream of integers, caching the last 10 min of data and returning a number if it's less than the current input
- Mutexes, ReadWriteLock, ConcurrentHashMap, ArrayBlockingQueue, Thread pools, LinkedList vs ArrayList, Object Pooling, Read-Modify-Write, java.util.concurrent, java.util.concurrent.atom
ic, CAS, Collections, ADT, Java 5 Generics - HashMap vs HashTable vs ConcurrentHashMap
- Synchronous vs asynchronous, thread contention, race conditions/deadlocks and how to prevent/debug them, thread confinement, cache coherence, false sharing, cache lines
- How would you write a socket client/server in Java
- Java IO/NIO, socket multiplexing, blocking vs non-blocking, select/epoll
- Sleep vs wait
- Process vs thread, Java threads vs Pthreads, Linux threads vs Solaris threads, what happens when a process/thread is started/terminated, what happens during context switch
- Java Memory Model, Weak references
- Jini, JMS, Javaspaces, JGroups, Hibernate trivia
- Abstract Class vs Interface
- Memoization, give an example
- Can you have a protected method in Interface
- How to force a stop-of-the-world GC
- What can be done to interrupt a synchronized method that is blocked
- Java performance, heap profiling, GC tuning, thread dumps, Hotspot vs JRockit
- How would you implement low latency data structures
- How would you debug performance issues, what do you do if a database query is "slow", describe the troubleshooting approach when a customer complains that the UI is "slow"
- Knight Tour puzzle- write a method for a knight to find another figure (a fool) on a chessboard
- Clock puzzles - find the angle between hr,min,sec handles, etc
- 3 jars puzzle (one jar is filled with 8 gallons, two jars are empty (capacity 5, 3), write a routine to get to 4-4 state
- Inner join vs outer join
- What are ACID properties in a database
- What is caching; How would you implement a caching server for a streaming video service (messaging/queues, data structures, expiration/eviction), how would you benchmark the performance of your broadcasting/caching server/service, how do you scale it to thousands of customers, what is CDN
- How would you design a high throughput order management system, matching engine, market data engine, FIX engine (trading)
- How would you design a data collection service (i.e. downloading/streaming data from multiple sources from the web), distributed data feeds/CRUD data store design,indexing, performance/scalability/a
vailability considerations - What is the fastest way to do a grep on 10GB plain text file on a laptop
- Describe the projects you're most proud of, the most difficult problems you've solved as an engineer, what is your favorite programming language
I've found these resources helpful:
- Java Tutorials: http://download.oracle.co
m/javas... - Effective Java: http://www.amazon.com/Eff
ective-... - The Java Programming Language: http://www.amazon.com/Jav
a-Progr...
- Java Concurrency in Practice: http://www.amazon.com/Jav
a-Concu...
- The Art of Multiprocessor Programming: http://www.amazon.com/Art
-Multip... - Data structures in Java: http://www.amazon.com/Sch
aums-Ou...
- Design Patterns: http://www.amazon.com/Des
ign-Pat...
- Stringology: http://en.wikipedia.org/w
iki/Str... - StackOverflow: http://stackoverflow.com/
questio...
- Brainbench Java tests
No comments:
Post a Comment