├── README.md
└── UNLICENSE
/README.md:
--------------------------------------------------------------------------------
1 | # Full-stack Developer Interview Questions and Answers
2 |
3 | ## Table of Contents
4 |
5 | * [Architecture](#architecture)
6 | * [Concurrency](#concurrency)
7 | * [Java](#java)
8 | * [General Questions](#general)
9 | * [WEB](#web)
10 | * [SQL](#sql)
11 | * [NoSQL](#nosql)
12 | * [Transactions](#transcations)
13 | * [Scalability](#scalability)
14 | * [Load balancing](#load-balancing)
15 | * [Cloud computing](#cloud-computing)
16 | * [Distributed](#distributed)
17 | * [Cache](#cache)
18 | * [Networking](#networking)
19 | * [Operating system](#os)
20 | * [Compilers](#compilers)
21 | * [C++](#cpp)
22 | * [Javascript](#javascript)
23 | * [Python](#python)
24 | * [Go](#go)
25 | * [Code writing](#codewriting)
26 | * [Functional programming](#functional-programming)
27 | * [Reactive programming](#reactive-programming)
28 | * [Git](#git)
29 | * [DevOps](#devOps)
30 | * [QA](#qa)
31 | * [Agile, Scrum, XP](#agile)
32 | * [Algorithms](#algorithms)
33 | * [UML](#uml)
34 | * [Other](#other)
35 | * [Machine learning](#machine-learning)
36 | * [Big Data](#big-data)
37 | * [Image processing](#image-processing)
38 | * [Cryptography](#cryptography)
39 | * [Security](#security)
40 | * [Android](#android)
41 | * [Books](#books)
42 |
43 | #### [[⬆]](#toc) Architecture:
44 | * *Design principles*. ([*DRY*](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), [*KISS*](https://en.wikipedia.org/wiki/KISS_principle), [*YAGNI*](https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it), [*Occam's razor*](https://en.wikipedia.org/wiki/Occam%27s_razor), [*Worse is better*](https://en.wikipedia.org/wiki/Worse_is_better), [*convention over configuration*](https://en.wikipedia.org/wiki/Convention_over_configuration), [*separation of concerns*](https://en.wikipedia.org/wiki/Separation_of_concerns), [*Law of Demeter (principle of least knowledge)*](https://en.wikipedia.org/wiki/Law_of_Demeter), boy scout rule, [*single source of truth*](https://en.wikipedia.org/wiki/Single_source_of_truth), [*single version of truth*](https://en.wikipedia.org/wiki/Single_version_of_the_truth), [*principle of least astonishment*](https://en.wikipedia.org/wiki/Principle_of_least_astonishment), [*let it crash principle*](https://en.wikipedia.org/wiki/Crash-only_software), [*inversion of control*](https://en.wikipedia.org/wiki/Inversion_of_control))
45 | * [*SOLID*](https://en.wikipedia.org/wiki/SOLID_(object-oriented_design))
46 |
47 | |Rule|Description|
48 | |:--|:--|
49 | |[**S**ingle responsibility principle](https://en.wikipedia.org/wiki/Single_responsibility_principle)|A module should be responsible to one, and only one, actor.|
50 | |[**O**pen/closed principle](https://en.wikipedia.org/wiki/Open/closed_principle)|A software artifact should be open for extension but closed for modification.|
51 | |[**L**iskov substitution principle](https://en.wikipedia.org/wiki/Liskov_substitution_principle)|It should be possible to substitute base class with derived class.|
52 | |[**I**nterface segregation principle](https://en.wikipedia.org/wiki/Interface_segregation_principle)|Many client-specific interfaces are better than one general-purpose interface.|
53 | |[**D**ependency inversion principle](https://en.wikipedia.org/wiki/Dependency_inversion_principle)|Depend upon Abstractions but not on concretions. This means that each module should be separated from other using an abstract layer which binds them together. Source code dependency points in the opposite direction compared to the flow of control.|
54 |
55 | * [*The Clean Architecture*](https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html)
56 | * [*Clean Code Cheat Sheet*](https://www.planetgeek.ch/wp-content/uploads/2014/11/Clean-Code-V2.4.pdf)
57 | * [*One key abstraction*](http://wiki3.cosc.canterbury.ac.nz/index.php/One_key_abstraction)
58 | * [*Aspect-oriented programming*](https://en.wikipedia.org/wiki/Aspect-oriented_programming)
59 | * [*The Twelve-Factor App*](http://12factor.net)
60 | * [*Domain-driven design*](https://en.wikipedia.org/wiki/Domain-driven_design)
61 | * [*Microservices*](https://en.wikipedia.org/wiki/Microservices) are a style of software architecture that involves delivering systems as a set of very small, granular, independent collaborating services.
62 | * Pros of *microservices* (The services are easy to replace, Services can be implemented using different programming languages, databases, hardware and software environment, depending on what fits best)
63 | * *Design patterns*.
64 | * **Creational**: [*Builder*](https://refactoring.guru/design-patterns/builder), [*Object Pool*](https://en.wikipedia.org/wiki/Object_pool_pattern), [*Factory Method*](https://refactoring.guru/design-patterns/factory-method), [*Singleton*](https://refactoring.guru/design-patterns/singleton), [*Multiton*](https://en.wikipedia.org/wiki/Multiton_pattern), [*Prototype*](https://refactoring.guru/design-patterns/prototype), [*Abstract Factory*](https://refactoring.guru/design-patterns/abstract-factory)
65 | * **Structural**: [*Adapter*](https://refactoring.guru/design-patterns/adapter), [*Bridge*](https://refactoring.guru/design-patterns/bridge), [*Composite*](https://refactoring.guru/design-patterns/composite), [*Decorator*](https://refactoring.guru/design-patterns/decorator), [*Facade*](https://refactoring.guru/design-patterns/facade), [*Flyweight*](https://refactoring.guru/design-patterns/flyweight), [*Proxy*](https://refactoring.guru/design-patterns/proxy)
66 | * **Behavioral**: [*Chain of Responsibility*](https://refactoring.guru/design-patterns/chain-of-responsibility), [*Command*](https://refactoring.guru/design-patterns/command), [*Interpreter*](https://en.wikipedia.org/wiki/Interpreter_pattern), [*Iterator*](https://refactoring.guru/design-patterns/iterator), [*Mediator*](https://refactoring.guru/design-patterns/mediator), [*Memento*](https://refactoring.guru/design-patterns/memento), [*Observer*](https://refactoring.guru/design-patterns/observer), [*State*](https://refactoring.guru/design-patterns/state), [*Strategy*](https://refactoring.guru/design-patterns/strategy), [*Template Method*](https://refactoring.guru/design-patterns/template-method), [*Visitor*](https://refactoring.guru/design-patterns/visitor)
67 | * [*Enterprise integration patterns*](https://en.wikipedia.org/wiki/Enterprise_Integration_Patterns), [*SOA patterns*](www.soapatterns.org).
68 | * [*3-tier architecture*](https://en.wikipedia.org/wiki/Multitier_architecture) (Presentation tier, Application tier, Data tier)
69 | * *3-layer architecture* (DAO (Repository), Business (Service) layer, Controller)
70 | * [*REST*](https://en.wikipedia.org/wiki/Representational_state_transfer) (Representational state transfer), [*RPC*](https://en.wikipedia.org/wiki/Remote_procedure_call)
71 | * [*Idempotent operation*](https://en.wikipedia.org/wiki/Idempotence) (The PUT and DELETE methods are referred to as idempotent, meaning that the operation will produce the same result no matter how many times it is repeated)
72 | * *Nullipotent operation* (GET method is a safe method (or nullipotent), meaning that calling it produces no side-effects)
73 | * [*Naked objects*](https://en.wikipedia.org/wiki/Naked_objects), [*Restful objects*](https://en.wikipedia.org/wiki/Restful_Objects).
74 | * Why do you need *web server* (tomcat, jetty)?
75 | * [*Inheritance*](https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)) vs [*Composition*](https://en.wikipedia.org/wiki/Object_composition) (Inheritance - is-a relationship, whether clients will want to use the subclass type as a superclass type. Composition - has-a or part-of relationship).
76 | * [*Multiple inheritance (diamond) problem*](https://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem)
77 | * Advantages of using *modules*. (reuse, decoupling, namespace)
78 | * Drawbacks of not using [*separation of concerns*](https://en.wikipedia.org/wiki/Separation_of_concerns)
79 | * Adding new features will take an order of magnitude longer
80 | * Impossible to optimize
81 | * Extremely difficult to test
82 | * Fixing and debugging can be a nightmare (fixing something in one place can lead to something else breaking that seems completely unrelated).
83 | * What is [*uniform access principle*](https://en.wikipedia.org/wiki/Uniform_access_principle)? (client code should not be affected by a decision to implement an attribute as a field or method)
84 | * [Conway's law](https://en.wikipedia.org/wiki/Conway%27s_law) (organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations)
85 | * [GRASP](https://en.wikipedia.org/wiki/GRASP_(object-oriented_design))
86 |
87 | #### [[⬆]](#toc) Concurrency:
88 | * What is [*deadlock*](https://en.wikipedia.org/wiki/Deadlock), [*livelock*](https://en.wikipedia.org/wiki/Deadlock#Livelock)? (Deadlock is a situation in which two or more competing actions are each waiting for the other to finish, and thus neither ever does. A livelock is similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, none progressing.)
89 | * [*Deadlock Prevention*](https://www.geeksforgeeks.org/deadlock-prevention). (prevention, detection, avoidance (Mutex hierarchy), and recovery)
90 | * [*Deadlock Avoidance*](https://www.scaler.com/topics/operating-system/deadlock-avoidance-in-os/). (Deadlock is a situation that occurs in Operating System when any Process enters a waiting state because another waiting process is holding the demanded resource.)
91 | * What is [*starvation*](https://en.wikipedia.org/wiki/Starvation_(computer_science))? (a problem encountered in concurrent computing where a process is perpetually denied necessary resources to process its work)
92 | * What is [*race condition*](https://en.wikipedia.org/wiki/Race_condition)? (Behavior of software system where the output is dependent on the sequence or timing of other uncontrollable events)
93 | * What is [*happens-before*](https://en.wikipedia.org/wiki/Happened-before) relation?
94 | * What is [*thread contention*](https://stackoverflow.com/questions/1970345/what-is-thread-contention)? (Contention is simply when two threads try to access either the same resource or related resources in such a way that at least one of the contending threads runs more slowly than it would if the other thread(s) were not running). Contention occurs when multiple threads try to acquire a lock at the same time
95 | * What is a [*thread-safe*](https://en.wikipedia.org/wiki/Thread_safety) function? (Can be safely invoked by multiple threads at the same time)
96 | * [*Publish/Subscribe*](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) pattern
97 | * What is [*2-phase locking*](https://en.wikipedia.org/wiki/Two-phase_locking)? (Growing phase, shrinking phase. Guarantees serializablity for transactions, doesn't prevent deadlock).
98 | * What is the difference between *thread* and *process*? (Threads (of the same process) run in a shared memory space, while processes run in separate memory spaces)
99 | * What is [*false sharing*](https://en.wikipedia.org/wiki/False_sharing), [*cache pollution*](https://en.wikipedia.org/wiki/Cache_pollution), *cache miss*, [*thread affinity*](https://en.wikipedia.org/wiki/Processor_affinity), [*ABA-problem*](https://en.wikipedia.org/wiki/ABA_problem), [*speculative execution*](https://en.wikipedia.org/wiki/Speculative_execution)?
100 | * What is a
101 | * [*obstruction-free*](https://en.wikipedia.org/wiki/Non-blocking_algorithm#Obstruction-freedom) - if all other threads are paused, then any given thread will complete its operation in a bounded number of steps
102 | * [*lock-free*](https://en.wikipedia.org/wiki/Non-blocking_algorithm#Lock-freedom) - if multiple threads are operating on a data structure, then after a bounded number of steps one of them will complete its operation
103 | * [*wait-free*](https://en.wikipedia.org/wiki/Non-blocking_algorithm#Wait-freedom) - every thread operating on a data structure will complete its operation in a bounded number of steps, even if other threads are also operating on the data structure
104 |
105 | algorithm?
106 | * What is [*sequential consistency*](https://en.wikipedia.org/wiki/Sequential_consistency)? (The result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each individual processor appear in this sequence in the order specified by its program).
107 | * What is a [*memory barrier*](https://en.wikipedia.org/wiki/Memory_barrier)? (A memory barrier, also known as a membar, memory fence or fence instruction, is a type of barrier instruction that causes a CPU or compiler to enforce an ordering constraint on memory operations issued before and after the barrier instruction)
108 | * Synchonization aids in Java
109 | * CountDownLatch
110 | * CyclicBarrier
111 | * Phaser
112 | * ReentrantLock
113 | * Exchanger
114 | * Semaphore
115 | * LinkedTransferQueue
116 | * What is *data race*? (When a program contains two conflicting accesses that are not ordered by a [happens-before](https://docs.oracle.com/javase/specs/jls/se12/html/jls-17.html#jls-17.4.5) relationship, it is said to contain a data race. Two accesses to (reads of or writes to) the same variable are said to be conflicting if at least one of the accesses is a write. But see [this](https://stackoverflow.com/questions/16615140/is-volatile-read-happens-before-volatile-write/16615355#16615355))
117 | * Java [*memory model*](https://docs.oracle.com/javase/specs/jls/se12/html/jls-17.html#jls-17.4)
118 | * A program is correctly synchronized if and only if all sequentially consistent executions are free of data races
119 | * Correctly synchronized programs have sequentially consistent semantics. If a program is correctly synchronized, then all executions of the program will appear to be sequentially consistent
120 | * Causality requirement for incorrectly synchronized programs: [link](https://pdfs.semanticscholar.org/c132/11697f5c803221533a07bd6db839fa60b7b8.pdf)
121 | * What is *monitor* in Java? (Each object in Java is associated with a monitor, which a thread can lock or unlock)
122 | * What is *safe publication*?
123 | * What is *wait*/*notify*?
124 | * [*Amdahl's law*](https://en.wikipedia.org/wiki/Amdahl%27s_law)? (Speedup = 1 / (1 - p + p / n))
125 | * [*Dining philosophers problem*](https://en.wikipedia.org/wiki/Dining_philosophers_problem) (Resource hierarchy (first take lower-indexed fork), arbitrator, communication (dirty/clean forks)).
126 | * [*Produces/consumer*](https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem) problem.
127 | * [*Readers/writers*](https://en.wikipedia.org/wiki/Readers%E2%80%93writers_problem) problem.
128 | * [*Transactional memory*](https://en.wikipedia.org/wiki/Software_transactional_memory)
129 | * [*Coroutine*](https://en.wikipedia.org/wiki/Coroutine)
130 |
131 | #### [[⬆]](#toc) Java:
132 | * [*PhantomReference*](https://en.wikipedia.org/wiki/Phantom_reference), [*WeakReference*](https://en.wikipedia.org/wiki/Weak_reference), [*SoftReference*](https://en.wikipedia.org/wiki/Soft_reference), *finalize()*, *ReferenceQueue*.
133 | * How to correctly stop a thread? (Thread.interrupt())
134 | * What is *Spring*? (Spring Framework is an application container for Java that supplies many useful features, such as Inversion of Control, Dependency Injection, abstract data access, transaction management, and more)
135 | * Spring is a framework for dependency injection: a design pattern that allows the developer to build very decoupled systems by injecting dependencies into classes.
136 | * It elegantly wraps Java libraries and makes then much easier to use in your application.
137 | * Included in the framework are implementations of commonly used patterns such as REST and MVC web framework which are predominately use by in web applications.
138 | * What is *Spring-Boot*?
139 | * What is *Hibernate* and JPA (Caches, lazy-loading)?
140 | * *Garbage collection*. (G1, Young/Old generation collectors combination examples: PS Scavenge/PS MarkSweep, Copy/MarkSweepCompact)
141 | * How to write *benchmarks*? ([jmh](http://openjdk.java.net/projects/code-tools/jmh/))
142 | * What are Java 9 modularity?
143 | * What is OSGI? (Specification describes a modular system and a service platform for the Java programming language that implements a complete and dynamic component model. Each bundle has its own classpath. Dependency hell avoidance. META-INF/MANIFEST.MF contains OSGI-info)
144 | * Serializable / Externalizable
145 | * What is a *servlet* (versions of servlet api, Servlet 4.0)?
146 | * What is a *servlet filter*? How to implement *GZipFilter*? (ResponseWrapper)
147 | * What is *generics* and PECS (producer extends and consumer super)?
148 | * What is the difference between >, \