This repository contains a list of Back-End interview topics that I had to review, or want to deepen.
Feel free to contribute, it would be highly appreciated!
- Programming Languages
- Frameworks
- Object Oriented Programming
- Microservices
- Domain Driven Design
- Design Patterns
- Security
- Databases
- Networking
- Infrastructure
- Deployment
- Git
- Testing
- Data Structures and Algorithms
-
What are the programming paradigms supported by JavaScript?
-
What is the difference between classical inheritance and prototypal inheritance?
-
What is asynchronous programming, and why is it important in JavaScript?
-
What is callback hell and how can it be avoided? What is the point of Promises?
-
What is the difference between between global scope, and local scope (function scope, and block scope)?
-
What is hoisting, and IIFE?
-
What is closures? How to emulate encapsulating using it?
-
What are the different patterns of function invocation in JavaScript? And what is the value of
this
in each one them? -
What is the different between
.__proto__
and.prototype
? -
How to change the context of functions using
.call()
,.apply()
, or.bind()
? -
What do
Object.assign()
andObject.create()
do? -
What do
Promise.race()
andPromise.all()
do? -
What happens when we call a function with the
new
keyword? -
What is the output of this code:
for (var i = 0; i < 3; i++) { setTimeout(function() { console.log(i); }, 1000 + i); }
What will be printed on the console if we change
var i
withlet i
? -
Consider the following code:
(function() { var a = b = 5; })(); console.log(b);
What will be printed on the console? If the strict mode was enabled by using the
'use strict';
, what will be the output? -
Define a
repeatify
function on the String object. The function accepts an integer that specifies how many times the string has to be repeated. The function returns the string repeated the number of times specified. For example:console.log('hello'.repeatify(3));
It should print
hellohellohello
. -
What is the result of the following code snippets?
var fullname = 'John Doe'; var obj = { fullname: 'Colin Ihrig', prop: { fullname: 'Aurelio De Rosa', getFullname: function() { return this.fullname; } } }; console.log(obj.prop.getFullname()); var test = obj.prop.getFullname; console.log(test());
const obj1 = { value: 'hi', print: function() { console.log(this); }, }; const obj2 = { value: 17 }; obj1.print.call(obj2); new obj1.print();
Resources
- 5 Typical JavaScript Interview Exercises
- JavaScript: Object Prototypes
- Tricky JavaScript Interview Questions
- Floating Point Math
[⬆] return to TOC
-
Is everything that’s asynchronous in Node.js handled by the
libuv
's Worker Pool? -
What are the phases of the Event Loop?
-
What do you know about Worker Threads module in Node.js?
-
What is the difference between
process.nextTick()
,setTimeout()
,setInterval()
, andsetImmediate()
? -
What are the Timers functions of Node.js?
-
What can be done if a Timeout or Immediate object needs to be cancelled?
-
What will printed by running the following code:
const fs = require('fs'); fs.readFile(__filename, () => { setTimeout(() => { console.log('timeout'); }, 0); setImmediate(() => { console.log('immediate'); }); process.nextTick(() => { console.log('nextTick'); }); });
-
Explain what is Reactor Pattern in Node.js?
-
Rewrite the code sample without try/catch block:
async function check(req, res) { try { const a = await someOtherFunction(); const b = await somethingElseFunction(); res.send("result") } catch (error) { res.send(error.stack); } }
-
What is Globals in Node.js? (explain global, process, and buffer)
-
What is the use of Underscore (
_
) in Node.js? -
What are Error First Callbacks in Node.js?
-
How to gracefully shutdown/kill Node.js process? (explain
process.kill()
) -
What is the difference between
readFile()
vscreateReadStream()
? -
What is the
EventEmitter
in Node.js? -
How many types of Streams are present in Node.js?
-
How to solve Process out of Memory Exception in Node.js?
-
What is the use of DNS module in Node.js?
-
What's wrong with the following code snippet? (explain timing attacks)
function checkApiKey (apiKeyFromDb, apiKeyReceived) { if (apiKeyFromDb === apiKeyReceived) { return true } return false }
-
How does Node.js support multi-processor platforms, and does it fully utilize all processor resources? (explain Cluster module)
-
Consider the following code snippet:
{ console.time("loop"); for (var i = 0; i < 1000000; i += 1){ // Do nothing } console.timeEnd("loop"); }
Resources
- 7 Hardest Node.js Interview Questions
- Top 20 Interview Questions on Node.js
- Frequently asked: Node JS Interview Questions and Answers
- 8 Essential Node.js Interview Questions
- Node.js Interview Questions and Answers
- Express and Node JS Interview Questions
[⬆] return to TOC
- What are the pros and cons of functional programming vs object-oriented programming?
- What are the four pillars of OOP? (A brief description for each one)
- What is dynamic or run time polymorphism?
- What is static/early binding and dynamic/late binding?
- When is classical inheritance an appropriate choice?
- When is prototypal inheritance an appropriate choice?
- What does “favor object composition over class inheritance” mean? When should we choose inheritance over composition?
- When it is more appropriate to use a structure (struct) instead of a class?
- What are abstract classes? What are the distinct characteristics of an abstract class?
- How is method overriding different from method overloading?
- What is the difference between cohesion and coupling?
- Why should we strive for "high cohesion, and low coupling" in designing a system?
- Explain the concept of destructor/deinitializer?
- What is LSP (Liskov Substitution Principle) and what are some examples of its use?
- What is the difference between association, aggregation and composition?
Resources
- Object Oriented Programming - The Four Pillars of OOP
- SOLID Principles: Do You Really Understand Them?
- SOLID: The First 5 Principles of Object Oriented Design
- Association, aggregation, and composition in OOPs
- Difference Between Cohesion and Coupling
- Prototypal inheritance
[⬆] return to TOC
- What is the Microservices architecture? And what are its pros and cons?
- What are the differences between Monolithic, SOA and Microservices?
- What is the API Gateway pattern?
- What are the decomposition patterns used in Microservices? (briefly describe decomposition by business capability, decomposition by subdomain, and self-contained services)
- What are the deployment strategies used in Microservices?
- What are the challenges faced while working with Microservices?
- What is the Distributed Transaction pattern?
- What is the Bounded Context pattern?
- What do you understand by Contract Testing?
- What is End to End Testing in Microservices?
- What are Reactive Extensions in Microservices?
[⬆] return to TOC
- What is Domain Driven Design (DDD)?
- What is Ubiquitous Language (UL) and what is its uses in DDD?
[⬆] return to TOC
- What are the three types of design patterns? (describe briefly creational, structural, and behavioral patterns)
- What is the Strategy pattern? How to use it to simplify the selection of algorithms/implementations at runtime?
interface PaymentStrategy {
processPayment(): void;
}
class CreditCardPayment implements PaymentStrategy {
public processPayment(): void {
console.log("Processing credit card payment...");
}
}
class PayPalPayment implements PaymentStrategy {
public processPayment(): void {
console.log("Processing PayPal payment...");
}
}
class PaymentProcessor {
private strategy: PaymentStrategy;
public setPaymentStrategy(strategy: PaymentStrategy): void {
this.strategy = strategy;
}
public process(): void {
this.strategy.processPayment();
}
}
// Usage
const processor = new PaymentProcessor();
processor.setPaymentStrategy(new CreditCardPayment());
processor.process(); // Output: Processing credit card payment...
processor.setPaymentStrategy(new PayPalPayment());
processor.process(); // Output: Processing PayPal payment...
- What is the Singleton pattern? When should we use it?
class ConfigurationManager {
private static instance: ConfigurationManager;
private constructor() {
// private constructor to prevent instantiation
}
public static getInstance(): ConfigurationManager {
if (!ConfigurationManager.instance) {
ConfigurationManager.instance = new ConfigurationManager();
}
return ConfigurationManager.instance;
}
public loadSettings(): void {
// load settings
}
}
// Usage
const config = ConfigurationManager.getInstance();
config.loadSettings();
- What is the Decorator pattern? How to use it to extend objects dynamically while avoiding classes explosion?
interface Coffee {
cost(): number;
}
class ClassicCoffee implements Coffee {
cost(): number {
return 5.0;
}
}
abstract class CoffeeDecorator implements Coffee {
protected decoratedCoffee: Coffee;
constructor(coffee: Coffee) {
this.decoratedCoffee = coffee;
}
cost(): number {
return this.decoratedCoffee.cost();
}
}
class MilkDecorator extends CoffeeDecorator {
constructor(coffee: Coffee) {
super(coffee);
}
cost(): number {
return super.cost() + 1.5;
}
}
class SugarDecorator extends CoffeeDecorator {
constructor(coffee: Coffee) {
super(coffee);
}
cost(): number {
return super.cost() + 0.5;
}
}
// Usage
let coffee: Coffee = new ClassicCoffee();
let milkCoffee = new MilkDecorator(coffee);
let sugarCoffee = new SugarDecorator(coffee);
console.log("Milk coffee cost: " + milkCoffee.cost()); // Output: Cost: 6.5
console.log("Sugar coffee cost: " + sugarCoffee.cost()); // Output: Cost: 5.5
- What is the Observer pattern? When should we use it in event-driven programming?
interface IPublisher {
registerSubscriber(s: ISubscriber): void;
removeSubscriber(s: ISubscriber): void;
notifySubscribers(): void;
}
interface ISubscriber {
update(temperature: number, humidity: number, pressure: number): void;
}
class WeatherData implements IPublisher {
private subscribers: ISubscriber[] = [];
private temperature: number;
private humidity: number;
private pressure: number;
public registerSubscriber(s: ISubscriber): void {
this.subscribers.push(s);
}
public removeSubscriber(s: ISubscriber): void {
this.subscribers = this.subscribers.filter(subscriber => subscriber !== s);
}
public notifySubscribers(): void {
for (const subscriber of this.subscribers) {
subscriber.update(this.temperature, this.humidity, this.pressure);
}
}
public setMeasurements(temperature: number, humidity: number, pressure: number): void {
this.temperature = temperature;
this.humidity = humidity;
this.pressure = pressure;
this.notifySubscribers();
}
}
class CurrentConditionsDisplay implements ISubscriber {
public update(temperature: number, humidity: number, pressure: number): void {
console.log(`Current conditions: ${temperature}F degrees and ${humidity}% humidity`);
}
}
// Usage
const weatherData = new WeatherData();
const currentDisplay = new CurrentConditionsDisplay();
weatherData.registerSubscriber(currentDisplay);
weatherData.setMeasurements(80, 65, 30.4); // Output: Current conditions: 80.0F degrees and 65.0% humidity
- What is the Facade pattern? How to use it to simplify and hide the implementation complexity of sub-systems?
class DVDPlayer {
on(): void {
console.log("DVD Player on");
}
play(): void {
console.log("DVD Player playing");
}
}
class Projector {
on(): void {
console.log("Projector on");
}
wideScreenMode(): void {
console.log("Projector in widescreen mode");
}
}
class SoundSystem {
on(): void {
console.log("Sound System on");
}
setVolume(level: number): void {
console.log("Sound System volume set to " + level);
}
}
class HomeTheaterFacade {
private dvdPlayer: DVDPlayer;
private projector: Projector;
private soundSystem: SoundSystem;
constructor(dvd: DVDPlayer, proj: Projector, sound: SoundSystem) {
this.dvdPlayer = dvd;
this.projector = proj;
this.soundSystem = sound;
}
watchMovie(): void {
this.dvdPlayer.on();
this.dvdPlayer.play();
this.projector.on();
this.projector.wideScreenMode();
this.soundSystem.on();
this.soundSystem.setVolume(10);
console.log("Movie started!");
}
}
// Usage
const dvd = new DVDPlayer();
const proj = new Projector();
const sound = new SoundSystem();
const homeTheater = new HomeTheaterFacade(dvd, proj, sound);
homeTheater.watchMovie(); // Output: various system on and playing messages followed by "Movie started!"
Resources
- 5 Design Patterns That Are ACTUALLY Used By Developers
- Singleton Pattern
- Decorator Pattern
- Facade Pattern
- Observer Pattern
[⬆] return to TOC
- What is JSON Web Token? And when to use it?
- What is the JSON Web Token structure? And How does it work?
- What is OAuth 2.0? What are its roles?
- What are the five grants for acquiring an access token in OAuth 2.0?
[⬆] return to TOC
-
Suppose we have two tables
tbl1
andtbl2
; Each of these tables contains one column on which join condition has been defined. The tabletbl1
contains the columncol1
and the tabletbl2
contains the columncol2
.- What will the outcome of the following inner join query?
- Join columns having unique values.
- Join columns having duplicate values.
- One Join table contains Null value.
- Both tables containing Null values.
SELECT a.col1, b.col2 FROM tbl1 a INNER JOIN tbl2 b ON a.col1 = b.col2
- What will the outcome of the following left outer join query?
- Join columns having unique values.
- Join columns having duplicate values.
- One Join table contains Null value.
- Both tables containing Null values.
SELECT a.col1, b.col2 FROM tbl1 a LEFT OUTER JOIN tbl2 b ON a.col1 = b.col2
- What will the outcome of the following right outer join query?
- Join columns having unique values.
- Join columns having duplicate values.
- One Join table contains Null value.
- Both tables containing Null values.
SELECT a.col1, b.col2 FROM tbl1 a RIGHT OUTER JOIN tbl2 b ON a.col1 = b.col2
- What will the outcome of the following full outer join query?
- Join columns having unique values.
- Join columns having duplicate values.
- One Join table contains Null value.
- Both tables containing Null values.
SELECT a.col1, b.col2 FROM tbl1 a FULL OUTER JOIN tbl2 b ON a.col1 = b.col2
- What will the outcome of the following inner join query?
-
Consider the following
staffs
table:id first_name last_name manager_id 1 Genna Jakson NULL 2 Adam Ahmed 1 3 Kali Boyer 2 4 Layla David 2 5 Ali Mohamed 3 The
staffs
table stores the staff information such asid
,first_name
, andlast_name
. It also has a column namedmanager_id
that specifies the direct manager.Use self join and recursive common table expression (CTE) to get who reports to whom?
-
Describe and give an example of the cross join?
[⬆] return to TOC
[⬆] return to TOC
[⬆] return to TOC
[⬆] return to TOC
- What does the term network topology refer to? What are the different types of network topology? What are the pros and cons of each one?
- Star Topology
- Bus Topology
- Ring Topology
- Tree Topology
- Mesh Topology
- Hybrid Topology
- What are the layers of the OSI model? (A brief description for each layer)
- Physical Layer
- Data Link Layer
- Network Layer
- Transport Layer
- Session Layer
- Presentation Layer
- Application Layer
- What are the layers of the TCP/IP model? (A brief description for each layer)
- Physical Layer
- Data Link Layer
- Internet Layer
- Transport Layer
- Application Layer
- What are the differences between IPv4 and IPv6?
- What are the differences between TCP and UDP?
- What are DNS, DHCP, and NAT?
- What is the difference between DNAT (Destination Network Address Translation) and SNAT (Source Network Address Translation) ?
- What is a virtual private cloud (VPC)?
- How does tracert or traceroute tool work?
- How do content delivery networks (CDNs) work?
- What are the differences between reverse proxies and forward proxies?
- How does failover work for Application Load Balancer?
- What does the term AAA mean in network security?
- What is DoS/DDoS attack? How can protect servers from it?
- What is a TLS handshake?
- How does HTTPS work?
- What is the difference between HTTP/1.1 and HTTP/2?
- How does HTTP/2 Server Push work?
- The age-old question: What happens when you type google.com into your browser and press enter?
- What is the SPDY protocol?
- What is the QUIC protocol and how does it work?
- What is the difference between Polling, SSE, and WebSocket?
Resources
- What Is Network Topology?
- TCP/IP vs OSI Model: What's the Difference?
- IPv4 vs IPv6: What’s the Difference?
- TCP vs UDP: What's the Difference?
- SNAT vs DNAT
- What is a virtual private cloud (VPC)?
- How content delivery networks (CDNs) work
- What is Reverse Proxy Server
- AAA
- What is a DDoS Attack?
- What happens when you type google.com into your browser and press enter?
- How does failover work for Application Load Balancer?
- What is a TLS handshake?
- What is HTTPS?
- How does SSL/TLS work?
- SSL Handshake explained
- HTTP/1.1 vs HTTP/2: What's the Difference?
- HTTP/2 vs. HTTP/1.1: How do they affect web performance?
- A Comprehensive Guide To HTTP/2 Server Push
- What is SPDY?
- SPDY: An experimental protocol for a faster web
- What is a QUIC flood DDoS attack?
- Polling vs SSE vs WebSocket — How to choose the right one
- Long Polling vs WebSockets vs Server-Sent Events
[⬆] return to TOC
- What is Docker? What is the difference between Docker and VM (Virtual Machine)?
- What is the advantage of Docker over Hypervisors? (briefly describe What is the main difference between the approaches of Docker and standard hypervisor virtualization?)
- What is Docker Image and Container?
- How do Docker containers make use of kernel cgroups and namespaces?
- What is the default Docker network driver, and how can we change it when running a Docker image?
- What are the four different restart policies in Docker?
- What is Docker Compose? What can it be used for?
- What is Docker Hub and what is the other type of Docker Image Registry?
- What are the possible ways of using insecure Docker image registries?
- What is Docker Swarm? What can it be used for?
- What is Dockerfile? What can it be used for?
- Is there any data loss when the Docker container exits?
- Why
docker-compose down
may take10
seconds to recreate or stop? (briefly describeSIGTERM
andSIGKILL
) - What is the difference between
docker-compose up
,docker-compose run
, anddocker-compose start
? - What is the difference between
COPY
andADD
in a Dockerfile? - What is the difference between Docker
ADD
command andVOLUME
flag? - What is the difference between the
docker run
and thedocker create
? - What are the various states that a Docker container can be in at any given point in time?
- What is the preferred way of removing containers -
docker rm -f
ordocker stop
then followed by adocker rm
? - What does the volume parameter
-v
do in adocker run
command? - What is the use of the
docker save
anddocker load
commands? - Is there any problem with just using the
latest
tag in a container orchestration environment? What is considered best practice for image tagging?
Resources
- What is Docker?
- How is Docker different from a virtual machine?
- What is Container?
- Network containers
- Use bridge networks
- Use overlay networks
- What is the difference between bridge network and overlay network?
- Start containers automatically
- Overview of Docker Compose
- Swarm mode overview
- Swarm mode key concepts
- Best practices for writing Dockerfiles
- Do I lose my data when the container exits?
- Why do docker compose services take 10 seconds to recreate or stop?
- Trapping signals in Docker containers
- Docker ADD vs VOLUME
- What are the possible states for a docker container?
- Lifecycle of Docker Container
- Recommendations for tagging and versioning container images
- Understanding the Docker Internals
- Cgroups, namespaces, and beyond: what are containers made from?
- PaaS under the hood, episode 1: kernel namespaces
[⬆] return to TOC
- What is nginx?
- What is C10K problem?
- Explain how Nginx can handle multiple connections within a single process?
- Does Nginx support compress the request to the upstream?
Resources
- What is NGINX?
- C10k problem
- Inside NGINX: How We Designed for Performance & Scale
- Tuning NGINX for Performance
- The Architecture of Open Source Applications: nginx
- ngx_http_gunzip_module
- Nginx Interview Questions
[⬆] return to TOC
[⬆] return to TOC
- What are the differences between continuous integration, continuous delivery, and continuous deployment?
- What is the difference between a Blue/Green deployment and a rolling deployment?
- What is the Canary deployment strategy?
- Explain how DevSecOps impacts on the CD pipeline?
- What is pipeline as code?
Resources
- Continuous integration vs. continuous delivery vs. continuous deployment
- Deployment Strategies Defined
- DevSecOps: Injecting Security into CD Pipelines
- What is pipeline as code?
[⬆] return to TOC
-
What are the pros and cons of distributed version control systems like Git over centralized ones like SVN?
-
What is Git fork? What is difference between fork, branch and clone?
-
What is the difference between
git pull
andgit fetch
? -
How to revert previous commit in git?
-
What is
git cherry-pick
? -
What is the difference between HEAD, working tree and index, in Git?
-
Explain the Gitflow workflow?
-
What is
git stash
? And when to use it? -
How to remove a file from git without removing it from the file system?
-
How do you find a list of files that has changed in a particular commit?
-
What is
git bisect
? How can you use it to determine the source of a (regression) bug? -
When to use
git rebase
instead ofgit merge
? What does the interactive rebasing do? -
What are the different ways we can use to refer to a commit?
Resources
[⬆] return to TOC
-
What is Test Driven Development (TDD)? And what is its process?
-
What is Behavior Driven Development (BDD)? And what is its process?
-
What is the difference between Fake, Mock, and Stub?
-
What are the various types of Unit Testing?
-
What is Code Coverage? And what are its various techniques?
-
How is Unit Testing different from Integration Testing?
Resources
- Unit Testing Interview Questions and Answers
- The 100% Code Coverage Myth
- Code Coverage: The Metric That Makes Your Tests Worse
- 5 Questions Every Unit Test Must Answer
- Behavior-Driven Development and Test-Driven Development
- The Value at the Intersection of TDD, DDD, and BDD
[⬆] return to TOC
- What is the difference between static array and dynamic array?
- Compare the time complexity and space complexity of searching, insertion, and deletion for the following data structures:
- Dynamic Array
- Linked List
- Hash Table (Hash Map)
- Binary Search Tree (BST)
- Heap (Max Heap/Min Heap)
- Red-Black Tree
- AVL Tree
- Compare the time complexity and space complexity for the following sorting algorithms:
- Bubble Sort
- Insertion Sort
- Selection Sort
- Merge Sort
- Heap Sort
- Quick Sort
- Counting Sort
- What is the difference between inorder, preorder, and postorder tree traversal algorithms?
- What is the difference between breadth-first-search (BFS) and depth-first-search (DFS)?
[⬆] return to TOC