What is the difference between let, const, and var in JavaScript?
let and const are block-scoped, while var is function-scoped. const cannot be reassigned.
Explain the concept of closures in JavaScript.
A closure is a function that has access to variables from its outer (enclosing) scope.
What is the event loop in JavaScript?
It’s a mechanism that handles asynchronous operations by placing them in a queue and executing them in order.
Front-end Development:
What is responsive web design?
It’s an approach that makes web pages render well on a variety of devices and window sizes.
Explain the difference between == and === in JavaScript.
== performs type coercion, while === enforces strict equality without type conversion.
What is AJAX and how does it work?
AJAX (Asynchronous JavaScript and XML) enables data to be retrieved asynchronously from a server without reloading the entire page.
React.js:
What is React and what are its main features?
React is a JavaScript library for building user interfaces. Its main features include a virtual DOM, JSX syntax, and component-based architecture.
What is JSX in React?
JSX is a syntax extension for JavaScript used with React to describe what the UI should look like.
Explain the concept of state in React.
State is an object that represents the parts of the app that can change. It is mutable and controlled by the component.
Back-end Development:
What is Node.js?
Node.js is a runtime environment that allows the execution of JavaScript code on the server side.
Explain the difference between npm and yarn.
Both are package managers for Node.js, but yarn is generally faster and has a lock file for deterministic dependency resolution.
What is RESTful API and how does it work?
REST (Representational State Transfer) is an architectural style for designing networked applications. It uses standard HTTP methods for communication.
Express.js:
What is Express.js?
Express.js is a web application framework for Node.js, designed for building web applications and APIs.
How does middleware work in Express.js?
Middleware functions have access to the request, response, and the next middleware function. They can modify the request and response objects or end the request-response cycle.
Explain routing in Express.js.
Routing refers to how an application’s endpoints (URIs) respond to client requests. It involves defining the application’s endpoints and how they respond to client requests.
Database:
What is the difference between SQL and NoSQL databases?
SQL databases are relational and use structured query language, while NoSQL databases are non-relational and can handle unstructured data.
Explain the concept of database normalization.
It’s the process of organizing the columns and tables of a relational database to reduce data redundancy and improve data integrity.
What is an ORM?
ORM (Object-Relational Mapping) is a programming technique that converts data between incompatible type systems in object-oriented programming languages.
MongoDB:
What is MongoDB and how does it differ from traditional SQL databases?
MongoDB is a NoSQL database that stores data in flexible, JSON-like documents. It differs from SQL databases by using a document-oriented data model.
Explain what is a BSON in MongoDB.
BSON (Binary JSON) is a binary-encoded serialization of JSON-like documents used in MongoDB.
How do you perform a simple query in MongoDB to find documents?
Use the find() method. For example, db.collection.find({}) retrieves all documents in a collection.
Version Control:
What is Git and how does it work?
Git is a distributed version control system that allows multiple developers to collaborate on a project.
Explain the difference between Git and GitHub.
Git is a version control system, while GitHub is a web-based platform for hosting and collaborating on Git repositories.
What is a Git merge conflict?
It occurs when Git is unable to automatically merge changes from different branches and requires manual intervention.
DevOps:
What is DevOps?
DevOps is a set of practices that combines software development (Dev) and IT operations (Ops) to shorten the development lifecycle and deliver high-quality software continuously.
Explain the concept of continuous integration and continuous deployment (CI/CD).
CI/CD is a set of practices that automate the process of integrating code changes and deploying them to production.
What is Docker and how does it work?
Docker is a platform for developing, shipping, and running applications in containers, which are lightweight, portable, and self-sufficient.
Security:
What is Cross-Site Scripting (XSS) and how can it be prevented?
XSS is a type of security vulnerability that allows attackers to inject malicious scripts into web pages. It can be prevented by validating and sanitizing user input.
Explain the Same-Origin Policy in the context of web security.
The Same-Origin Policy restricts web pages from making requests to a different domain than the one that served the web page.
What is HTTPS and why is it important for web security?
HTTPS (Hypertext Transfer Protocol Secure) is a secure version of HTTP. It encrypts the data transmitted between the browser and the server, providing a secure connection.
Testing:
What is unit testing?
Unit testing is the practice of testing individual units or components of a software to ensure they function as intended.
Explain the difference between unit testing and integration testing.
Unit testing tests individual units or components, while integration testing tests the interaction between multiple components or systems.
What is Test-Driven Development (TDD)?
TDD is a software development process in which tests are written before the code they are intended to test.
Agile/Scrum:
What is Agile development?
Agile is a set of principles for software development that values flexibility and customer satisfaction through iterative development and frequent releases.
Explain the Scrum framework.
Scrum is an Agile framework for managing and developing software. It includes roles such as Scrum Master and Product Owner, and events like Sprint Planning and Daily Standups.
What is a user story in Agile development?
A user story is a brief description of a feature, told from the perspective of the person who desires the new capability, usually a user or customer.
General Development:
What is the SOLID principles of object-oriented programming?
SOLID is an acronym for Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion. These principles aim to make software design more maintainable and scalable.
Explain the DRY principle.
DRY (Don’t Repeat Yourself) is a principle that encourages the avoidance of duplicating code to improve code maintainability.
What is the difference between synchronous and asynchronous programming?
Synchronous programming executes code sequentially, while asynchronous programming allows tasks to be executed independently, and the program to continue without waiting for their completion.
What is the difference between a thread and a process?
A process is an independent program that runs in its own memory space, while a thread is a lightweight process that shares the same memory space as its parent process.
Problem Solving:
Explain the concept of Big O notation.
Big O notation describes the performance or complexity of an algorithm in terms of time and space.
What is the difference between a shallow copy and a deep copy?
A shallow copy duplicates the top-level structure of an object, while a deep copy duplicates the entire structure, including nested objects.
How does garbage collection work in programming languages like JavaScript?
Garbage collection is the automatic process of reclaiming memory occupied by objects that are no longer in use or reachable.
Coding Challenges:
Implement a function to check if a string is a palindrome.
function isPalindrome(str) {
return str === str.split('').reverse().join('');
}
Write a function to find the factorial of a number.
function factorial(n) {
if (n === 0 || n === 1) {
return 1;
}
return n * factorial(n - 1);
}
Implement a function to find the nth Fibonacci number.
function fibonacci(n) {
if (n <= 1) {
return n;
}
return fibonacci(n - 1) + fibonacci(n - 2);
}
Web Security:
What is a CSRF attack and how can it be prevented?
CSRF (Cross-Site Request Forgery) is an attack that tricks the victim into submitting a malicious request. It can be prevented by using anti-CSRF tokens and validating user actions.
Explain the concept of Content Security Policy (CSP).
CSP is a security standard that helps prevent common web-based attacks by allowing developers to declare which sources of content are considered trusted.
How can you protect against SQL injection attacks?
Use parameterized queries or prepared statements, and avoid constructing SQL queries with user input.
Design Patterns:
Explain the Singleton design pattern.
The Singleton pattern ensures a class has only one instance and provides a global point of access to it.
What is the Observer pattern?
The Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Explain the Factory pattern.
The Factory pattern provides an interface for creating objects but leaves the choice of their type to the subclasses, creating an instance of a class.
Front-end Frameworks:
What is Angular and how does it differ from React?
Angular is a JavaScript framework for building web applications, while React is a JavaScript library for building user interfaces. Angular is a full-fledged MVC framework, whereas React focuses on the view layer.
What is Vue.js and what are its key features?
Vue.js is a progressive JavaScript framework used for building user interfaces. Its key features include reactivity, component-based architecture, and ease of integration.
Explain the concept of two-way data binding.
Two-way data binding is a synchronization between the model and the view. Changes in the model update the view, and changes in the view update the model.
Responsive Design:
What is a media query in CSS and how is it used for responsive design?
A media query is a CSS technique used to apply different styles for different devices or screen sizes. It allows the content to adapt to various conditions.
Explain the difference between adaptive and responsive design.
Responsive design uses flexible grids and layouts to adapt to different screen sizes, while adaptive design uses fixed layouts for specific screen sizes.
What is the viewport in a web page and how can you control it?
The viewport is the user’s visible area of a web page. It can be controlled using the <meta> tag with attributes such as width=device-width for responsiveness.
API Design:
What are the key principles of RESTful API design?
Use standard HTTP methods, have a stateless architecture, and follow resource-based URLs.
Explain the difference between GET and POST requests.
GET requests are used to request data from a specified resource, while POST requests are used to submit data to be processed to a specified resource.
What is versioning in API design and why is it important?
Versioning in API design involves managing changes to the API over time. It is important to ensure backward compatibility and smooth transitions for users.
GraphQL:
What is GraphQL and how does it differ from REST?
GraphQL is a query language for APIs and a runtime for executing those queries. It allows clients to request only the data they need. Unlike REST, which exposes multiple endpoints for different resources, GraphQL typically has a single endpoint.
Explain the concept of a GraphQL schema.
A GraphQL schema defines the types of data that can be queried and the relationships between them. It serves as a contract between the client and the server.
What are resolvers in GraphQL?
Resolvers are functions responsible for fetching the data for a specific field in a GraphQL query. They define how to retrieve or manipulate the data associated with the field.
WebSockets:
What is a WebSocket and how does it differ from HTTP?
WebSocket is a communication protocol that provides full-duplex communication channels over a single TCP connection. Unlike HTTP, which is stateless, WebSocket allows bidirectional communication between the client and the server.
Explain the advantages of using WebSockets in real-time applications.
WebSockets enable real-time communication, reducing latency and the need for continuous
Full Stack Developer Interview Question - Edchart BLog
14th Nov 2023[…] Latest 100 Interview Questions for a Full Stack […]