Skip to content

Instantly share code, notes, and snippets.

@somahargitai
Last active September 10, 2018 23:56
Show Gist options
  • Save somahargitai/908e01764156bb7e9fbbd15a6b210da2 to your computer and use it in GitHub Desktop.
Save somahargitai/908e01764156bb7e9fbbd15a6b210da2 to your computer and use it in GitHub Desktop.
IT interview questions

What you should not do?

  • If the candidate has no clue about a main theoritical answer, don't expect to invent it in that moment. There are typical programming exercises which can be learnt or can be figured out in that very moment. But it is a ridiculous expectation that the candidate will figure out big programming concepts during an interview.

arrays given:

  • 12345
  • 53214
  • 15342

Write a function which checks if the array is

  • sorted
  • can be made sorted with interchanging two elements
  • none of above

Java....

Java technology branches

  • Core Java
  • Web - Spring MVC, Struts, JSF, etc.
  • ORM - Hibernate, JPA, EclipseLink, etc.
  • Database - Oracle, MySQL, etc.
  • Microservices - Spring Boot, DropWizard, etc.
  • Server - WebSpeher, WebLogic, Tomcat, etc.

https://www.quora.com/How-do-I-get-a-Java-Java-EE-developer-job-when-technical-requirements-are-changing-so-fast

Language questions

  • What is the difference between Interface vs Abstract class?
  • What is the difference between Overloading and Overriding?
  • Which runs in Runtime and which in Compile time?
  • When do we use the static keyword? Can we use it on a function? On a field? Can we instantiate a static class? Does a static class have a constructor?
  • When do we use the abstract classes and interfaces? Can we use them on a function? On a field? Can we instantiate an abstract class? Does an abstract class have a constructor? Can we implement functionality in an interface? How many parent classes/interfaces may a class have? How do we implement an inheritation?
  • What is an annotation?
  • Which kinds of Collections do you know?
  • What is a List and what is an Arraylist? How is Arraylist implemented?
  • Tell another List implementation
  • What is the difference between ArrayList and LinkedList?
  • Which is faster?
  • How do we place a new element to its 3rd place in LinkedList / ArrayList?
  • How do we delete an element from its 3rd place in LinkedList / ArrayList?
  • Is int and object type? Is string an object type?
  • When would we use a set? How do we list its elements?
  • How does a map checks if it already has that key?
  • What is an iterator?
  • What is the difference between equals() and == ?
  • What can we tell about two Hashcodes of the objects they represent are true for Equals()?
  • What can we tell about the result of Equals() of two objects if their Hashcodes are different?
  • What can we tell about the result of Equals() of two objects if their Hashcodes are equal?
  • How and when do we use Hashcode and Equals?
  • How does HashMap work?
  • How do we inherit a class from a superclass? How do we connect a class with an interface?, How wo we inherit an interface from an interface? Which keywords do we use in these cases?
  • Is override a keyword? How do we use it? Does subclass function override superclass function? What if superclass functions is static?
  • What do we use final keyword for?
  • Can we reach a function in a subclass which is defined as final/static/private/final static in superclass?
  • Can we override a function in a subclass which is defined as final/static/private/final static in superclass?
  • May an abstract class can have non-abstract methods?
  • How do we exit from a for loop in a for loop?
  • Is multiple class inheritance allowed in Java? What is the diamond problem?
  • What are the new functionalities in the last Java version?
  • What is Marker interface?
  • What is Serialization?
  • How Serialization is implemented in Java?
  • What's the difference between passing by reference and passing by value?
  • What is a checked and an unchecked exception in Java?
  • What is an Error, how it is different than a Exception?
  • How do we implement Threads in Java?
  • Which problems occur about Threads and how do we solve them?
  • What is a Stream?

Diamond problem - multiple inheritance

For loop in a for loop - We can use use double break, we can use return, we can name the loop and break that loop. Goto is forbidden, break is a bad practice, use return if it is possible

