Java / JavaScript Developer interview questions

Last 2 months I spend looking for a job.

My job position expectations were:

  • Java Developer
  • JavaScript Developer
  • Full Stack Developer
  • Team Lead Developer

During my search I visited some companies and had some interviews.

I would like to share with you my experience and the freshest interview questions that companies ask developers like me TODAY.

Feel free to put your interview questions in the comments below!

So here is the list…

Senior Java interview questions

  • why java is the fastest platform in the world? what makes it so fast?
  • database denormalization techniques
  • sharding, picking a shard key, hash-based or territorial key, UUID as key generator
  • why split java memory into 3 parts (eden, survival and old gen)? what is the benefit, why not using only 1 part
  • why primitives in java? there are autoboxing alternatives, what is the benefit of primitives?
  • how to write durable, fault-tolerant server on java? which protocol to use? reasons to use / not to use RMI?
  • what is the benefit of using column databases? give an example where column database like HBase or ClickHouse by Yandex would be a good fit
  • is there any graph database currently available for production usage? what graph database is good for?
  • how you may “touch” or look at actual object (in bytes) located in the heap using java? is there a way to store your memory outside heap?
  • if you would be asked to create event-based system like an airport dispatcher, what criteria would you use to pick a good framework / solution? what would be the most important / focused thing in your architecture?
  • why some developers say that pull-based event systems are better than push-based? what is your opinion?
  • why RISC consumes more RAM but is faster than CISC?
  • what are the bean scopes in Spring you know?
  • how to create thread-safe singleton in Java if you would need one? (best answer is inner class)
  • what data structure better suits to find 5 first max / min elements in 1_000_000_000 elements? (initially unsorted)
  • complete sequence: 3 12 27 ? 75 (48)
  • complete sequence: 1 2 6 ? 1806 (42)
  • deep analysis of ArrayList vs LinkedList comparison (including CPU cache behavior)

JavaScript (Web) questions

  • explain how display: flex works, how width is calculated?
  • what is event-delegation, what problem it solves?
  • what DOM-optimisation techniques you know, what are the most important ones?
  • how to organize CSS classes in a project, what do you think is the best way to write CSS rules?
  • do you know what are web workers / how to create a background process in javascript?

System design questions

  1. Think of URL-shortener service arhitecture: how would you shorten URL’s? where will you store URL associations? how much time would you hold bindings? how would you treat same same URL’s / hashes?
  2. Tell about stratagies to test code. What unit / integration tests are good for? How would you test code in a startup project where everything may change very quickly?
  3. What is fail fast / fail safe systems? Cons and pros of each. Example of fail-fast in java. Which one do you prefer?

Test tasks

Many companies asked to do a test task before the interview or sometimes after the F2F talk. Here are some of the test tasks I was asked to do

  1. Write a reusable utility that will provide synchronization mechanism similar to low-level DB locking. It will be used by entity repository components like dao or repository. Utility should prevent contradicting changes on same entities to overlap, for example thread should not be able to UPDATE  Item1 when Item1 is already updating by other thread. It should be possible to GET during update – in this case the previous (not-updated) version of Item1 should be returned (like using CopyOnWriteList approach).
  2. Write a RESTful API for some Entity (not naming the real name and it doesn’t matter).  You should implement POST /entity, PUT /entity, GET /entity and DELETE /entity. Also there are some number of validation rules for POST and PUT. Please provide your task in a form of github repository and please describe steps on how to install and run your app.
    (if you dont know how to write cool and nice RESTful API – check out my tutorial part 1 and others!)
  3. Given a websocket stocks trading server write a trading bot that will listen to price updates on this server and will buy and sell products based on some lower and upper price limit; the bot should be as profficial as possible
  4. Write a smart contract on Etherium platform for real estate safe purchase. Consider all cases for both sides – physical client and property provider.
  5. Create a javascript module that will add tooltip to any element on HTML page. Tooltip should have a fixed width / scaling height (depending on content). Tooltip is centered by element it’s attached to and is always on top. Tooltip should be attached as HTML attribute like data-tooltip="My tooltip"
    The complexity / challange of this task was to create a separate module that will work anywhere, independent on element position or whether it’s already in DOM or added later.

Business awareness

Some companies were very interested in my awareness of the buisness that they are doing. If was important to read about the industry and competitors. I was asked to tell about latest news in the industry, about the main problems and ideas to meed them.

Funny questions

Some of the questions were really funny 🙂

What is the integer code of space symbol in ASCII ? (32)

Do you believe in Future? (as a code organization pattern)


Thanks for reading this, hope I gave you some insight on what’s going on in java/js interviews today!

Leave a Reply

Your email address will not be published.