ArrayList - contains an array. Every size increase is applied with creating a new, bigger copy of the array. Class has a strategy to increase the size more than actually necessary (it increases its Array size by 50%), so further element adds won't all need new arrays.
List, Set - interfaces, not classes

Hashcode and Equals
They are for comparing objects, Object superclass has them. For a comparison we use hashcode comparison first. If it results false, objects are not equal. If it results true, we call equals() to decide if objects are equal are not. Two different objects may have the same hashcode but different hashcodes cannot be made from equals objects.

passing by value vs passing by reference https://stackoverflow.com/questions/373419/whats-the-difference-between-passing-by-reference-vs-passing-by-value

override is used to mark overriding a function. If it does not override a function, compiler will warn you.

Java version differencces https://www.quora.com/What-is-the-main-difference-between-JAVA-SE-7-and-JAVA-SE-8

Marker https://stackoverflow.com/questions/25850328/marker-interfaces-in-java

HashMap https://www.geeksforgeeks.org/internal-working-of-hashmap-java/

Stream https://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/

Abstract vs interface https://stackoverflow.com/questions/18777989/how-should-i-have-explained-the-difference-between-an-interface-and-an-abstract#

Java testing questions

  • What do you use for Java unit testing?
  • How do you unit test a function if it calls a service?
  • How do we stub and mock?

https://spring.io/blog/2007/01/15/unit-testing-with-stubs-and-mocks

https://www.edureka.co/blog/interview-questions/java-interview-questions/

Java environment questions

  • How do we take care of the memory of deleted objects?
  • What is JVM?
  • What is the difference between Java SE and EE?
  • is there

JVMs - Zing as an alternative
https://www.azul.com/products/zing/

Association vs Aggregation vs Composition
https://beginnersbook.com/2013/05/association/

  • What is Node.js? Where can you use it?
  • Why use Node.js?
  • How do you update NPM to a new version in Node.js?
  • Why is Node.js Single-threaded?
  • Explain callback in Node.js
  • What is callback hell in Node.js?
  • Explain the role of REPL in Node.js.

Answers

  • Node def: Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser, based on Google’s V8 JavaScript engine (virtual machine).
  • Why? :
  • non-blocking
  • async
  • concurrency
  • scalability
  • update npm: $ sudo npm install npm -g
  • Why is Node.js Single-threaded? : Node.js is single-threaded for async processing. By doing async processing on a single-thread under typical web loads, more performance and scalability can be achieved as opposed to the typical thread-based implementation.
  • Explain callback in Node.js. : A callback function is called at the completion of a given task. This allows other code to be run in the meantime and prevents any blocking.
    Being an asynchronous platform, Node.js heavily relies on callback. All APIs of Node are written to support callbacks.
  • Callback hell in Node.js - overnesting
  • Explain the role of REPL in Node.js. : READ EVAL PRINT LOOP
    As the name suggests, REPL (Read Eval print Loop) performs the tasks of – Read, Evaluate, Print and Loop. The REPL in Node.js is used to execute ad-hoc Javascript statements. The REPL shell allows entry to javascript directly into a shell prompt and evaluates the results. For the purpose of testing, debugging, or experimenting, REPL is very critical.

https://medium.com/@vigowebs/frequently-asked-node-js-interview-questions-and-answers-b74fa1f20678

https://www.techbeamers.com/top-30-node-js-interview-questions-answers/

https://www.tutorialspoint.com/nodejs/nodejs_interview_questions.htm

https://dev.to/aershov24/7-hardest-nodejs-interview-questions--answers-3lje

https://career.guru99.com/top-25-interview-questions-on-node-js/

https://www.simplilearn.com/node-js-interview-questions-and-answers-article

  • Say 2 design patterns
  • What does Singleton do?
  • Will Singleton behave the same way in a multi-threaded situation?
  • What is dependency injection?
  • Which design principle does it implement?
  • When do we use dependency injection (in general and in the chosen language)?

dependency injection: we use it for testing, also typical in Java Spring

https://sourcemaking.com/design_patterns

  • What kinds of testing do you know?

  • What is a Mock?

  • What is a Spy?

  • What is a Stub?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment